Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ deploy_infra_%:
@/bin/sh -c './make/infra_$*.sh deploy'

.PHONY: deploy_addons
deploy_addons: deploy_addons_load-balancer-controller deploy_addons_fluxcd deploy_addons_external-dns ## Deploy the default addons
deploy_addons: deploy_addons_load-balancer-controller deploy_addons_fluxcd deploy_addons_route53-controller ## Deploy the default addons
deploy_addons_%:
@/bin/sh -c './make/addons.sh deploy_$*'

Expand Down Expand Up @@ -43,7 +43,7 @@ demo_%:
destroy: destroy_infra destroy_local ## Destroy the complete demo stack

.PHONY: destroy_addons
destroy_addons: destroy_addons_external-dns ## Destroy the infra-integrated addons
destroy_addons: destroy_addons_route53-controller destroy_addons_load-balancer-controller## Destroy the infra-integrated addons
destroy_addons_%:
@/bin/sh -c './make/addons.sh destroy_$*'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ data "terraform_remote_state" "k8s_auth" {
}
}

module "external_dns" {
source = "../../../modules/addons/aws/external-dns"
module "route53-controller" {
source = "../../../modules/addons/aws/route53-controller"
name_prefix = "${var.name_prefix}-${var.cluster_id}"
cluster_name = data.terraform_remote_state.infra.outputs.cluster_name
k8s_host = data.terraform_remote_state.infra.outputs.host
k8s_cluster_ca_certificate = data.terraform_remote_state.infra.outputs.cluster_ca_certificate
k8s_client_token = data.terraform_remote_state.k8s_auth.outputs.token
oidc_provider_arn = data.terraform_remote_state.infra.outputs.oidc_provider_arn
cluster_oidc_issuer_url = data.terraform_remote_state.infra.outputs.cluster_oidc_issuer_url
cluster_oidc_id = trimprefix (data.terraform_remote_state.infra.outputs.cluster_oidc_issuer_url, "https://")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

external-dns have to be removed in favour to route53 controller...

vpc_id = data.terraform_remote_state.infra.outputs.vpc_id
region = var.region
tags = local.default_tags
dns_zone = var.external_dns_aws_dns_zone
sources = var.external_dns_sources
annotation_filter = var.external_dns_annotation_filter
label_filter = var.external_dns_label_filter
interval = var.external_dns_interval
output_path = var.output_path
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@ locals {
default_tags = merge(local.tags, var.tags)
}

variable "external_dns_annotation_filter" {
default = ""
}

variable "external_dns_label_filter" {
default = ""
}

variable "external_dns_sources" {
default = "service"
}

variable "external_dns_interval" {
default = "5s"
}

variable "external_dns_aws_dns_zone" {
}

2 changes: 1 addition & 1 deletion demo/scripts/getting_started_guide/04-publish-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
http:
- name: bookinfo
port: 80
hostname: bookinfo.tse.tetratelabs.io
hostname: bookinfo.$cluster_name.aws-ce.sandbox.tetrate.io

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$cluster_name.$external_dns_aws_dns_zone or similar to it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

routing:
rules:
- route:
Expand Down
38 changes: 32 additions & 6 deletions make/addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,32 @@ if [[ ${ACTION} = "deploy_load-balancer-controller" ]]; then
cd "../../.."
fi

if [[ ${ACTION} = "deploy_external-dns" ]]; then
if [[ ${ACTION} = "destroy_load-balancer-controller" ]]; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should go as a separate PR anyway, the focus is route53 controller

source ${ROOT_DIR}/k8s_auth.sh refresh
cd "${ROOT_DIR}/../addons/aws/external-dns"
cd "${ROOT_DIR}/../addons/aws/load-balancer-controller"
export AWS_K8S_CLUSTERS=$(echo ${TFVARS} | jq -c ".k8s_clusters.aws")
export AWS_K8S_CLUSTERS_COUNT=$(echo ${AWS_K8S_CLUSTERS} | jq length)
for i in $(seq 1 ${AWS_K8S_CLUSTERS_COUNT}); do
index=$(($i - 1))
cluster_name=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].name')
region=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].region')
k8s_version=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].version')
if [[ "$cluster_name" == "null" ]]; then
cluster_name=$NAME_PREFIX-$index-$region
fi
terraform workspace new aws-$index-$region || true
terraform workspace select aws-$index-$region
terraform init
terraform destroy ${TERRAFORM_APPLY_ARGS} -var-file="../../../terraform.tfvars.json" \
-var=cluster_id=$index -var=region=$region
terraform workspace select default
done
cd "../../.."
fi

if [[ ${ACTION} = "deploy_route53-controller" ]]; then
source ${ROOT_DIR}/k8s_auth.sh refresh
cd "${ROOT_DIR}/../addons/aws/route53-controller"
export AWS_K8S_CLUSTERS=$(echo ${TFVARS} | jq -c ".k8s_clusters.aws")
export AWS_K8S_CLUSTERS_COUNT=$(echo ${AWS_K8S_CLUSTERS} | jq length)
for i in $(seq 1 ${AWS_K8S_CLUSTERS_COUNT}); do
Expand All @@ -53,16 +76,16 @@ if [[ ${ACTION} = "deploy_external-dns" ]]; then
terraform init
terraform apply ${TERRAFORM_APPLY_ARGS} -var-file="../../../terraform.tfvars.json" \
-var=cluster_id=$index -var=region=$region -var=external_dns_aws_dns_zone=$external_dns_zone
terraform output ${TERRAFORM_OUTPUT_ARGS} | jq . >../../../outputs/terraform_outputs/terraform-aws-external-dns-$index-$cluster_name.json
terraform output ${TERRAFORM_OUTPUT_ARGS} | jq . >../../../outputs/terraform_outputs/terraform-aws-route53-controller-$index-$cluster_name.json
terraform workspace select default
fi
done
cd "../../.."
fi

