Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
zenika-labs-sa.json


traefik-apply.yaml
secrets
### Terraform ###
# Local .terraform directories
**/.terraform/*
Expand Down
5 changes: 4 additions & 1 deletion ci-cd-platform-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ Fill the following placeholders in the [traefik descriptor](traefik.yaml):
- `ACME_EMAIL_ADDRESS`: the contact email address to use to generate the TLS certificates
- `GCE_PROJECT`: the name of the Google Cloud project

> a script is at your disposal to create the taraefik-apply.yaml file from the traefik.yaml template, this script needs as input the values of the variables (below) and then it will take care of replacing everything

Then apply it:
```shell script
kubectl apply -f traefik.yaml
sh scripts/traefik-apply.sh
kubectl apply -f traefik-apply.yaml
```

This will:
Expand Down
4,617 changes: 4,598 additions & 19 deletions ci-cd-platform-deployment/crd.yaml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions ci-cd-platform-deployment/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: [GCE_PROJECT]
8 changes: 6 additions & 2 deletions ci-cd-platform-deployment/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: traefik-ingress-controller
Expand All @@ -26,26 +26,30 @@ rules:
- watch
- apiGroups:
- extensions
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- traefik.io
- traefik.containo.us
resources:
- middlewares
- middlewaretcps
- ingressroutes
- traefikservices
- ingressroutetcps
- ingressrouteudps
- tlsoptions
- tlsstores
- serverstransports
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: traefik-ingress-controller
Expand Down
12 changes: 11 additions & 1 deletion ci-cd-platform-deployment/traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
serviceAccountName: traefik-ingress-controller
containers:
- name: traefik
image: traefik:v2.3.5
image: traefik:v2.10.4
args:
- --ping
- --api.dashboard
Expand All @@ -51,6 +51,9 @@ spec:
- --certificatesResolvers.letsencrypt.acme.storage=/acme/acme.json
- --certificatesResolvers.letsencrypt.acme.email=[ACME_EMAIL_ADDRESS]
- --certificatesResolvers.letsencrypt.acme.dnsChallenge.provider=gcloud
- --certificatesResolvers.letsencrypt-tls.acme.storage=/acme/acme-tls.json
- --certificatesResolvers.letsencrypt-tls.acme.email=[ACME_EMAIL_ADDRESS]
- --certificatesResolvers.letsencrypt-tls.acme.tlschallenge=true
env:
- name: GCE_PROJECT
value: [GCE_PROJECT]
Expand All @@ -69,6 +72,13 @@ spec:
- name: traefik-service-account
mountPath: /service-account
readOnly: true
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1000m
memory: 100Mi
readinessProbe:
httpGet:
path: /ping
Expand Down
14 changes: 14 additions & 0 deletions scripts/traefik-apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

GCE_PROJECT_VALUE="#########"
DOMAIN_VALUE="#########"
ACME_EMAIL_ADDRESS="#########"

# Get the parent directory of the script
PARENT_DIRECTORY=$(git rev-parse --show-toplevel)
CI_CD_FOLDER_NAME=ci-cd-platform-deployment
# Perform multiple replacements using a single sed command
sed -e "s/\[GCE_PROJECT\]/$GCE_PROJECT_VALUE/g" \
-e "s/\[DOMAIN\]/$DOMAIN_VALUE/g" \
-e "s/\[ACME_EMAIL_ADDRESS\]/$ACME_EMAIL_ADDRESS/g" \
"$PARENT_DIRECTORY/$CI_CD_FOLDER_NAME/traefik.yaml" > "$PARENT_DIRECTORY/$CI_CD_FOLDER_NAME/traefik-apply.yaml"