Skip to content

Commit

Permalink
feat- gitlab/github container reg for aws; cloudflare dns for aws (#536)
Browse files Browse the repository at this point in the history
feat:
* cloudflare dns for aws
* Flagged aws ecr, so we default to the git provider container registry but allow people to choose ecr
fix:

Civo creds fix
* Cloud flare for aws as well as the secret lifecycle for the cloudflare credentials
* significant transformation for bootstrapping aws clusters into the format we use for the other providers

---------

Co-authored-by: Claywd <[email protected]>
  • Loading branch information
claywd and claywd authored Jul 26, 2023
1 parent 4677ef1 commit 5d7c8a7
Show file tree
Hide file tree
Showing 74 changed files with 582 additions and 461 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ metadata:
nginx.ingress.kubernetes.io/backend-protocol: 'HTTPS'
spec:
rules:
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
tls:
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ spec:
privateKeySecretRef:
name: letsencrypt-staging
solvers:
- http01:
ingress:
class: nginx
- http01:
ingress:
class: nginx
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
Expand All @@ -24,6 +24,6 @@ spec:
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: nginx
- http01:
ingress:
class: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-development.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-development.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-development.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-development.<DOMAIN_NAME>
metaphor:
host: https://metaphor-development.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ spec:
helm:
releaseName: external-dns
values: |
image:
repository: registry.k8s.io/external-dns/external-dns
tag: "v0.13.2"
serviceAccount:
create: true
name: external-dns
annotations:
eks.amazonaws.com/role-arn: 'arn:aws:iam::<AWS_ACCOUNT_ID>:role/external-dns-<CLUSTER_NAME>'
provider: <EXTERNAL_DNS_PROVIDER_NAME>
sources:
- ingress
domainFilters:
- <DOMAIN_NAME>
env:
- name: <EXTERNAL_DNS_PROVIDER_TOKEN_ENV_NAME>
valueFrom:
secretKeyRef:
name: <EXTERNAL_DNS_PROVIDER_SECRET_NAME>
key: <EXTERNAL_DNS_PROVIDER_SECRET_KEY>
chart: external-dns
destination:
server: https://kubernetes.default.svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-production.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-production.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-production.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-production.<DOMAIN_NAME>
metaphor:
host: https://metaphor-production.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-staging.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-staging.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-staging.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-staging.<DOMAIN_NAME>
metaphor:
host: https://metaphor-staging.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Expand Down
12 changes: 12 additions & 0 deletions aws-github/terraform/vault/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ resource "vault_generic_secret" "ci_secrets" {
depends_on = [vault_mount.secret]
}

resource "vault_generic_secret" "external_dns_secrets" {
path = "secret/external-dns"

data_json = jsonencode(
{
<EXTERNAL_DNS_PROVIDER_NAME>-token = var.<EXTERNAL_DNS_PROVIDER_NAME>_secret,
}
)

depends_on = [vault_mount.secret]
}

resource "vault_generic_secret" "atlantis_secrets" {
path = "secret/atlantis"

Expand Down
5 changes: 5 additions & 0 deletions aws-github/terraform/vault/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ locals {
cluster_name = "<CLUSTER_NAME>"
}

variable "<EXTERNAL_DNS_PROVIDER_NAME>_secret" {
default = ""
type = string
}

variable "b64_docker_auth" {
type = string
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ metadata:
nginx.ingress.kubernetes.io/backend-protocol: 'HTTPS'
spec:
rules:
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
tls:
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ spec:
privateKeySecretRef:
name: letsencrypt-staging
solvers:
- http01:
ingress:
class: nginx
- http01:
ingress:
class: nginx
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
Expand All @@ -24,6 +24,6 @@ spec:
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: nginx
- http01:
ingress:
class: nginx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-development.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-development.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-development.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-development.<DOMAIN_NAME>
metaphor:
host: https://metaphor-development.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ spec:
helm:
releaseName: external-dns
values: |
image:
repository: registry.k8s.io/external-dns/external-dns
tag: "v0.13.2"
serviceAccount:
create: true
name: external-dns
annotations:
eks.amazonaws.com/role-arn: 'arn:aws:iam::<AWS_ACCOUNT_ID>:role/external-dns-<CLUSTER_NAME>'
provider: <EXTERNAL_DNS_PROVIDER_NAME>
sources:
- ingress
domainFilters:
- <DOMAIN_NAME>
env:
- name: <EXTERNAL_DNS_PROVIDER_TOKEN_ENV_NAME>
valueFrom:
secretKeyRef:
name: <EXTERNAL_DNS_PROVIDER_SECRET_NAME>
key: <EXTERNAL_DNS_PROVIDER_SECRET_KEY>
chart: external-dns
destination:
server: https://kubernetes.default.svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-production.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-production.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-production.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-production.<DOMAIN_NAME>
metaphor:
host: https://metaphor-production.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ metaphor:
annotations:
cert-manager.io/cluster-issuer: 'letsencrypt-prod'
hosts:
- host: metaphor-staging.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
- host: metaphor-staging.<DOMAIN_NAME>
paths:
- path: /
pathType: Prefix
tls:
- secretName: metaphor-tls
hosts:
- metaphor-staging.<DOMAIN_NAME>
- secretName: metaphor-tls
hosts:
- metaphor-staging.<DOMAIN_NAME>
metaphor:
host: https://metaphor-staging.<DOMAIN_NAME>/api
console: https://kubefirst.<DOMAIN_NAME>
Expand Down
11 changes: 11 additions & 0 deletions aws-gitlab/terraform/vault/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ resource "vault_generic_secret" "container_registry_auth" {
depends_on = [vault_mount.secret]
}

resource "vault_generic_secret" "external_dns_secrets" {
path = "secret/external-dns"

data_json = jsonencode(
{
<EXTERNAL_DNS_PROVIDER_NAME>-token = var.<EXTERNAL_DNS_PROVIDER_NAME>_secret, }
)

depends_on = [vault_mount.secret]
}

resource "vault_generic_secret" "development_metaphor" {
path = "secret/development/metaphor"
# note: these secrets are not actually sensitive.
Expand Down
10 changes: 10 additions & 0 deletions aws-gitlab/terraform/vault/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ locals {
cluster_name = "<CLUSTER_NAME>"
}

variable "<EXTERNAL_DNS_PROVIDER_NAME>_secret" {
default = ""
type = string
}

variable "b64_docker_auth" {
type = string
}
Expand Down Expand Up @@ -39,3 +44,8 @@ variable "vault_token" {
default = ""
type = string
}

variable "container_registry_auth" {
default = ""
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ metadata:
nginx.ingress.kubernetes.io/backend-protocol: 'HTTPS'
spec:
rules:
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
- host: argocd.<DOMAIN_NAME>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
tls:
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
- hosts:
- argocd.<DOMAIN_NAME>
secretName: argocd-secret # do not change, this is provided by Argo CD
Loading

0 comments on commit 5d7c8a7

Please sign in to comment.