Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
23 changes: 12 additions & 11 deletions src/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -57,7 +58,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"
Expand Down Expand Up @@ -96,15 +97,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"),
Expand Down
2 changes: 1 addition & 1 deletion src/outputs.tf
Original file line number Diff line number Diff line change
@@ -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"
}
16 changes: 6 additions & 10 deletions src/resources/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
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:
# Add AWS-specific arguments here if needed
# Example: --aws-batch-change-size=1000
6 changes: 1 addition & 5 deletions src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions test/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand All @@ -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{}{
Expand Down
16 changes: 9 additions & 7 deletions test/fixtures/stacks/catalog/usecase/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
14 changes: 8 additions & 6 deletions test/fixtures/stacks/catalog/usecase/disabled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: []
dns_components: []
Loading