315 lines
10 KiB
HCL
315 lines
10 KiB
HCL
resource "kubectl_manifest" "Deployment_taiga-events" {
|
|
yaml_body = <<-EOF
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: "${var.instance}-${var.component}-events"
|
|
labels: ${jsonencode(local.event_all_labels)}
|
|
namespace: ${var.namespace}
|
|
spec:
|
|
selector:
|
|
matchLabels: ${jsonencode(local.event_labels)}
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels: ${jsonencode(local.event_labels)}
|
|
spec:
|
|
containers:
|
|
- name: taiga-events
|
|
image: "${var.images.events.registry}/${var.images.events.repository}:${var.images.events.tag}"
|
|
imagePullPolicy: ${var.images.events.pull_policy}
|
|
envFrom:
|
|
- secretRef:
|
|
name: ${kubectl_manifest.secret.name}
|
|
env:
|
|
- name: TAIGA_EVENTS_RABBITMQ_HOST
|
|
value: ${kubectl_manifest.rabbit.name}
|
|
- name: RABBITMQ_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: username
|
|
- name: RABBITMQ_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: password
|
|
ports:
|
|
- name: taiga-events
|
|
containerPort: 8888
|
|
- name: health
|
|
containerPort: 3023
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
volumeMounts:
|
|
- name: files
|
|
mountPath: /taiga-events/docker/env.template
|
|
subPath: env.template
|
|
volumes:
|
|
- name: files
|
|
configMap:
|
|
name: ${kubectl_manifest.cm_events.name}
|
|
EOF
|
|
}
|
|
# livenessProbe:
|
|
# httpGet:
|
|
# path: /admin/login/
|
|
# port: 8000
|
|
# initialDelaySeconds: 20
|
|
# periodSeconds: 10
|
|
# timeoutSeconds: 5
|
|
# successThreshold: 1
|
|
# failureThreshold: 3
|
|
# readinessProbe:
|
|
# httpGet:
|
|
# path: /admin/login/
|
|
# port: 8000
|
|
# initialDelaySeconds: 5
|
|
# periodSeconds: 10
|
|
# timeoutSeconds: 1
|
|
# successThreshold: 1
|
|
# failureThreshold: 3
|
|
|
|
resource "kubectl_manifest" "Deployment_taiga-front" {
|
|
yaml_body = <<-EOF
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: "${var.instance}-${var.component}-front"
|
|
labels: ${jsonencode(local.front_all_labels)}
|
|
namespace: ${var.namespace}
|
|
spec:
|
|
selector:
|
|
matchLabels: ${jsonencode(local.front_labels)}
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels: ${jsonencode(local.front_labels)}
|
|
spec:
|
|
containers:
|
|
- name: taiga-front
|
|
image: "${var.images.front.registry}/${var.images.front.repository}:${var.images.front.tag}"
|
|
imagePullPolicy: ${var.images.front.pull_policy}
|
|
env:
|
|
- name: GITLAB_CLIENT_ID
|
|
value: gitlab-api-client-id
|
|
envFrom:
|
|
- configMapRef:
|
|
name: ${kubectl_manifest.cm_env_front.name}
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
httpHeaders:
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ready
|
|
port: http
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 3
|
|
EOF
|
|
}
|
|
|
|
resource "kubectl_manifest" "Deployment_taiga-protected" {
|
|
yaml_body = <<-EOF
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: "${var.instance}-${var.component}-protected"
|
|
labels: ${jsonencode(local.protected_all_labels)}
|
|
namespace: ${var.namespace}
|
|
spec:
|
|
selector:
|
|
matchLabels: ${jsonencode(local.protected_labels)}
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels: ${jsonencode(local.protected_labels)}
|
|
spec:
|
|
containers:
|
|
- name: taiga-protected
|
|
image: "${var.images.protected.registry}/${var.images.protected.repository}:${var.images.protected.tag}"
|
|
imagePullPolicy: ${var.images.protected.pull_policy}
|
|
env:
|
|
- name: SECRET_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.secret.name}
|
|
key: TAIGA_SECRET_KEY
|
|
- name: MAX_AGE
|
|
value: '360'
|
|
ports:
|
|
- name: taiga-protected
|
|
containerPort: 8003
|
|
EOF
|
|
}
|
|
|
|
resource "kubectl_manifest" "Deployment_taiga-back" {
|
|
yaml_body = <<-EOF
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: "${var.instance}-${var.component}-back"
|
|
labels: ${jsonencode(local.back_all_labels)}
|
|
namespace: ${var.namespace}
|
|
spec:
|
|
selector:
|
|
matchLabels: ${jsonencode(local.back_labels)}
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels: ${jsonencode(local.back_labels)}
|
|
spec:
|
|
containers:
|
|
- name: taiga-back
|
|
image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}"
|
|
imagePullPolicy: ${var.images.back.pull_policy}
|
|
env:
|
|
- name: TAIGA_EVENTS_RABBITMQ_HOST
|
|
value: ${kubectl_manifest.rabbit.name}
|
|
- name: TAIGA_ASYNC_RABBITMQ_HOST
|
|
value: ${kubectl_manifest.rabbit.name}
|
|
- name: RABBITMQ_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: username
|
|
- name: RABBITMQ_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: password
|
|
- name: GITLAB_API_CLIENT_ID
|
|
value: gitlab-api-client-id
|
|
- name: GITLAB_API_CLIENT_SECRET
|
|
value: gitlab-api-client-secret
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${var.instance}-${var.component}-pg-app
|
|
key: password
|
|
envFrom:
|
|
- secretRef:
|
|
name: ${kubectl_manifest.secret.name}
|
|
- configMapRef:
|
|
name: ${kubectl_manifest.cm_env_back.name}
|
|
ports:
|
|
- name: taiga-back
|
|
containerPort: 8000
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /taiga-back/static
|
|
subPath: static
|
|
- name: data
|
|
mountPath: /taiga-back/media
|
|
subPath: media
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/v1/
|
|
port: 8000
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/v1/
|
|
port: 8000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
- name: taiga-async
|
|
image: "${var.images.back.registry}/${var.images.back.repository}:${var.images.back.tag}"
|
|
imagePullPolicy: ${var.images.back.pull_policy}
|
|
command:
|
|
- /taiga-back/docker/async_entrypoint.sh
|
|
env:
|
|
- name: RABBITMQ_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: username
|
|
- name: RABBITMQ_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${kubectl_manifest.rabbit_user_secret.name}
|
|
key: password
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ${var.instance}-${var.component}-pg-app
|
|
key: password
|
|
envFrom:
|
|
- secretRef:
|
|
name: ${kubectl_manifest.secret.name}
|
|
- configMapRef:
|
|
name: ${kubectl_manifest.cm_env_back.name}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /taiga-back/static
|
|
subPath: static
|
|
- name: data
|
|
mountPath: /taiga-back/media
|
|
subPath: media
|
|
- name: nginx
|
|
image: "${var.images.nginx.registry}/${var.images.nginx.repository}:${var.images.nginx.tag}"
|
|
imagePullPolicy: ${var.images.nginx.pull_policy}
|
|
ports:
|
|
- name: http
|
|
containerPort: 8080
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /taiga/static
|
|
subPath: static
|
|
- name: data
|
|
mountPath: /taiga/media
|
|
subPath: media
|
|
- name: taiga-conf
|
|
mountPath: /etc/nginx/conf.d/
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: ${kubectl_manifest.pvc.name}
|
|
- name: taiga-conf
|
|
configMap:
|
|
name: ${kubectl_manifest.cm_nginx.name}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
httpHeaders:
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ready
|
|
port: http
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 3
|
|
EOF
|
|
}
|