Remove ControlPlane.k8s_api_endpoint

This commit is contained in:
Tobias Kunze 2025-03-24 11:28:16 +01:00
parent 03989d24d4
commit e85f1fc5f4
4 changed files with 32 additions and 5 deletions

View file

@ -50,7 +50,6 @@ erDiagram
ControlPlane {
string name
string description
string k8s_api_endpoint
json api_credentials
}

View file

@ -112,16 +112,16 @@ class CloudProviderAdmin(admin.ModelAdmin):
@admin.register(ControlPlane)
class ControlPlaneAdmin(admin.ModelAdmin):
form = ControlPlaneAdminForm
list_display = ("name", "cloud_provider", "k8s_api_endpoint")
list_display = ("name", "cloud_provider")
list_filter = ("cloud_provider",)
search_fields = ("name", "description", "k8s_api_endpoint")
search_fields = ("name", "description")
autocomplete_fields = ("cloud_provider",)
actions = ["test_kubernetes_connection"]
fieldsets = (
(
None,
{"fields": ("name", "description", "k8s_api_endpoint", "cloud_provider")},
{"fields": ("name", "description", "cloud_provider")},
),
(
_("API Credentials"),

View file

@ -0,0 +1,29 @@
# Generated by Django 5.2b1 on 2025-03-24 10:27
import encrypted_fields.fields
from django.db import migrations
import servala.core.models.service
class Migration(migrations.Migration):
dependencies = [
("core", "0004_encrypt_api_credentials"),
]
operations = [
migrations.RemoveField(
model_name="controlplane",
name="k8s_api_endpoint",
),
migrations.AlterField(
model_name="controlplane",
name="api_credentials",
field=encrypted_fields.fields.EncryptedJSONField(
help_text="Required fields: certificate-authority-data, server (URL), token",
validators=[servala.core.models.service.validate_api_credentials],
verbose_name="API credentials",
),
),
]

View file

@ -89,7 +89,6 @@ def validate_api_credentials(value):
class ControlPlane(models.Model):
name = models.CharField(max_length=100, verbose_name=_("Name"))
description = models.TextField(blank=True, verbose_name=_("Description"))
k8s_api_endpoint = models.URLField(verbose_name=_("Kubernetes API endpoint"))
# Either contains the fields "certificate_authority_data", "server" and "token", or is empty
api_credentials = EncryptedJSONField(
verbose_name=_("API credentials"),