This commit is contained in:
2024-05-27 18:46:25 +02:00
parent 8026666e32
commit 5f7e4245c3
3 changed files with 103 additions and 88 deletions

View File

@@ -132,18 +132,18 @@ options:
back: back:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-back repository: sebt3/taiga-back
tag: 6.7.3 tag: 6.8.0
events: events:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-events repository: sebt3/taiga-events
tag: 6.7.0 tag: 6.8.0
front: front:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-front repository: sebt3/taiga-front
tag: 6.7.7 tag: 6.8.0
nginx: nginx:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
@@ -156,8 +156,8 @@ options:
protected: protected:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-protected repository: sebt3/taiga-protected
tag: 6.7.0 tag: 6.8.0
rabbit: rabbit:
registry: docker.io registry: docker.io
repository: rabbitmq repository: rabbitmq
@@ -166,18 +166,18 @@ options:
- back: - back:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-back repository: sebt3/taiga-back
tag: 6.7.3 tag: 6.8.0
events: events:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-events repository: sebt3/taiga-events
tag: 6.7.0 tag: 6.8.0
front: front:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-front repository: sebt3/taiga-front
tag: 6.7.7 tag: 6.8.0
nginx: nginx:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
@@ -190,8 +190,8 @@ options:
protected: protected:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-protected repository: sebt3/taiga-protected
tag: 6.7.0 tag: 6.8.0
rabbit: rabbit:
registry: docker.io registry: docker.io
repository: rabbitmq repository: rabbitmq
@@ -201,8 +201,8 @@ options:
default: default:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-back repository: sebt3/taiga-back
tag: 6.7.3 tag: 6.8.0
properties: properties:
pull_policy: pull_policy:
default: IfNotPresent default: IfNotPresent
@@ -215,18 +215,18 @@ options:
default: docker.io default: docker.io
type: string type: string
repository: repository:
default: taigaio/taiga-back default: sebt3/taiga-back
type: string type: string
tag: tag:
default: 6.7.3 default: 6.8.0
type: string type: string
type: object type: object
events: events:
default: default:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-events repository: sebt3/taiga-events
tag: 6.7.0 tag: 6.8.0
properties: properties:
pull_policy: pull_policy:
default: IfNotPresent default: IfNotPresent
@@ -239,18 +239,18 @@ options:
default: docker.io default: docker.io
type: string type: string
repository: repository:
default: taigaio/taiga-events default: sebt3/taiga-events
type: string type: string
tag: tag:
default: 6.7.0 default: 6.8.0
type: string type: string
type: object type: object
front: front:
default: default:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-front repository: sebt3/taiga-front
tag: 6.7.7 tag: 6.8.0
properties: properties:
pull_policy: pull_policy:
default: IfNotPresent default: IfNotPresent
@@ -263,10 +263,10 @@ options:
default: docker.io default: docker.io
type: string type: string
repository: repository:
default: taigaio/taiga-front default: sebt3/taiga-front
type: string type: string
tag: tag:
default: 6.7.7 default: 6.8.0
type: string type: string
type: object type: object
nginx: nginx:
@@ -313,8 +313,8 @@ options:
default: default:
pull_policy: IfNotPresent pull_policy: IfNotPresent
registry: docker.io registry: docker.io
repository: taigaio/taiga-protected repository: sebt3/taiga-protected
tag: 6.7.0 tag: 6.8.0
properties: properties:
pull_policy: pull_policy:
default: IfNotPresent default: IfNotPresent
@@ -327,10 +327,10 @@ options:
default: docker.io default: docker.io
type: string type: string
repository: repository:
default: taigaio/taiga-protected default: sebt3/taiga-protected
type: string type: string
tag: tag:
default: 6.7.0 default: 6.8.0
type: string type: string
type: object type: object
rabbit: rabbit:

View File

