Skip to content

Commit

Permalink
fix san merge
Browse files Browse the repository at this point in the history
  • Loading branch information
okozachenko1203 committed Jun 26, 2024
1 parent b00a97b commit cdd9aeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 4 additions & 0 deletions magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,10 @@ def get_object(self) -> objects.ClusterClass:
"valueFrom": {
"template": textwrap.dedent(
"""\
- {{ .builtin.cluster.name }}
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}.svc
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}.svc.cluster.local
{{ .apiServerSANs }}
"""
),
Expand Down
13 changes: 1 addition & 12 deletions magnum_cluster_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,17 +488,6 @@ def kube_apply_patch(resource):
def generate_api_cert_san_list(cluster: magnum_objects.Cluster):
cert_sans = cluster.labels.get("api_server_cert_sans", "")
additional_cert_sans_list = cert_sans.split(",")
# Prepare the value for certSANs
cert_sans_template = textwrap.dedent(
"""\
- {{ .builtin.cluster.name }}
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}.svc
- {{ .builtin.cluster.name }}.{{ .builtin.cluster.namespace }}.svc.cluster.local
"""
)

# Add the additional cert SANs to the template
for san in additional_cert_sans_list:
cert_sans_template += f"- {san}\n"
return cert_sans_template
return "\n".join(f"- {san}" for san in additional_cert_sans_list if san)

0 comments on commit cdd9aeb

Please sign in to comment.