Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to help calico images works with customized repository such as Harbor and cluster cannot create with existing network. add add api_lb_availability_zone and api_server_floating_ip label #462

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion magnum_cluster_api/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
79 changes: 64 additions & 15 deletions magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,9 @@ def get_object(self) -> objects.ClusterClass:
"provider": {
"type": "string",
},
"availabilityZone": {
"type": "string",
},
},
},
},
Expand All @@ -997,6 +1000,15 @@ def get_object(self) -> objects.ClusterClass:
},
},
},
{
"name": "apiServerFloatingIP",
"required": True,
"schema": {
"openAPIV3Schema": {
"type": "string",
},
},
},
{
"name": "openidConnect",
"required": True,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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}}',
Expand All @@ -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",
Expand All @@ -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 }}
}"""
),
},
},
},
],
},
],
Expand Down Expand Up @@ -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", ""
),
},
},
{
Expand All @@ -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": {
Expand Down
Loading