if [[ ${ACTION} = "destroy_external-dns" ]]; then
if [[ ${ACTION} = "destroy_route53-controller" ]]; then
source ${ROOT_DIR}/k8s_auth.sh refresh
cd "${ROOT_DIR}/../addons/aws/external-dns"
cd "${ROOT_DIR}/../addons/aws/route53-controller"
export AWS_K8S_CLUSTERS=$(echo ${TFVARS} | jq -c ".k8s_clusters.aws")
export AWS_K8S_CLUSTERS_COUNT=$(echo ${AWS_K8S_CLUSTERS} | jq length)
for i in $(seq 1 ${AWS_K8S_CLUSTERS_COUNT}); do
Expand All @@ -79,7 +102,10 @@ if [[ ${ACTION} = "destroy_external-dns" ]]; then
terraform workspace select aws-$index-$region
terraform init
terraform destroy ${TERRAFORM_APPLY_ARGS} -var-file="../../../terraform.tfvars.json" \
-var=cluster_id=$index -var=region=$region -var=external_dns_aws_dns_zone=$external_dns_zone
-var=cluster_id=$index -var=region=$region -var=external_dns_aws_dns_zone=$external_dns_zone -target=module.route53-controller.aws_iam_policy.policy_service_account \
-target=module.route53-controller.aws_iam_role.role_service_account -target=module.route53-controller.aws_iam_role_policy_attachment.policy_attachment_service_account \
-target=module.route53-controller.kubernetes_service_account.service_account -target=module.route53-controller.local_file.aws_cleanup \
-target=module.route53-controller.null_resource.aws_cleanup
terraform workspace select default
fi
done
Expand Down
4 changes: 4 additions & 0 deletions make/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ deploy_action() {
cluster_name=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].name')
region=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].region')
k8s_version=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].version')
external_dns_zone=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].external_dns_zone')
if [[ "$cluster_name" == "null" ]]; then
cluster_name=$NAME_PREFIX-$index-$region
fi
Expand All @@ -54,6 +55,9 @@ case "${ACTION}" in
publish-service | 04-publish-service | 04)
deploy_action "Publishing a Service" "publish-service" "04-publish-service.sh"
;;
publish-service-r53 | 04-r53-publish-service | 04)
deploy_action "Publishing a Service via AWS Route53" "publish-service-r53" "04-r53-publish-service.sh"
;;
publish-api | 05-publish-api | 05)
deploy_action "Publishing an API from the OAS definition" "publish-api" "05-publish-api.sh"
;;
Expand Down
1 change: 1 addition & 0 deletions make/describe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if [[ ${ACTION} = "demo" ]]; then
cluster_name=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].name')
region=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].region')
k8s_version=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].version')
external_dns_zone=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].external_dns_zone')
if [[ "$cluster_name" == "null" ]]; then
cluster_name=$NAME_PREFIX-$index-$region
fi
Expand Down
3 changes: 2 additions & 1 deletion make/tetrate_controlplane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ if [[ ${ACTION} = "deploy" ]]; then
cluster_name=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].name')
region=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].region')
k8s_version=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].version')
external_dns_zone=$(echo $AWS_K8S_CLUSTERS | jq -cr '.['$index'].external_dns_zone')
if [[ "$cluster_name" == "null" ]]; then
cluster_name=$NAME_PREFIX-$index-$region
fi
terraform workspace new aws-$index-$region || true
terraform workspace select aws-$index-$region
terraform init
terraform apply ${TERRAFORM_APPLY_ARGS} -var-file="../../terraform.tfvars.json" \
-var=cluster_name=$cluster_name -var=cluster_id=$index -var=region=$region
-var=cluster_name=$cluster_name -var=cluster_id=$index -var=region=$region -var=external_dns_aws_dns_zone=$external_dns_zone
terraform output ${TERRAFORM_OUTPUT_ARGS} | jq . >../../outputs/terraform_outputs/terraform-tse-controlplane-$index-$cluster_name.json
terraform workspace select default
done
Expand Down
81 changes: 0 additions & 81 deletions modules/addons/aws/external-dns/main.tf

This file was deleted.

2 changes: 1 addition & 1 deletion modules/addons/aws/load-balancer-controller/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ provider "kubernetes" {
}

module "load_balancer_controller" {
source = "git::https://github.com/DNXLabs/terraform-aws-eks-lb-controller.git"
source = "git::https://github.com/smarunich/terraform-aws-eks-lb-controller.git"
helm_chart_version = var.helm_chart_version
cluster_identity_oidc_issuer = var.cluster_oidc_issuer_url
cluster_identity_oidc_issuer_arn = var.oidc_provider_arn
Expand Down
Loading