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"): diff --git a/magnum_cluster_api/resources.py b/magnum_cluster_api/resources.py index 7c917f96..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, @@ -1887,18 +1899,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", @@ -1938,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}}', @@ -1951,6 +1976,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 +2011,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 }} + }""" + ), }, - }, + }, ], }, ], @@ -2639,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", "" + ), }, }, { @@ -2648,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": {