manage helm app versions

This commit is contained in:
thibault.raquet 2024-03-05 15:27:27 +01:00
parent 6564503691
commit 39042b7779
14 changed files with 198 additions and 71 deletions

View file

@ -2,11 +2,11 @@ stages:
- push
variables:
K3S_VERSION: 1.28.3
KUBERNETES_VERSION: 1.28.3
push:staging:
stage: push
image: alpine/k8s:$K3S_VERSION
image: alpine/k8s:${KUBERNETES_VERSION}
variables:
KUBE_CONTEXT: ldc-web/cluster-k8s:staging-gitlab-agent
DEPLOY_BRANCH: deploy/staging

View file

@ -18,6 +18,38 @@ You need to be connected in dev-cluster-k8s by kubeconfig.
--path=flux/staging \
--deploy-token-auth
Then you need to add a Kustomization resource for each root folder you want to synchronize
with the cluster at the end of the file `flux/staging/gotk-sync.yaml`.
For staging environment:
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: namespaces
namespace: flux-system
spec:
interval: 1m0s
path: ./namespaces
prune: true
sourceRef:
kind: GitRepository
name: cluster-k8s
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: common-services
namespace: flux-system
spec:
interval: 1m0s
path: ./manifests/common-services
prune: true
sourceRef:
kind: GitRepository
name: cluster-k8s
### Create flux agent for production
You need to be connected in cluster-k8s by kubeconfig.
@ -30,3 +62,35 @@ You need to be connected in cluster-k8s by kubeconfig.
--branch=deploy/production \
--path=flux/production \
--deploy-token-auth
Then the resources to add in `flux/production/gotk-sync.yaml` for production environment:
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: namespaces
namespace: flux-system
spec:
interval: 1m0s
path: ./namespaces
prune: true
sourceRef:
kind: GitRepository
name: cluster-k8s
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: common-services
namespace: flux-system
spec:
interval: 1m0s
path: ./manifests
prune: true
sourceRef:
kind: GitRepository
name: cluster-k8s
Note that in production we follow the entire folder `./manifests` to deploy services
as velero or custom services for ldc web.

View file

@ -2,12 +2,12 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: ${GRAFANA_DNS}
namespace: common-services
name: wildcard-${DOMAIN_NAME}
spec:
dnsNames:
- ${GRAFANA_DNS}
secretName: ${GRAFANA_DNS}
- '*.${DOMAIN}'
- '*.k8s.${DOMAIN}'
secretName: secret-wildcard-${DOMAIN_NAME}
issuerRef:
name: letsencrypt-production-dns01
kind: ClusterIssuer

View file

@ -9,7 +9,28 @@ spec:
# Let's Encrypt will use this to contact you about expiring
# certificates, and issues related to your account.
email: support@mediactivegroup.com
server: https://acme${CERT_MANAGER_ACME_ENV}v02.api.letsencrypt.org/directory
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource that will be used to store the account's private key.
name: example-issuer-account-key
# Add a single challenge solver, HTTP01 using nginx
solvers:
- http01:
ingress:
class: traefik
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging-http01
spec:
acme:
# You must replace this email address with your own.
# Let's Encrypt will use this to contact you about expiring
# certificates, and issues related to your account.
email: support@mediactivegroup.com
server: https://acme-staging-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource that will be used to store the account's private key.
name: example-issuer-account-key
@ -27,7 +48,7 @@ metadata:
spec:
acme:
email: support@mediactivegroup.com
server: https://acme${CERT_MANAGER_ACME_ENV}v02.api.letsencrypt.org/directory
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-issuer-account-key
solvers:
@ -41,30 +62,16 @@ spec:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: re7-letsencrypt-production-dns01
name: letsencrypt-staging-dns01
spec:
acme:
email: support@mediactivegroup.com
server: https://acme${CERT_MANAGER_ACME_ENV}v02.api.letsencrypt.org/directory
server: https://acme-staging-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: re7-letsencrypt-issuer-account-key
name: letsencrypt-issuer-account-key
solvers:
- dns01:
cloudflare:
apiTokenSecretRef:
name: cloudflare-api-token-secret
key: api-token
# TODO: décommenter et template ce certificat
#---
#apiVersion: cert-manager.io/v1
#kind: Certificate
#metadata:
# name: wildcard-re7-s-web.fr
#spec:
# dnsNames:
# - '*.re7-s-web.fr'
# secretName: secret-wildcard-re7-s-web.fr # Secret non défini
# issuerRef:
# name: re7-letsencrypt-production-dns01
# kind: ClusterIssuer

View file

