Skip to content
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

Feature/adapt infra for dso env #179

Merged
merged 13 commits into from
Sep 29, 2023
Merged
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
20 changes: 20 additions & 0 deletions .github/workflows/dso-automatic-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync DSO gitlab repository

on:
workflow_dispatch:
push:
branches:
- feature/adapt-infra-for-dso-env

jobs:
sync:
runs-on: ubuntu-latest
steps:
- run: |
curl "https://gitlab.apps.c6.numerique-interieur.com/api/v4/projects/62/trigger/pipeline" \
-X POST \
--fail \
-F token=${{ secrets.DSO_TOKEN }} \
-F ref=main \
-F variables[GIT_BRANCH_DEPLOY]=${{ github.ref_name }} \
-F variables[PROJECT_NAME]=infra
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ logs/
temp/
*openrc.sh
.terraform*
.secrets
*.secrets*
version.txt
*.crt
*.pem
43 changes: 43 additions & 0 deletions .gitlab-ci-dso.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
include:
- project: $CATALOG_PATH
file: vault-ci.yml
ref: main
- project: $CATALOG_PATH
file: kaniko-ci.yml
ref: main

default:
image: alpine:latest

variables:
TAG: "${CI_COMMIT_REF_SLUG}"
REGISTRY_URL: "${REGISTRY_HOST}/${PROJECT_PATH}"

stages:
- read-secret
- docker-build

read_secret:
stage: read-secret
extends:
- .vault:read_secret

docker-build-frontend:
variables:
WORKING_DIR: "frontend"
IMAGE_NAMES: basegun-frontend:${CI_COMMIT_REF_SLUG} basegun-frontend:${CI_COMMIT_SHORT_SHA}
DOCKERFILE: "frontend/Dockerfile"
BUILD_ARGS: --build-arg=VERSION=1.1.1
stage: docker-build
extends:
- .kaniko:build-push

docker-build-backend:
variables:
WORKING_DIR: "backend"
IMAGE_NAMES: basegun-backend:${CI_COMMIT_REF_SLUG} basegun-backend:${CI_COMMIT_SHORT_SHA}
DOCKERFILE: "backend/Dockerfile"
BUILD_ARGS: --build-arg=VERSION=1.1.1
stage: docker-build
extends:
- .kaniko:build-push
82 changes: 0 additions & 82 deletions .gitlab-ci.yml

This file was deleted.

