From d77b1bb61fcb55228ccc41724d1c56419b752183 Mon Sep 17 00:00:00 2001 From: ngyenhuukhoi Date: Wed, 17 Jan 2024 20:44:46 +0700 Subject: [PATCH 1/6] Update resources.py change cinder csi provisioner from kubernetes.io/cinder to cinder.csi.openstack.org --- magnum_cluster_api/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index 7a3e0a15..fbd2f5ee 100644 --- a/magnum_cluster_api/resources.py +++ b/magnum_cluster_api/resources.py @@ -230,7 +230,7 @@ def get_object(self) -> pykube.ConfigMap: else {}, "name": "block-%s" % utils.convert_to_rfc1123(vt.name), }, - "provisioner": "kubernetes.io/cinder", + "provisioner": "cinder.csi.openstack.org", "parameters": { "type": utils.convert_to_rfc1123(vt.name), }, From 77472aa64cec81bac2bf5c8377e41328949a13be Mon Sep 17 00:00:00 2001 From: ngyenhuukhoi Date: Wed, 17 Jan 2024 20:47:07 +0700 Subject: [PATCH 2/6] Revert "Update resources.py" --- magnum_cluster_api/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index fbd2f5ee..7a3e0a15 100644 --- a/magnum_cluster_api/resources.py +++ b/magnum_cluster_api/resources.py @@ -230,7 +230,7 @@ def get_object(self) -> pykube.ConfigMap: else {}, "name": "block-%s" % utils.convert_to_rfc1123(vt.name), }, - "provisioner": "cinder.csi.openstack.org", + "provisioner": "kubernetes.io/cinder", "parameters": { "type": utils.convert_to_rfc1123(vt.name), }, From 6bad1c16afc1e6cedd60a69d4e6f9cb5cc8ca8bf Mon Sep 17 00:00:00 2001 From: nguyenhuukhoi Date: Thu, 18 Jan 2024 06:32:51 +0700 Subject: [PATCH 3/6] Update resources.py update --- magnum_cluster_api/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index 7a3e0a15..fbd2f5ee 100644 --- a/magnum_cluster_api/resources.py +++ b/magnum_cluster_api/resources.py @@ -230,7 +230,7 @@ def get_object(self) -> pykube.ConfigMap: else {}, "name": "block-%s" % utils.convert_to_rfc1123(vt.name), }, - "provisioner": "kubernetes.io/cinder", + "provisioner": "cinder.csi.openstack.org", "parameters": { "type": utils.convert_to_rfc1123(vt.name), }, From 77d106e58cfe5373144748328d1e06cda34a466b Mon Sep 17 00:00:00 2001 From: nguyenhuukhoi Date: Thu, 28 Nov 2024 13:46:40 +0700 Subject: [PATCH 4/6] Update image_utils.py fix to help calico images works with customized repository such as Harbor. --- magnum_cluster_api/image_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magnum_cluster_api/image_utils.py b/magnum_cluster_api/image_utils.py index 03cabc26..b53aa1e5 100644 --- a/magnum_cluster_api/image_utils.py +++ b/magnum_cluster_api/image_utils.py @@ -58,7 +58,7 @@ def get_image(name: str, repository: str = None): new_image_name = name if name.startswith("docker.io/calico"): - new_image_name = name.replace("docker.io/calico/", f"{repository}/calico/") + new_image_name = name.replace("docker.io/calico/", f"{repository}/calico-") if name.startswith("quay.io/cilium"): new_image_name = name.replace("quay.io/cilium/", f"{repository}/cilium/") if name.startswith("docker.io/k8scloudprovider"): From bfff953610c1585d763055ff46d571c855e5c60c Mon Sep 17 00:00:00 2001 From: nguyenhuukhoi Date: Fri, 13 Dec 2024 06:45:31 +0700 Subject: [PATCH 5/6] Update resources.py This change fixes the bug that prevented us from creating clusters with an existing network. - We should patch managed DNS if newNetworkConfig is enabled - Correct /spec/template/spec/network to use with v1beta1 API --- magnum_cluster_api/resources.py | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index 7c917f96..8fb65513 100644 --- a/magnum_cluster_api/resources.py +++ b/magnum_cluster_api/resources.py @@ -1887,18 +1887,7 @@ def get_object(self) -> objects.ClusterClass: "valueFrom": { "variable": "disableAPIServerFloatingIP" }, - }, - { - "op": "add", - "path": "/spec/template/spec/managedSubnets", - "valueFrom": { - "template": textwrap.dedent( - """\ - - dnsNameservers: {{ .dnsNameservers }} - """ - ), - }, - }, + }, { "op": "add", "path": "/spec/template/spec/externalNetwork", @@ -1951,6 +1940,17 @@ def get_object(self) -> objects.ClusterClass: }, }, "jsonPatches": [ + { + "op": "add", + "path": "/spec/template/spec/managedSubnets", + "valueFrom": { + "template": textwrap.dedent( + """\ + - dnsNameservers: {{ .dnsNameservers }} + """ + ), + }, + }, { "op": "add", "path": "/spec/template/spec/managedSubnets/0/cidr", @@ -1975,11 +1975,15 @@ def get_object(self) -> objects.ClusterClass: "jsonPatches": [ { "op": "add", - "path": "/spec/template/spec/network/name", + "path": "/spec/template/spec/network", "valueFrom": { - "variable": "fixedNetworkName" + "template": textwrap.dedent( + """\ + filter: { name: {{ .fixedNetworkName }} + }""" + ), }, - }, + }, ], }, ], From 636372c7a501198b098981c54fb1abfeb828922d Mon Sep 17 00:00:00 2001 From: nguyenhuukhoi Date: Wed, 18 Dec 2024 19:12:53 +0700 Subject: [PATCH 6/6] add api_lb_availability_zone and api_server_floating_ip label This will help if user need put cluster and api load balancer same AZ. and user can specify floating ip for api load balancer. --- magnum_cluster_api/resources.py | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index 8fb65513..ca962724 100644 --- a/magnum_cluster_api/resources.py +++ b/magnum_cluster_api/resources.py @@ -984,6 +984,9 @@ def get_object(self) -> objects.ClusterClass: "provider": { "type": "string", }, + "availabilityZone": { + "type": "string", + }, }, }, }, @@ -997,6 +1000,15 @@ def get_object(self) -> objects.ClusterClass: }, }, }, + { + "name": "apiServerFloatingIP", + "required": True, + "schema": { + "openAPIV3Schema": { + "type": "string", + }, + }, + }, { "name": "openidConnect", "required": True, @@ -1927,6 +1939,30 @@ def get_object(self) -> objects.ClusterClass: }, ], }, + { + "name": "apiServerFloatingIP", + "enabledIf": '{{ if ne .apiServerFloatingIP "" }}true{{end}}', + "definitions": [ + { + "selector": { + "apiVersion": objects.OpenStackClusterTemplate.version, + "kind": objects.OpenStackClusterTemplate.kind, + "matchResources": { + "infrastructureCluster": True, + }, + }, + "jsonPatches": [ + { + "op": "add", + "path": "/spec/template/spec/apiServerFloatingIP", + "valueFrom": { + "variable": "apiServerFloatingIP" + }, + }, + ], + }, + ], + }, { "name": "newNetworkConfig", "enabledIf": '{{ if eq .fixedNetworkName "" }}true{{end}}', @@ -2643,6 +2679,9 @@ def get_object(self) -> objects.Cluster: "provider": self.cluster.labels.get( "octavia_provider", "amphora" ), + "availabilityZone": self.cluster.labels.get( + "api_lb_availability_zone", "" + ), }, }, { @@ -2652,6 +2691,12 @@ def get_object(self) -> objects.Cluster: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", # noqa: E501 ), }, + { + "name": "apiServerFloatingIP", + "value": self.cluster.labels.get( + "api_server_floating_ip", "" + ), + }, { "name": "openidConnect", "value": {