From 396a365bcf7c7cd371410ef6476e15ab0d257a2e Mon Sep 17 00:00:00 2001 From: milldr Date: Mon, 25 Aug 2025 15:00:47 -0400 Subject: [PATCH 1/4] replaced bitnami usage --- README.md | 2 +- README.yaml | 26 ++++++++++--------- src/README.md | 23 ++++++++-------- src/main.tf | 17 ++++++------ src/resources/values.yaml | 15 ++++------- src/variables.tf | 6 +---- .../stacks/catalog/usecase/basic.yaml | 16 +++++++----- .../stacks/catalog/usecase/disabled.yaml | 14 +++++----- 8 files changed, 58 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 8e0bcb1..951bcf1 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ components: | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | | [policy](#input\_policy) | Modify how DNS records are synchronized between sources and providers (options: sync, upsert-only) | `string` | `"sync"` | no | -| [publish\_internal\_services](#input\_publish\_internal\_services) | Allow external-dns to publish DNS records for ClusterIP services | `bool` | `true` | no | + | [rbac\_enabled](#input\_rbac\_enabled) | Service Account for pods. | `bool` | `true` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [region](#input\_region) | AWS Region. | `string` | n/a | yes | diff --git a/README.yaml b/README.yaml index 81cf2f5..274ef30 100644 --- a/README.yaml +++ b/README.yaml @@ -3,8 +3,8 @@ name: "aws-eks-external-dns" github_repo: "cloudposse-terraform-components/aws-eks-external-dns" # Short description of this project description: |- - This component creates a Helm deployment for [external-dns](https://github.com/bitnami/bitnami-docker-external-dns) on a - Kubernetes cluster. [external-dns](https://github.com/bitnami/bitnami-docker-external-dns) is a Kubernetes addon that + This component creates a Helm deployment for [external-dns](https://github.com/kubernetes-sigs/external-dns) on a + Kubernetes cluster. [external-dns](https://github.com/kubernetes-sigs/external-dns) is a Kubernetes addon that configures public DNS servers with information about exposed Kubernetes services to make them discoverable. usage: |- @@ -28,8 +28,8 @@ usage: |- enabled: true name: external-dns chart: external-dns - chart_repository: https://charts.bitnami.com/bitnami - chart_version: "6.33.0" + chart_repository: https://kubernetes-sigs.github.io/external-dns/ + chart_version: "1.18.0" create_namespace: true kubernetes_namespace: external-dns resources: @@ -43,13 +43,15 @@ usage: |- # For example, when using blue-green deployment pattern to update EKS cluster. txt_prefix: "" # You can use `chart_values` to set any other chart options. Treat `chart_values` as the root of the doc. - # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/bitnami/external-dns + # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/external-dns/external-dns # # # For example # --- # chart_values: - # aws: - # batchChangeSize: 1000 + # provider: + # name: aws + # extraArgs: + # - --aws-batch-change-size=1000 chart_values: {} # Extra hosted zones to lookup and support by component name dns_components: @@ -65,11 +67,11 @@ usage: |- references: - name: external-dns (Artifact Hub) - url: https://artifacthub.io/packages/helm/bitnami/external-dns - description: Helm chart for ExternalDNS by Bitnami - - name: ExternalDNS (Bitnami Docker) - url: https://github.com/bitnami/bitnami-docker-external-dns - description: ExternalDNS addon container image and docs by Bitnami + url: https://artifacthub.io/packages/helm/external-dns/external-dns + description: Helm chart for ExternalDNS by Kubernetes SIGs + - name: ExternalDNS (GitHub) + url: https://github.com/kubernetes-sigs/external-dns + description: ExternalDNS addon source code and documentation tags: - component/eks/external-dns - layer/eks diff --git a/src/README.md b/src/README.md index 31d3278..db4ed0b 100644 --- a/src/README.md +++ b/src/README.md @@ -8,8 +8,8 @@ tags: # Component: `eks-external-dns` -This component creates a Helm deployment for [external-dns](https://github.com/bitnami/bitnami-docker-external-dns) on a -Kubernetes cluster. [external-dns](https://github.com/bitnami/bitnami-docker-external-dns) is a Kubernetes addon that +This component creates a Helm deployment for [external-dns](https://github.com/kubernetes-sigs/external-dns) on a +Kubernetes cluster. [external-dns](https://github.com/kubernetes-sigs/external-dns) is a Kubernetes addon that configures public DNS servers with information about exposed Kubernetes services to make them discoverable. ## Usage @@ -33,8 +33,8 @@ components: enabled: true name: external-dns chart: external-dns - chart_repository: https://charts.bitnami.com/bitnami - chart_version: "6.33.0" + chart_repository: https://kubernetes-sigs.github.io/external-dns/ + chart_version: "1.18.0" create_namespace: true kubernetes_namespace: external-dns resources: @@ -48,13 +48,15 @@ components: # For example, when using blue-green deployment pattern to update EKS cluster. txt_prefix: "" # You can use `chart_values` to set any other chart options. Treat `chart_values` as the root of the doc. - # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/bitnami/external-dns + # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/external-dns/external-dns # # # For example # --- # chart_values: - # aws: - # batchChangeSize: 1000 + # provider: + # name: aws + # extraArgs: + # - --aws-batch-change-size=1000 chart_values: {} # Extra hosted zones to lookup and support by component name dns_components: @@ -151,7 +153,7 @@ components: | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | | [policy](#input\_policy) | Modify how DNS records are synchronized between sources and providers (options: sync, upsert-only) | `string` | `"sync"` | no | -| [publish\_internal\_services](#input\_publish\_internal\_services) | Allow external-dns to publish DNS records for ClusterIP services | `bool` | `true` | no | + | [rbac\_enabled](#input\_rbac\_enabled) | Service Account for pods. | `bool` | `true` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [region](#input\_region) | AWS Region. | `string` | n/a | yes | @@ -175,12 +177,11 @@ components: ## References -- [external-dns (Artifact Hub)](https://artifacthub.io/packages/helm/bitnami/external-dns) - Helm chart for ExternalDNS by Bitnami +- [external-dns (Artifact Hub)](https://artifacthub.io/packages/helm/external-dns/external-dns) - Helm chart for ExternalDNS by Kubernetes SIGs -- [ExternalDNS (Bitnami Docker)](https://github.com/bitnami/bitnami-docker-external-dns) - ExternalDNS addon container image and docs by Bitnami +- [ExternalDNS (GitHub)](https://github.com/kubernetes-sigs/external-dns) - ExternalDNS addon source code and documentation [](https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-terraform-components/aws-eks-external-dns&utm_content=) - diff --git a/src/main.tf b/src/main.tf index 847a2c5..6928f32 100644 --- a/src/main.tf +++ b/src/main.tf @@ -57,7 +57,7 @@ module "external_dns" { ] effect = "Allow" - resources = formatlist("arn:${join("", data.aws_partition.current.*.partition)}:route53:::hostedzone/%s", local.zone_ids) + resources = formatlist("arn:${data.aws_partition.current[0].partition}:route53:::hostedzone/%s", local.zone_ids) }, { sid = "GrantListHostedZonesListResourceRecordSets" @@ -96,15 +96,14 @@ module "external_dns" { }) : "", # external-dns-specific values yamlencode({ - aws = { - region = var.region + provider = { + name = "aws" } - policy = var.policy - publishInternalServices = var.publish_internal_services - txtOwnerId = local.txt_owner - txtPrefix = local.txt_prefix - sources = local.sources - domainFilters = local.zone_names + policy = var.policy + txtOwnerId = local.txt_owner + txtPrefix = local.txt_prefix + sources = local.sources + domainFilters = local.zone_names }), # hardcoded values file("${path.module}/resources/values.yaml"), diff --git a/src/resources/values.yaml b/src/resources/values.yaml index 5874ee4..b416064 100644 --- a/src/resources/values.yaml +++ b/src/resources/values.yaml @@ -1,10 +1,5 @@ -aws: - evaluateTargetHealth: false -rbac: - ## Service Account for pods - ## https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ - ## RBAC API version - apiVersion: v1 - ## Podsecuritypolicy - pspEnabled: false -provider: aws +# AWS provider configuration for external-dns +# The official external-dns chart uses provider.name instead of the provider field +# AWS-specific settings are configured via extraArgs +extraArgs: + - --aws-evaluate-target-health=false diff --git a/src/variables.tf b/src/variables.tf index 8689b55..22b0fd1 100644 --- a/src/variables.tf +++ b/src/variables.tf @@ -142,11 +142,7 @@ variable "dns_components" { default = [] } -variable "publish_internal_services" { - type = bool - description = "Allow external-dns to publish DNS records for ClusterIP services" - default = true -} + variable "policy" { type = string diff --git a/test/fixtures/stacks/catalog/usecase/basic.yaml b/test/fixtures/stacks/catalog/usecase/basic.yaml index c882073..371f106 100644 --- a/test/fixtures/stacks/catalog/usecase/basic.yaml +++ b/test/fixtures/stacks/catalog/usecase/basic.yaml @@ -10,8 +10,8 @@ components: dns_gbl_primary_environment_name: ue2 name: external-dns chart: external-dns - chart_repository: https://charts.bitnami.com/bitnami - chart_version: "6.33.0" + chart_repository: https://kubernetes-sigs.github.io/external-dns/ + chart_version: "1.18.0" create_namespace: true kubernetes_namespace: external-dns resources: @@ -25,16 +25,18 @@ components: # For example, when using blue-green deployment pattern to update EKS cluster. txt_prefix: "" # You can use `chart_values` to set any other chart options. Treat `chart_values` as the root of the doc. - # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/bitnami/external-dns + # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/external-dns/external-dns # # # For example # --- # chart_values: - # aws: - # batchChangeSize: 1000 + # provider: + # name: aws + # extraArgs: + # - --aws-batch-change-size=1000 chart_values: - crd: - create: true + provider: + name: aws sources: - crd - service diff --git a/test/fixtures/stacks/catalog/usecase/disabled.yaml b/test/fixtures/stacks/catalog/usecase/disabled.yaml index 5a92837..82b1745 100644 --- a/test/fixtures/stacks/catalog/usecase/disabled.yaml +++ b/test/fixtures/stacks/catalog/usecase/disabled.yaml @@ -10,8 +10,8 @@ components: dns_gbl_primary_environment_name: ue2 name: external-dns chart: external-dns - chart_repository: https://charts.bitnami.com/bitnami - chart_version: "6.33.0" + chart_repository: https://kubernetes-sigs.github.io/external-dns/ + chart_version: "1.18.0" create_namespace: true kubernetes_namespace: external-dns resources: @@ -25,13 +25,15 @@ components: # For example, when using blue-green deployment pattern to update EKS cluster. txt_prefix: "" # You can use `chart_values` to set any other chart options. Treat `chart_values` as the root of the doc. - # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/bitnami/external-dns + # See documentation for latest chart version and list of chart_values: https://artifacthub.io/packages/helm/external-dns/external-dns # # # For example # --- # chart_values: - # aws: - # batchChangeSize: 1000 + # provider: + # name: aws + # extraArgs: + # - --aws-batch-change-size=1000 chart_values: {} # Extra hosted zones to lookup and support by component name - dns_components: [] \ No newline at end of file + dns_components: [] From 299a92707aa6092db74b46966cfd3714bc76c193 Mon Sep 17 00:00:00 2001 From: milldr Date: Mon, 25 Aug 2025 16:45:33 -0400 Subject: [PATCH 2/4] debugging --- src/main.tf | 1 + src/outputs.tf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.tf b/src/main.tf index 6928f32..1534f6d 100644 --- a/src/main.tf +++ b/src/main.tf @@ -24,6 +24,7 @@ data "aws_partition" "current" { } module "external_dns" { + count = local.enabled ? 1 : 0 source = "cloudposse/helm-release/aws" version = "0.10.1" diff --git a/src/outputs.tf b/src/outputs.tf index c3e8ab1..789b1ef 100644 --- a/src/outputs.tf +++ b/src/outputs.tf @@ -1,4 +1,4 @@ output "metadata" { - value = module.external_dns.metadata + value = local.enabled ? module.external_dns[0].metadata : null description = "Block status of the deployed release" } From e870970848266e7d53ae84f156639e60e5f23fe5 Mon Sep 17 00:00:00 2001 From: milldr Date: Tue, 26 Aug 2025 12:02:50 -0400 Subject: [PATCH 3/4] fixing tests --- src/resources/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resources/values.yaml b/src/resources/values.yaml index b416064..7843a91 100644 --- a/src/resources/values.yaml +++ b/src/resources/values.yaml @@ -2,4 +2,5 @@ # The official external-dns chart uses provider.name instead of the provider field # AWS-specific settings are configured via extraArgs extraArgs: - - --aws-evaluate-target-health=false + # Add AWS-specific arguments here if needed + # Example: --aws-batch-change-size=1000 From db4804abcc4b5a858ebece0eaef317ccaf1b9727 Mon Sep 17 00:00:00 2001 From: milldr Date: Tue, 26 Aug 2025 12:35:52 -0400 Subject: [PATCH 4/4] Update metadata and DNS record versions in test --- test/component_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/component_test.go b/test/component_test.go index 8228102..7228f42 100644 --- a/test/component_test.go +++ b/test/component_test.go @@ -2,22 +2,23 @@ package test import ( "context" - "testing" "fmt" "strings" + "testing" "time" + "github.com/cloudposse/test-helpers/pkg/atmos" - "github.com/cloudposse/test-helpers/pkg/helm" - awsHelper "github.com/cloudposse/test-helpers/pkg/aws" helper "github.com/cloudposse/test-helpers/pkg/atmos/component-helper" + awsHelper "github.com/cloudposse/test-helpers/pkg/aws" + "github.com/cloudposse/test-helpers/pkg/helm" awsTerratest "github.com/gruntwork-io/terratest/modules/aws" "github.com/gruntwork-io/terratest/modules/random" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" ) @@ -65,15 +66,14 @@ func (s *ComponentSuite) TestBasic() { metadata := metadataArray[0] - assert.Equal(s.T(), metadata.AppVersion, "0.14.0") + assert.Equal(s.T(), metadata.AppVersion, "0.18.0") assert.Equal(s.T(), metadata.Chart, "external-dns") assert.NotNil(s.T(), metadata.FirstDeployed) assert.NotNil(s.T(), metadata.LastDeployed) assert.Equal(s.T(), metadata.Name, "external-dns") assert.Equal(s.T(), metadata.Namespace, namespace) assert.NotNil(s.T(), metadata.Values) - assert.Equal(s.T(), metadata.Version, "6.33.0") - + assert.Equal(s.T(), metadata.Version, "1.18.0") config, err := awsHelper.NewK8SClientConfig(cluster) assert.NoError(s.T(), err) @@ -97,13 +97,13 @@ func (s *ComponentSuite) TestBasic() { "apiVersion": "externaldns.k8s.io/v1alpha1", "kind": "DNSEndpoint", "metadata": map[string]interface{}{ - "name": dnsEndpointName, + "name": dnsEndpointName, "namespace": namespace, }, "spec": map[string]interface{}{ "endpoints": []interface{}{ map[string]interface{}{ - "dnsName": dnsRecordHostName, + "dnsName": dnsRecordHostName, "recordTTL": 300, "recordType": "A", "targets": []interface{}{