1 change: 0 additions & 1 deletion infra/kube/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: {{ include "basegun.name" . }}-config
data:
WORKSPACE: {{ .Values.backend.config.workspace }}
PATH_IMGS: {{ .Values.backend.config.path_imgs }}
PATH_LOGS: /tmp/log/basegun/
---
apiVersion: v1
Expand Down
7 changes: 4 additions & 3 deletions infra/kube/helm/templates/deployment-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spec:
{{- toYaml .Values.backend.securityContext | nindent 12 }}
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
resources: {{- toYaml .Values.backend.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ include "basegun.name" . }}-config
Expand Down Expand Up @@ -60,17 +61,17 @@ spec:
image: "{{ .Values.backend.logs.repository }}:{{ .Values.backend.logs.tag }}"
command: ["/bin/bash"]
args: ["-c", "filebeat -e -c /tmp/filebeat/filebeat.yml --strict.perms=false"]
resources: {}
resources: {{- toYaml .Values.backend.logs.resources | nindent 12 }}
env:
- name: X_OVH_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "basegun.name" . }}-secret
name: {{ .Values.backend.secret.secretName }}
key: X_OVH_TOKEN
- name: API_OVH_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "basegun.name" . }}-secret
name: {{ .Values.backend.secret.secretName }}
key: API_OVH_TOKEN
volumeMounts:
- name: {{ include "basegun.name" . }}-filebeat-conf
Expand Down
1 change: 1 addition & 0 deletions infra/kube/helm/templates/deployment-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
{{- toYaml .Values.frontend.securityContext | nindent 12 }}
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
resources: {{- toYaml .Values.frontend.resources | nindent 12 }}
ports:
- name: http
containerPort: {{ .Values.frontend.service.containerPort }}
Expand Down
42 changes: 42 additions & 0 deletions infra/kube/helm/templates/sops.enc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if .Values.backend.secret.sops -}}
apiVersion: isindir.github.com/v1alpha3
kind: SopsSecret
metadata:
name: sops-secret
spec:
secretTemplates:
- name: ENC[AES256_GCM,data:C7eCSGXEdWtuVa+WYplXamERpCuF2A==,iv:oDDv384GFK0ynFybO0GJXKPjXPUe/++jxUh6oPgSROI=,tag:7auyaf2Pk1gUNCKI+lQjxA==,type:str]
stringData:
API_OVH_TOKEN: ENC[AES256_GCM,data:9fDrMsKCWW4qU5EFsaWhQdA6TIWNueA5sSknmUydichzF1zczSj3nrPtfF7O+dwuWqXUxg==,iv:E8vw8EdDzAigbonjNa57RfTfVpGG9K/Xil+yIAAxPSE=,tag:4qqNEc5RJb1w/WL2dIvt+w==,type:str]
OS_PASSWORD: ENC[AES256_GCM,data:vGHEXzNVjviNsyOam48tvdLbvM+XGBwo204jiH6AruY=,iv:4QXRGhyRjQYyovR68tJzbhzzBiOPHsyNBvruCtk8pl0=,tag:snlHGsj+i5nEIV4aeFz2nQ==,type:str]
OS_PROJECT_NAME: ENC[AES256_GCM,data:Oe4oIqDnNMxjBA1xAHDuSQ==,iv:3pfX8fZ/3hy5LAP0Z0C+joleY33WnXAHUKa377rObto=,tag:CGqewlAyweMW5BSB80qVrg==,type:str]
OS_USERNAME: ENC[AES256_GCM,data:T1BTSS3/nRKMTS7Nk5ZCYi4=,iv:BtWpyd/zxiQPogucbpSzrR6Nn6oIHdbCCpkNhXYzxo8=,tag:mnd+6VxolKMO0vUR/acy4Q==,type:str]
X_OVH_TOKEN: ENC[AES256_GCM,data:Qz1uggOKElNvNBS9qxDfybUMBYEIOfuppySaoXEBx00jWv0u,iv:+cklaR+WWjjJLnD1gmZ38atrqCPNrje0BWofWJstIWA=,tag:czA3G3fU4VC7njajF7xaRw==,type:str]
- name: ENC[AES256_GCM,data:N8b/GxqS/MdpK/ZH1cFzYyppfw==,iv:HIKkI1y6FIVP323NhZMjrf1Ulp7N29jQ0zlMIv3Y7gg=,tag:ZVG+z7ncvoNsi47lofXjZw==,type:str]
stringData:
API_OVH_TOKEN: ENC[AES256_GCM,data:T9TY8BUSKH2fJfhcSX71mD+kpB7Ac9WVNyYOIV1FQpumc5XNsVFad015f3MizRn+rJiHkQ==,iv:bZ74ywut3HGCMbb+9US8n9VWQt5YJmPY1hN1+PefoJY=,tag:0cRa6vMOyWOx5Dd1sqigtg==,type:str]
OS_PASSWORD: ENC[AES256_GCM,data:uT2J6nJyIZEpXwN9L4lvpoMDv/hZXkIbfyZQK5qVRaM=,iv:ZwgDZOaS7Pt4+/1XBZ4sOshuyuSMIkvSPeadZMk2OSQ=,tag:n3djDDeafNArb+p+nF1pGg==,type:str]
OS_PROJECT_NAME: ENC[AES256_GCM,data:TXud2R//KeDgYY1NUH8NnQ==,iv:MydfYwEV58wNKpSn9Mj7tP40RDdOhini4zbByNdvf00=,tag:wI0c8ZCjTQiqmvDRj3p9/A==,type:str]
OS_USERNAME: ENC[AES256_GCM,data:Qule8RjaVy5+zfAtdhxYEQM=,iv:8qPLyyjn1Vr+TgM5Vp9lXLsI8MGExXXecScWaRXeSE0=,tag:j2dcIrxE8fecfr31Rtq3SQ==,type:str]
X_OVH_TOKEN: ENC[AES256_GCM,data:5Zsze+3JSqxle08ePuvHyHDfTelvnrQ2/INbbbwcvOHvPu/9,iv:xlcyVOkwGl0QGAFlWUT+/2LR4lGLcAGDzswkuq6cDUU=,tag:UviczjiBLQ61jEbpbE9YXA==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1g867s7tcftkgkdraz3ezs8xk5c39x6l4thhekhp9s63qxz0m7cgs5kan9a
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBoRG5XVTJTR3NPOVp6dWtX
d2NrNXZybGc2akUzQ1NpbEh1OWlWK2VZd3ljCko0SStxRWZpdVNjNXFmdDdDRlRX
N0ZBckFUNlRjRTNqdU1sVGgza2J5WTgKLS0tIGdycXh2QWZIWFJXVjZBY29xM2xk
eU4vU29uaFdjdk5xQklJanBuUWFkbFUKaZYD36McjUvedtf6vsjDJPlseiYmcPhu
4sQPd4kORdtquDoDFD76y/aY2Rna2XlVd8jMUDyFYssudKjik3y4AQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2023-09-22T15:49:44Z"
mac: ENC[AES256_GCM,data:m7h+73fmAbnb8R2xyytB7kA1gdVmoxOg2rTPSDPbsX0lL5dLay4Jljbz7VvrAnq0DoxJj0AOX/XOopkTnBDGaVUxiPTrzwrZUQQCO/IEB4Tor46EKSKDiglNqPziFuvwBW0Y7UFkBXj2dv8E9YJRk8fFJLHRhgsXiYEeKR+AzNQ=,iv:kx1yeNgJyycWVl+pb1bU+P9dNc1mxs3mRq/E6f2BWUw=,tag:VyD4mDjY24AKEbHZNHoE8w==,type:str]
pgp: []
encrypted_suffix: Templates
version: 3.7.1
{{- end }}
122 changes: 122 additions & 0 deletions infra/kube/helm/values-dso.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Default values for basegun.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

nameOverride: ""
fullnameOverride: ""
ingress:
enabled: true
className: ""
#annotations:
#traefik.ingress.kubernetes.io/router.tls: "true"
#traefik.ingress.kubernetes.io/router.tls.certresolver: letsencrypt
hosts:
- host: basegun.dev.numerique-interieur.com
paths:
- path: /
pathType: Prefix
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
# Config for backend
backend:
replicaCount: 1
image:
repository: harbor.apps.c6.numerique-interieur.com/mi-basegun-test/basegun-backend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: feature-adapt-infra-for-dso-env
imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
logs:
repository: ghcr.io/datalab-mi/basegun/filebeat-rootless
tag: 6.5.4
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 5000
containerPort: 5000
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
config:
# Used for showing current workspace in app
workspace: preprod
secret:
create: false
sops: true
secretName: basegun-preprod-secret
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
# Config for frontend
frontend:
replicaCount: 1
image:
repository: harbor.apps.c6.numerique-interieur.com/mi-basegun-test/basegun-frontend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: feature-adapt-infra-for-dso-env
imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 8080
containerPort: 8080
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
Loading