From ddfb876471464dc62cefba52628f724423b8d2ea Mon Sep 17 00:00:00 2001 From: Michal Gubricky Date: Mon, 22 Jul 2024 15:30:43 +0200 Subject: [PATCH] :sparkles: Possibility to leave external network ID empty (#144) * Possibility to leave external network ID empty Signed-off-by: michal.gubricky * Adjust enableIf conditions for external_id Signed-off-by: michal.gubricky --------- Signed-off-by: michal.gubricky --- .../scs/cluster-class/templates/cluster-class.yaml | 8 +++++--- .../templates/openstack-cluster-template.yaml | 2 -- providers/openstack/scs/cluster-class/values.yaml | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/providers/openstack/scs/cluster-class/templates/cluster-class.yaml b/providers/openstack/scs/cluster-class/templates/cluster-class.yaml index 2f0a5777..ebdcf2fb 100644 --- a/providers/openstack/scs/cluster-class/templates/cluster-class.yaml +++ b/providers/openstack/scs/cluster-class/templates/cluster-class.yaml @@ -38,7 +38,6 @@ spec: schema: openAPIV3Schema: type: string - default: "ebfe5546-f09f-4f42-ab54-094e457d42ec" example: "ebfe5546-f09f-4f42-ab54-094e457d42ec" format: "uuid4" description: "ExternalNetworkID is the ID of an external OpenStack Network. This is necessary to get public internet to the VMs." @@ -553,7 +552,7 @@ cre ate group names like oidc:engineering and oidc:infra." sizeGiB: {{"{{"}} .worker_root_disk {{"}}"}} - name: external_id description: "Sets the ID of an external OpenStack Network. This is necessary to get public internet to the VMs." - enabledIf: {{ `'{{ ne .external_id "" }}'` }} + enabledIf: {{ `"{{ if .external_id }}true{{end}}"` }} definitions: - selector: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 @@ -561,7 +560,10 @@ cre ate group names like oidc:engineering and oidc:infra." matchResources: infrastructureCluster: true jsonPatches: - - op: replace + - op: add + path: "/spec/template/spec/externalNetwork" + value: {} + - op: add path: "/spec/template/spec/externalNetwork/id" valueFrom: variable: external_id diff --git a/providers/openstack/scs/cluster-class/templates/openstack-cluster-template.yaml b/providers/openstack/scs/cluster-class/templates/openstack-cluster-template.yaml index 90128212..cb9b3e60 100644 --- a/providers/openstack/scs/cluster-class/templates/openstack-cluster-template.yaml +++ b/providers/openstack/scs/cluster-class/templates/openstack-cluster-template.yaml @@ -51,5 +51,3 @@ spec: {{- range .Values.dns_nameservers }} - {{ . }} {{- end }} - externalNetwork: - id: {{ .Values.external_id }} diff --git a/providers/openstack/scs/cluster-class/values.yaml b/providers/openstack/scs/cluster-class/values.yaml index 5d15de94..6e723216 100644 --- a/providers/openstack/scs/cluster-class/values.yaml +++ b/providers/openstack/scs/cluster-class/values.yaml @@ -1,5 +1,4 @@ # mirrored from variables.tf -external_id: ebfe5546-f09f-4f42-ab54-094e457d42ec dns_nameservers: - 5.1.66.255 - 185.150.99.255