Skip to content

Commit

Permalink
Remove dns-controller-manager subcomponent from release vector (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Oct 21, 2024
1 parent 2d05aba commit 5aab58c
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 5 deletions.
3 changes: 3 additions & 0 deletions control-plane/roles/gardener/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ This includes the metal-stack extension provider called [gardener-extension-prov
| gardener_cert_management_issuer_server | | The issuer server used by the cert-management extension |
| gardener_cert_management_precheck_nameservers | | To provide special set of nameservers to be used for prechecking DNSChallenges for an issuer |
| gardener_cert_management_shoot_issuers_enabled | | If enabled, allows to specify issuers in the shoot clusters |
| gardener_shoot_dns_service_image_vector_overwrite | | Allows overriding the image vector for the shoot-dns-service extension |
| gardener_shoot_dns_service_dns_controller_manager_image_name | | Setting an explicit image name for the dns-controller-manager |
| gardener_shoot_dns_service_dns_controller_manager_image_tag | | Setting an explicit image tag for the dns-controller-manager |

### Certificates

Expand Down
8 changes: 8 additions & 0 deletions control-plane/roles/gardener/defaults/main/extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ gardener_extension_networking_cilium_image_vector_overwrite: []
# sourceRepository: /source/repository
# repository: /repository
# tag: <tag>

gardener_shoot_dns_service_image_vector_overwrite: []
# - name: dns-controller-manager
# sourceRepository: github.com/gardener/external-dns-management
# repository: europe-docker.pkg.dev/gardener-project/public/dns-controller-manager
# tag: "0.7.1"
gardener_shoot_dns_service_dns_controller_manager_image_name:
gardener_shoot_dns_service_dns_controller_manager_image_tag:
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ providerConfig:
image:
repository: "{{ gardener_shoot_dns_service_image_name }}"
tag: "{{ gardener_shoot_dns_service_image_tag }}"
{% if gardener_shoot_dns_service_image_vector_overwrite %}
imageVectorOverwrite: |
images:
{{ gardener_shoot_dns_service_image_vector_overwrite | to_nice_yaml(indent=2) | indent(width=8, first=false) }}
{% endif %}
dnsProviderManagement:
enabled: true
dnsControllerManager:
image:
tag: "{{ gardener_dns_controller_manager_image_tag }}"
repository: "{{ gardener_dns_controller_manager_image_name }}"
deploy: true
{% if gardener_shoot_dns_service_dns_controller_manager_image_name or gardener_shoot_dns_service_dns_controller_manager_image_tag %}
image:
{% if gardener_shoot_dns_service_dns_controller_manager_image_tag %}
tag: "{{ gardener_shoot_dns_service_dns_controller_manager_image_tag }}"
{% endif %}
{% if gardener_shoot_dns_service_dns_controller_manager_image_name %}
repository: "{{ gardener_shoot_dns_service_dns_controller_manager_image_name }}"
{% endif %}
{% endif %}
80 changes: 80 additions & 0 deletions control-plane/roles/gardener/test/dns_extension_template_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import unittest
import sys
import yaml

from ansible.template import Templar
from test import read_template_file
from unittest.mock import patch, MagicMock

class ShootDnsExtensionControllerDeploymentTemplate(unittest.TestCase):
@patch('urllib.request.urlopen')
def test_shoot_dns_extension_controller_deployment_template(self, mock_urlopen):
cm = MagicMock()
cm.getcode.return_value = 200
cm.read.return_value = '''
---
apiVersion: core.gardener.cloud/v1beta1
kind: ControllerDeployment
metadata:
name: extension-shoot-dns-service
type: helm
providerConfig:
chart: a-chart
values:
image:
tag: v1.48.0
'''
mock_urlopen.return_value = cm

t = read_template_file("shoot-dns-service/controller-deployment.yaml")

templar = Templar(loader=None, variables={
"gardener_shoot_dns_service_image_tag": "v0.0.1",
"gardener_shoot_dns_service_repo_ref": "gardener/gardener-extension-shoot-dns-service/{{ gardener_shoot_dns_service_image_tag }}",
"gardener_shoot_dns_service_image_name": "extension-image",
"gardener_shoot_dns_service_image_tag": "extension-tag",
"gardener_shoot_dns_service_image_vector_overwrite": [
{
"name": "dns-controller-manager",
"sourceRepository": "github.com/gardener/external-dns-management",
"repository": "europe-docker.pkg.dev/gardener-project/public/dns-controller-manager",
"tag": "0.7.1",
},
],
"gardener_shoot_dns_service_dns_controller_manager_image_name": "dns-controller-image",
"gardener_shoot_dns_service_dns_controller_manager_image_tag": "dns-controller-tag",
})


res = templar.template(t)

expected = '''
---
apiVersion: core.gardener.cloud/v1beta1
kind: ControllerDeployment
metadata:
name: extension-shoot-dns-service
type: helm
providerConfig:
chart: "a-chart"
values:
image:
repository: "extension-image"
tag: "extension-tag"
imageVectorOverwrite: |
images:
- name: dns-controller-manager
repository: europe-docker.pkg.dev/gardener-project/public/dns-controller-manager
sourceRepository: github.com/gardener/external-dns-management
tag: 0.7.1
dnsProviderManagement:
enabled: true
dnsControllerManager:
deploy: true
image:
tag: "dns-controller-tag"
repository: "dns-controller-image"
'''

self.maxDiff = None
self.assertDictEqual(yaml.safe_load(expected), yaml.safe_load(res))
2 changes: 0 additions & 2 deletions defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ metal_stack_release:
gardener_shoot_cert_service_image_name: "docker-images.third-party.gardener.shoot-cert-service.name"
gardener_shoot_dns_service_image_tag: "docker-images.third-party.gardener.shoot-dns-service.tag"
gardener_shoot_dns_service_image_name: "docker-images.third-party.gardener.shoot-dns-service.name"
gardener_dns_controller_manager_image_tag: "docker-images.third-party.gardener.dns-controller-manager.tag"
gardener_dns_controller_manager_image_name: "docker-images.third-party.gardener.dns-controller-manager.name"
gardener_metrics_exporter_image_tag: "docker-images.third-party.gardener.metrics-exporter.tag"
gardener_metrics_exporter_image_name: "docker-images.third-party.gardener.metrics-exporter.name"
gardener_extension_acl_image_name: "docker-images.third-party.gardener.acl-extension.name"
Expand Down

0 comments on commit 5aab58c

Please sign in to comment.