@@ -27,7 +27,6 @@ resource "kubectl_manifest" "cm_env_back" {
ENABLE_TRELLO_IMPORTER: "False" ENABLE_TRELLO_IMPORTER: "False"
OPENID_CONNECT_SCOPES: "openid email profile" OPENID_CONNECT_SCOPES: "openid email profile"
GITLAB_URL: "${module.oauth2.sso_configuration_url}" GITLAB_URL: "${module.oauth2.sso_configuration_url}"
REQUESTS_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt
EOF EOF
} }
@@ -70,13 +69,12 @@ resource "kubectl_manifest" "cm_env_front" {
ENABLE_TELEMETRY: "false" ENABLE_TELEMETRY: "false"
PUBLIC_REGISTER_ENABLED: "true" PUBLIC_REGISTER_ENABLED: "true"
ENABLE_GITHUB_AUTH: "false" ENABLE_GITHUB_AUTH: "false"
ENABLE_GITLAB_AUTH: "true" ENABLE_GITLAB_AUTH: "false"
ENABLE_OIDC_AUTH: "true"
ENABLE_SLACK: "false" ENABLE_SLACK: "false"
ENABLE_GITHUB_IMPORTER: "false" ENABLE_GITHUB_IMPORTER: "false"
ENABLE_JIRA_IMPORTER: "false" ENABLE_JIRA_IMPORTER: "false"
ENABLE_TRELLO_IMPORTER: "false" ENABLE_TRELLO_IMPORTER: "false"
OPENID_CONNECT_SCOPES: "openid email profile"
GITLAB_URL: "${module.oauth2.sso_configuration_url}"
EOF EOF
} }
@@ -94,40 +92,13 @@ resource "kubectl_manifest" "cm_scripts" {
labels: ${jsonencode(local.postcfg_all_labels)} labels: ${jsonencode(local.postcfg_all_labels)}
namespace: ${var.namespace} namespace: ${var.namespace}
data: data:
back_entrypoint.sh: |- certs.sh: |-
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail
python manage.py migrate
python manage.py loaddata initial_project_templates
if [ -f /etc/local-ca/ca.crt ];then if [ -f /etc/local-ca/ca.crt ];then
cp /etc/local-ca/ca.crt /usr/local/share/ca-certificates/ export REQUESTS_CA_BUNDLE=/etc/local-ca/ca.crt
/usr/sbin/update-ca-certificates else
export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
fi fi
chown -R taiga:taiga /taiga-back
sed -i "s/taiga-events-rabbitmq/{ os.getenv('TAIGA_EVENTS_RABBITMQ_HOST') }/;s/taiga-async-rabbitmq/{ os.getenv('TAIGA_ASYNC_RABBITMQ_HOST') }/" /taiga-back/settings/config.py
echo Starting Taiga API...
exec gosu taiga gunicorn taiga.wsgi:application \
--name taiga_api \
--bind 0.0.0.0:8000 \
--workers 3 \
--worker-tmp-dir /dev/shm \
--log-level=info \
--access-logfile - \
"$@"
async_entrypoint.sh: |-
#!/usr/bin/env bash
set -euo pipefail
chown -R taiga:taiga /taiga-back
if [ -f /etc/local-ca/ca.crt ];then
cp /etc/local-ca/ca.crt /usr/local/share/ca-certificates/
/usr/sbin/update-ca-certificates
fi
sed -i "s/taiga-events-rabbitmq/{ os.getenv('TAIGA_EVENTS_RABBITMQ_HOST') }/;s/taiga-async-rabbitmq/{ os.getenv('TAIGA_ASYNC_RABBITMQ_HOST') }/" /taiga-back/settings/config.py
echo Starting Celery...
exec gosu taiga celery -A taiga.celery worker -B \
--concurrency 4 \
-l INFO \
"$@"
postconfig.py: |- postconfig.py: |-
#!/usr/bin/env python #!/usr/bin/env python
import time import time

View File

@@ -17,11 +17,12 @@ resource "kubectl_manifest" "Deployment_taiga-events" {
metadata: metadata:
labels: ${jsonencode(local.event_labels)} labels: ${jsonencode(local.event_labels)}
spec: spec:
securityContext:
fsGroup: 99
containers: containers:
- name: taiga-events - name: taiga-events
image: "${var.images.events.registry}/${var.images.events.repository}:${var.images.events.tag}" image: "${var.images.events.registry}/${var.images.events.repository}:${var.images.events.tag}"
imagePullPolicy: ${var.images.events.pull_policy} imagePullPolicy: ${var.images.events.pull_policy}
command: ["/bin/start.sh"]
envFrom: envFrom:
- secretRef: - secretRef:
name: ${kubectl_manifest.secret.name} name: ${kubectl_manifest.secret.name}
@@ -61,21 +62,20 @@ resource "kubectl_manifest" "Deployment_taiga-events" {
timeoutSeconds: 1 timeoutSeconds: 1
successThreshold: 1 successThreshold: 1
failureThreshold: 3 failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
runAsGroup: 99
runAsNonRoot: true
runAsUser: 99
seccompProfile:
type: RuntimeDefault
volumeMounts: volumeMounts:
- name: files - name: files
mountPath: /var/lib/env.template mountPath: /var/lib/env.template
subPath: env.template subPath: env.template
- name: scripts
mountPath: /bin/start.sh
subPath: start.sh
volumes: volumes:
- name: scripts
configMap:
name: ${kubectl_manifest.cm_events.name}
defaultMode: 0755
items:
- key: start.sh
path: start.sh
- name: files - name: files
configMap: configMap:
name: ${kubectl_manifest.cm_events.name} name: ${kubectl_manifest.cm_events.name}
@@ -105,6 +105,8 @@ resource "kubectl_manifest" "Deployment_taiga-front" {
metadata: metadata:
labels: ${jsonencode(local.front_labels)} labels: ${jsonencode(local.front_labels)}
spec: spec:
securityContext:
fsGroup: 0
containers: containers:
- name: taiga-front - name: taiga-front
image: "${var.images.front.registry}/${var.images.front.repository}:${var.images.front.tag}" image: "${var.images.front.registry}/${var.images.front.repository}:${var.images.front.tag}"
@@ -134,6 +136,13 @@ resource "kubectl_manifest" "Deployment_taiga-front" {
port: http port: http
initialDelaySeconds: 3 initialDelaySeconds: 3
periodSeconds: 3 periodSeconds: 3
securityContext:
allowPrivilegeEscalation: true
runAsGroup: 0
runAsNonRoot: false
runAsUser: 0
seccompProfile:
type: RuntimeDefault
EOF EOF
} }
@@ -155,6 +164,8 @@ resource "kubectl_manifest" "Deployment_taiga-protected" {
metadata: metadata:
labels: ${jsonencode(local.protected_labels)} labels: ${jsonencode(local.protected_labels)}
spec: spec:
securityContext:
fsGroup: 999
containers: containers:
- name: taiga-protected - name: taiga-protected
image: "${var.images.protected.registry}/${var.images.protected.repository}:${var.images.protected.tag}" image: "${var.images.protected.registry}/${var.images.protected.repository}:${var.images.protected.tag}"
@@ -174,6 +185,15 @@ resource "kubectl_manifest" "Deployment_taiga-protected" {
initialDelaySeconds: 10 initialDelaySeconds: 10
exec: exec:
command: ["/bin/sh", "-c", "pidof -x gunicorn"] command: ["/bin/sh", "-c", "pidof -x gunicorn"]
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
runAsGroup: 999
runAsNonRoot: true
runAsUser: 999
seccompProfile:
type: RuntimeDefault
EOF EOF
} }
@@ -196,11 +216,12 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
metadata: metadata:
labels: ${jsonencode(local.back_labels)} labels: ${jsonencode(local.back_labels)}
spec: spec:
securityContext:
fsGroup: 999
containers: containers:
- name: taiga-back - name: taiga-back
image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}" image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}"
imagePullPolicy: ${var.images.back.pull_policy} imagePullPolicy: ${var.images.back.pull_policy}
command: ["/bin/back_entrypoint.sh"]
env: env:
- name: TAIGA_EVENTS_RABBITMQ_HOST - name: TAIGA_EVENTS_RABBITMQ_HOST
value: ${kubectl_manifest.rabbit.name} value: ${kubectl_manifest.rabbit.name}
@@ -241,8 +262,8 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
containerPort: 8000 containerPort: 8000
volumeMounts: volumeMounts:
- name: scripts - name: scripts
mountPath: /bin/back_entrypoint.sh mountPath: /docker-entrypoint.d/certs.sh
subPath: back_entrypoint.sh subPath: certs.sh
- name: data - name: data
mountPath: /taiga-back/static mountPath: /taiga-back/static
subPath: static subPath: static
@@ -270,10 +291,19 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
timeoutSeconds: 1 timeoutSeconds: 1
successThreshold: 1 successThreshold: 1
failureThreshold: 3 failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
runAsGroup: 999
runAsNonRoot: true
runAsUser: 999
seccompProfile:
type: RuntimeDefault
- name: taiga-async - name: taiga-async
image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}" image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}"
imagePullPolicy: ${var.images.back.pull_policy} imagePullPolicy: ${var.images.back.pull_policy}
command: ["/bin/async_entrypoint.sh"] command: ["/usr/local/bin/async_entrypoint.sh"]
env: env:
- name: RABBITMQ_USER - name: RABBITMQ_USER
valueFrom: valueFrom:
@@ -297,8 +327,8 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
name: ${kubectl_manifest.cm_env_back.name} name: ${kubectl_manifest.cm_env_back.name}
volumeMounts: volumeMounts:
- name: scripts - name: scripts
mountPath: /bin/async_entrypoint.sh mountPath: /docker-entrypoint.d/certs.sh
subPath: async_entrypoint.sh subPath: certs.sh
- name: data - name: data
mountPath: /taiga-back/static mountPath: /taiga-back/static
subPath: static subPath: static
@@ -307,6 +337,15 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
subPath: media subPath: media
- name: certs - name: certs
mountPath: /opt/certs mountPath: /opt/certs
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
runAsGroup: 999
runAsNonRoot: true
runAsUser: 999
seccompProfile:
type: RuntimeDefault
- name: nginx - name: nginx
image: "${var.images.nginx.registry}/${var.images.nginx.repository}:${var.images.nginx.tag}" image: "${var.images.nginx.registry}/${var.images.nginx.repository}:${var.images.nginx.tag}"
imagePullPolicy: ${var.images.nginx.pull_policy} imagePullPolicy: ${var.images.nginx.pull_policy}
@@ -322,6 +361,13 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
subPath: media subPath: media
- name: taiga-conf - name: taiga-conf
mountPath: /etc/nginx/conf.d/ mountPath: /etc/nginx/conf.d/
securityContext:
allowPrivilegeEscalation: true
runAsGroup: 0
runAsNonRoot: false
runAsUser: 0
seccompProfile:
type: RuntimeDefault
volumes: volumes:
- name: certs - name: certs
secret: secret:
@@ -332,10 +378,8 @@ resource "kubectl_manifest" "Deployment_taiga-back" {
name: ${kubectl_manifest.cm_scripts.name} name: ${kubectl_manifest.cm_scripts.name}
defaultMode: 0755 defaultMode: 0755
items: items:
- key: back_entrypoint.sh - key: certs.sh
path: back_entrypoint.sh path: certs.sh
- key: async_entrypoint.sh
path: async_entrypoint.sh
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: ${kubectl_manifest.pvc.name} claimName: ${kubectl_manifest.pvc.name}