@ -9,7 +9,7 @@ spec:
- web
- websecure
routes:
- match: Host(`${GRAFANA_DNS}`)
- match: Host(`grafana.k8s.${DOMAIN_NAME}`)
kind: Rule
services:
- name: prometheus-stack-grafana
@ -17,4 +17,4 @@ spec:
middlewares:
- name: admin-ldc-whitelist
tls:
secretName: ${GRAFANA_DNS}
secretName: wildcard-${DOMAIN_NAME}

View file

@ -1,13 +0,0 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: ${TRAEFIK_DNS}
namespace: common-services
spec:
dnsNames:
- ${TRAEFIK_DNS}
secretName: ${TRAEFIK_DNS}
issuerRef:
name: letsencrypt-production-dns01
kind: ClusterIssuer

View file

@ -1,23 +0,0 @@
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
namespace: common-services
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`${TRAEFIK_DNS}`)
kind: Rule
services: # Service to redirect requests to
- name: api@internal # Special service created by Traefik pod
kind: TraefikService
# Enable auth middleware
# middlewares:
# - name: auth
# - name: admin-ldc-whitelist
# Use the secret generated by cert-manager
# tls:
# secretName: ${TRAEFIK_DNS}

View file

@ -15,7 +15,6 @@ spec:
- 149.202.23.64/26 # LDC
- 151.80.95.176/28 # LDC
- 217.15.92.64/28 # LDC
- 127.0.0.1/32 # TODO: delete this record
---
apiVersion: traefik.containo.us/v1alpha1

View file

@ -0,0 +1,27 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: wenndannmitrespekt.de
namespace: common-services
spec:
dnsNames:
- wenndannmitrespekt.de
secretName: wenndannmitrespekt.de
issuerRef:
name: letsencrypt-production-http01
kind: ClusterIssuer
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: www.jeu.tregalette.bzh
namespace: common-services
spec:
dnsNames:
- www.jeu.tregalette.bzh
secretName: www.jeu.tregalette.bzh
issuerRef:
name: letsencrypt-production-http01
kind: ClusterIssuer

View file

@ -0,0 +1,37 @@
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: redirect-wenndannmitrespekt-to-nature-and-respect
spec:
entryPoints:
- websecure
routes:
- match: Host(`wenndannmitrespekt.de`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
middlewares:
- name: redirect-wenndannmitrespekt-to-nature-and-respect
tls:
secretName: wenndannmitrespekt.de
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: redirect-wwwjeutregalette-to-jeutregalette
spec:
entryPoints:
- websecure
routes:
- match: Host(`www.jeu.tregalette.bzh`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
middlewares:
- name: redirect-wwwjeutregalette-to-jeutregalette
tls:
secretName: www.jeu.tregalette.bzh

View file

@ -0,0 +1,23 @@
---
# Redirect with domain replacement
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirect-wenndannmitrespekt-to-nature-and-respect
spec:
redirectRegex:
regex: ^https://wenndannmitrespekt.de/
replacement: https://www.nature-and-respect.com/de
permanent: true
---
# Redirect with domain replacement
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirect-wwwjeutregalette-to-jeutregalette
spec:
redirectRegex:
regex: ^https://www.jeu.tregalette.bzh/
replacement: https://jeu.tregalette.bzh/
permanent: true

View file

@ -62,3 +62,12 @@ data:
### traefik ###
---
apiVersion: v1
kind: Secret
metadata:
name: traefik-auth-ldc-oe
data:
users: |1
${TRAEFIK_AUTH_LDC_OE}
---

View file

@ -6,15 +6,12 @@ image:
auth:
rootPassword: "${MARIADB_ROOT_PASSWORD}"
database: keycloak
username: ""
password: ""
primary:
persistence:
enabled: true
# existingClaim: "${MARIADB_PVC_NAME}"
existingClaim: "${MARIADB_PVC_NAME}"
storageClass: "csi-cinder-high-speed"
accessModes:
- ReadWriteOnce
size: ${MARIADB_PVC_SIZE}
size: 10Gi

View file

@ -50,7 +50,7 @@ ports:
ingressRoute:
dashboard:
enable: true
matchRule: Host(`${TRAEFIK_DNS}`)
matchRule: Host(`traefik.k8s.${DOMAIN_NAME}`)
entryPoints:
- "traefik"
- "web"
@ -59,7 +59,7 @@ ingressRoute:
- name: auth
- name: admin-ldc-whitelist
# tls:
# secretName: ${TRAEFIK_DNS}
# secretName: wildcard-${DOMAIN_NAME}
providers:
kubernetesCRD: