GeezerVison is showing github.com — K8s utils qol by davidcheung · Pull Request #20 · commitdev/zero-aws-eks-stack
K8s utils qol
#20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.tf
(3)
No extension
(1)
All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
Makefile
Original file line number
Diff line number
Diff line change
Expand Up
@@ -17,11 +17,13 @@ apply-env:
terraform init; \
terraform apply
apply-k8s-utils:
apply-k8s-utils: update-k8s-conf
pushd kubernetes/terraform/environments/$(ENV); \
terraform init; \
terraform apply
update-k8s-conf: eks --region <% index .Params `region` %> update-kubeconfig --name <% .Name %>-$(ENV)-<% index .Params `region` %>
teardown: teardown-k8s-utils teardown-env teardown-secrets teardown-remote-state
teardown-remote-state:
Expand Down
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,16 @@
locals {
cert_manager_namespace = "kube-system "
cert_manager_namespace = "cert-manager "
cert_manager_version = "0.14.2"
cluster_issuer_name = var.cert_manager_use_production_acme_environment ? "clusterissuer-letsencrypt-production" : "clusterissuer-letsencrypt-staging"
cert_manager_acme_server = var.cert_manager_use_production_acme_environment ? "https://acme-v02.api.letsencrypt.org/directory" : "https://acme-staging-v02.api.letsencrypt.org/directory"
}
resource "kubernetes_namespace" "cert_manager" {
metadata {
name = "cert-manager"
}
}
# Reference an existing route53 zone
data "aws_route53_zone" "public" {
name = var.external_dns_zone
Expand All
@@ -21,9 +27,11 @@ resource "null_resource" "cert_manager" {
triggers = {
manifest_sha1 = "${sha1("${data.local_file.cert_manager.content}")}"
}
# local exec call requires kubeconfig to be updated
provisioner "local-exec" {
command = "kubectl apply --validate=false -f ${path.module}/files/cert-manager.crds.yaml"
}
depends_on = [kubernetes_namespace.cert_manager]
}
Expand All
@@ -46,6 +54,7 @@ resource "null_resource" "cert_manager_issuer" {
triggers = {
manifest_sha1 = "${sha1("${data.template_file.cert_manager_issuer.rendered}")}"
}
# local exec call requires kubeconfig to be updated
provisioner "local-exec" {
command = "kubectl apply -f - <<EOF\n${data.template_file.cert_manager_issuer.rendered}\nEOF"
}
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -233,6 +233,7 @@ resource "kubernetes_deployment" "kubernetes_dashboard" {
}
revision_history_limit = 10
}
depends_on = [kubernetes_role_binding.kubernetes_dashboard]
}
resource "kubernetes_service" "dashboard_metrics_scraper" {
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -36,9 +36,16 @@ module "db_password" {
name_prefix = "${var.project}-${var.environment}-rds"
}
# secret declared so secret version waits for rds-secret to be ready
# or else we often see a AWSDEFAULT VERSION secret not found error
data "aws_secretsmanager_secret" "rds_master_secret" {
name = module.db_password.secret_name
}
# RDS does not support secret-manager, have to provide the actual string
data "aws_secretsmanager_secret_version" "rds_master_secret" {
secret_id = module.db_password.secret_name
secret_id = data.aws_secretsmanager_secret.rds_master_secret.name
depends_on = [data.aws_secretsmanager_secret.rds_master_secret]
}
module "rds" {
Expand Down
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.