mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
Merge branch 'dev' into fix/ENG_1142_redis_tf_conf
This commit is contained in:
@@ -6,8 +6,8 @@ locals {
|
||||
|
||||
locals {
|
||||
tags_common = {
|
||||
ClusterId = var.kubernetes_full_cluster_id
|
||||
ClusterName = var.kubernetes_cluster_name,
|
||||
ClusterId = var.kubernetes_cluster_id
|
||||
ClusterLongId = var.kubernetes_full_cluster_id
|
||||
OrganizationId = var.organization_id,
|
||||
Region = var.region
|
||||
creationDate = time_static.on_cluster_create.rfc3339
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
image:
|
||||
## Bitnami MongoDB registry
|
||||
##
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
## Bitnami MongoDB image name
|
||||
##
|
||||
repository: bitnami/mongodb
|
||||
@@ -207,19 +207,18 @@ annotations: {}
|
||||
|
||||
# Additional abels to apply to the deployment or statefulsets
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: {{ sanitized_name }}
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
# Annotations to be added to MongoDB pods
|
||||
podAnnotations: {}
|
||||
|
||||
# Additional pod labels to apply
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
##
|
||||
image:
|
||||
debug: false
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
tag: "{{ version }}"
|
||||
|
||||
@@ -44,10 +44,9 @@ fullnameOverride: {{ sanitized_name }}
|
||||
clusterDomain: cluster.local
|
||||
|
||||
commonLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: {{ sanitized_name }}
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
|
||||
|
||||
@@ -13,7 +13,7 @@ global:
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: "{{ version }}"
|
||||
## Specify a imagePullPolicy
|
||||
@@ -349,14 +349,14 @@ master:
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
annotations: {}
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ""
|
||||
## Extra init containers
|
||||
|
||||
@@ -13,7 +13,7 @@ global:
|
||||
## ref: https://hub.docker.com/r/bitnami/redis/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/redis
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
@@ -132,9 +132,9 @@ sentinel:
|
||||
##
|
||||
annotations: {}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
|
||||
## Specifies the Kubernetes Cluster's Domain Name.
|
||||
@@ -291,10 +291,9 @@ master:
|
||||
## Redis Master additional pod labels and annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: {{ sanitized_name }}
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
|
||||
## Redis Master resource requests and limits
|
||||
@@ -388,9 +387,9 @@ master:
|
||||
external-dns.alpha.kubernetes.io/ttl: "300"
|
||||
{% endif %}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
# loadBalancerSourceRanges: ["10.0.0.0/8"]
|
||||
|
||||
@@ -425,9 +424,9 @@ master:
|
||||
## https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||
statefulset:
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
updateStrategy: RollingUpdate
|
||||
## Partition update strategy
|
||||
## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -29,6 +30,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -7,6 +7,7 @@ metadata:
|
||||
labels:
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
appLongId: {{ long_id }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}-default
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
@@ -26,6 +27,7 @@ metadata:
|
||||
name: {{ sanitized_name }}-app-access
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
@@ -76,6 +78,7 @@ metadata:
|
||||
name: {{ sanitized_name }}-deny-aws-metadata-server
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -9,6 +9,7 @@ metadata:
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
envId: {{ environment_id }}
|
||||
appLongId: {{ long_id }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
|
||||
@@ -9,6 +9,7 @@ metadata:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
appLongId: {{ long_id }}
|
||||
app: {{ sanitized_name }}
|
||||
annotations:
|
||||
releaseTime: {% raw %}{{ dateInZone "2006-01-02 15:04:05Z" (now) "UTC"| quote }}{% endraw %}
|
||||
@@ -27,6 +28,7 @@ spec:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
appLongId: {{ long_id }}
|
||||
app: {{ sanitized_name }}
|
||||
annotations:
|
||||
checksum/config: {% raw %}{{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{% endraw %}
|
||||
@@ -91,27 +93,6 @@ spec:
|
||||
{%- endfor %}
|
||||
volumeClaimTemplates:
|
||||
{%- for s in storage %}
|
||||
{% if clone %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
diskId: {{ s.id }}
|
||||
diskType: {{ s.storage_type }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: aws-ebs-{{ s.storage_type }}-0
|
||||
dataSource:
|
||||
name: {{ s.id }}
|
||||
kind: PersistentVolumeClaim
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ disk.size_in_gib }}Gi
|
||||
{% else %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
@@ -127,6 +108,5 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ s.size_in_gib }}Gi
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
name: {{ id }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerLongId: {{ long_id }}
|
||||
spec:
|
||||
acme:
|
||||
server: {{ spec_acme_server }}
|
||||
|
||||
@@ -6,9 +6,8 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerName: {{ sanitized_name }}
|
||||
routerId: {{ id }}
|
||||
routerLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
fqdn: "{{ router_default_domain }}"
|
||||
annotations:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: qovery-cluster-agent
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: 0.1.0
|
||||
@@ -0,0 +1,54 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- printf "%s" $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.labels" -}}
|
||||
helm.sh/chart: {{ include "qovery-cluster-agent.chart" . }}
|
||||
{{ include "qovery-cluster-agent.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "qovery-cluster-agent.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "qovery-cluster-agent.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "qovery-cluster-agent.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if and .Values.rbac.create .Values.rbac.clusterRole }}
|
||||
apiVersion: rbac.authorization.k8s.io/{{ .Values.rbac.apiVersion }}
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "qovery-cluster-agent.fullname" . }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- pods/log
|
||||
- namespace
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if and .Values.rbac.create .Values.rbac.clusterRole }}
|
||||
apiVersion: rbac.authorization.k8s.io/{{ .Values.rbac.apiVersion }}
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "qovery-cluster-agent.fullname" . }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "qovery-cluster-agent.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "qovery-cluster-agent.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,67 @@
|
||||
{{- $kubefullname := include "qovery-cluster-agent.fullname" . }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "qovery-cluster-agent.fullname" . }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "qovery-cluster-agent.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "qovery-cluster-agent.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
env:
|
||||
{{ range $key, $value := .Values.environmentVariables -}}
|
||||
- name: "{{ $key }}"
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $kubefullname }}
|
||||
key: {{ $key }}
|
||||
{{ end }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "qovery-cluster-agent.fullname" . }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- toYaml .Values.environmentVariables | nindent 2 }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "qovery-cluster-agent.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "qovery-cluster-agent.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,80 @@
|
||||
# Default values for qovery-agent.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: qoveryrd/cluster-agent
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
namespace: "qovery"
|
||||
|
||||
labels:
|
||||
app: qovery-cluster-agent
|
||||
|
||||
environmentVariables: {}
|
||||
#CLOUD_PROVIDER: ""
|
||||
#CLOUD_REGION: ""
|
||||
#AGENT_ID: ""
|
||||
#ES_HOST_URL: ""
|
||||
#NATS_HOST_URL: ""
|
||||
#RUST_LOG: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
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: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
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
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
rbac:
|
||||
create: true
|
||||
clusterRole: true
|
||||
apiVersion: v1
|
||||
@@ -1,7 +1,7 @@
|
||||
locals {
|
||||
tags_ks = {
|
||||
ClusterId = var.kubernetes_full_cluster_id
|
||||
ClusterName = var.kubernetes_cluster_name
|
||||
ClusterId = var.kubernetes_cluster_id
|
||||
ClusterLongId = var.kubernetes_full_cluster_id
|
||||
OrganizationId = var.organization_id,
|
||||
Region = var.region
|
||||
creationDate = time_static.on_cluster_create.rfc3339
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
image:
|
||||
## Bitnami MongoDB registry
|
||||
##
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
## Bitnami MongoDB image name
|
||||
##
|
||||
repository: bitnami/mongodb
|
||||
@@ -210,19 +210,18 @@ annotations: {}
|
||||
|
||||
# Additional abels to apply to the deployment or statefulsets
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
# Annotations to be added to MongoDB pods
|
||||
podAnnotations: {}
|
||||
|
||||
# Additional pod labels to apply
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
##
|
||||
image:
|
||||
debug: false
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
tag: "{{ version }}"
|
||||
|
||||
@@ -44,10 +44,9 @@ fullnameOverride: '{{ sanitized_name }}'
|
||||
clusterDomain: cluster.local
|
||||
|
||||
commonLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
|
||||
|
||||
@@ -13,7 +13,7 @@ global:
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: "{{ version }}"
|
||||
## Specify a imagePullPolicy
|
||||
@@ -351,14 +351,14 @@ master:
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
annotations: {}
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ""
|
||||
## Extra init containers
|
||||
|
||||
@@ -13,7 +13,7 @@ global:
|
||||
## ref: https://hub.docker.com/r/bitnami/redis/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/redis
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
@@ -132,9 +132,9 @@ sentinel:
|
||||
##
|
||||
annotations: {}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
|
||||
## Specifies the Kubernetes Cluster's Domain Name.
|
||||
@@ -291,10 +291,9 @@ master:
|
||||
## Redis Master additional pod labels and annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
|
||||
## Redis Master resource requests and limits
|
||||
@@ -391,9 +390,9 @@ master:
|
||||
external-dns.alpha.kubernetes.io/ttl: "300"
|
||||
{% endif %}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
# loadBalancerSourceRanges: ["10.0.0.0/8"]
|
||||
|
||||
@@ -428,9 +427,9 @@ master:
|
||||
## https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||
statefulset:
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
updateStrategy: RollingUpdate
|
||||
## Partition update strategy
|
||||
## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -29,6 +30,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
spec:
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -24,6 +25,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -91,27 +93,6 @@ spec:
|
||||
{%- endfor %}
|
||||
volumeClaimTemplates:
|
||||
{%- for s in storage %}
|
||||
{% if clone %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
diskId: {{ s.id }}
|
||||
diskType: {{ s.storage_type }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: {{ s.storage_type }}
|
||||
dataSource:
|
||||
name: {{ s.id }}
|
||||
kind: PersistentVolumeClaim
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ disk.size_in_gib }}Gi
|
||||
{% else %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
@@ -127,6 +108,5 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ s.size_in_gib }}Gi
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
name: {{ id }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerLongId: {{ long_id }}
|
||||
spec:
|
||||
acme:
|
||||
server: {{ spec_acme_server }}
|
||||
|
||||
@@ -6,9 +6,8 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerName: {{ sanitized_name }}
|
||||
routerId: {{ id }}
|
||||
routerLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
fqdn: "{{ router_default_domain }}"
|
||||
annotations:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
locals {
|
||||
tags_ks = {
|
||||
ClusterId = var.kubernetes_full_cluster_id
|
||||
ClusterName = var.kubernetes_cluster_name
|
||||
ClusterId = var.kubernetes_cluster_id
|
||||
ClusterLongId = var.kubernetes_full_cluster_id
|
||||
OrganizationId = var.organization_id,
|
||||
Region = var.region
|
||||
creationDate = time_static.on_cluster_create.rfc3339
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
image:
|
||||
## Bitnami MongoDB registry
|
||||
##
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
## Bitnami MongoDB image name
|
||||
##
|
||||
repository: bitnami/mongodb
|
||||
@@ -145,17 +145,16 @@ replicaSet:
|
||||
|
||||
# Additional abels to apply to the deployment or statefulsets
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
|
||||
# Additional pod labels to apply
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## updateStrategy for MongoDB Primary, Secondary and Arbitrer statefulsets
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
##
|
||||
image:
|
||||
debug: false
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
tag: "{{ version }}"
|
||||
|
||||
@@ -44,10 +44,9 @@ fullnameOverride: '{{ sanitized_name }}'
|
||||
clusterDomain: cluster.local
|
||||
|
||||
commonLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: "{{ version }}"
|
||||
## Specify a imagePullPolicy
|
||||
@@ -187,14 +187,14 @@ master:
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
annotations: {}
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ""
|
||||
## Extra init containers
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
## ref: https://hub.docker.com/r/bitnami/redis/tags/
|
||||
##
|
||||
image:
|
||||
registry: quay.io
|
||||
registry: docker.io
|
||||
repository: bitnami/redis
|
||||
## Bitnami Redis image tag
|
||||
## ref: https://github.com/bitnami/bitnami-docker-redis#supported-tags-and-respective-dockerfile-links
|
||||
@@ -121,9 +121,9 @@ sentinel:
|
||||
##
|
||||
annotations: {}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
|
||||
networkPolicy:
|
||||
@@ -248,10 +248,9 @@ master:
|
||||
## Redis Master additional pod labels and annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||
podLabels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseName: '{{ sanitized_name }}'
|
||||
databaseLongId: {{ long_id }}
|
||||
podAnnotations: {}
|
||||
|
||||
## Redis Master resource requests and limits
|
||||
@@ -350,9 +349,9 @@ master:
|
||||
external-dns.alpha.kubernetes.io/ttl: "300"
|
||||
{% endif %}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
loadBalancerIP:
|
||||
# loadBalancerSourceRanges: ["10.0.0.0/8"]
|
||||
|
||||
@@ -387,9 +386,9 @@ master:
|
||||
## https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
|
||||
statefulset:
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
databaseId: {{ id }}
|
||||
databaseLongId: {{ long_id }}
|
||||
updateStrategy: RollingUpdate
|
||||
## Partition update strategy
|
||||
## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -28,6 +29,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
spec:
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}-default
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
@@ -26,6 +27,7 @@ metadata:
|
||||
name: {{ sanitized_name }}-app-access
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -23,6 +24,7 @@ metadata:
|
||||
name: {{ registry_secret_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
|
||||
@@ -5,6 +5,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
|
||||
@@ -6,6 +6,7 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -24,6 +25,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
appLongId: {{ long_id }}
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
@@ -91,27 +93,6 @@ spec:
|
||||
{%- endfor %}
|
||||
volumeClaimTemplates:
|
||||
{%- for s in storage %}
|
||||
{% if clone %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
envId: {{ environment_id }}
|
||||
appId: {{ id }}
|
||||
app: {{ sanitized_name }}
|
||||
diskId: {{ s.id }}
|
||||
diskType: {{ s.storage_type }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: {{ s.storage_type }}
|
||||
dataSource:
|
||||
name: {{ s.id }}
|
||||
kind: PersistentVolumeClaim
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ disk.size_in_gib }}Gi
|
||||
{% else %}
|
||||
- metadata:
|
||||
name: {{ s.id }}
|
||||
labels:
|
||||
@@ -127,6 +108,5 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ s.size_in_gib }}Gi
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
name: {{ id }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerLongId: {{ long_id }}
|
||||
spec:
|
||||
acme:
|
||||
server: {{ spec_acme_server }}
|
||||
|
||||
@@ -6,9 +6,8 @@ metadata:
|
||||
name: {{ sanitized_name }}
|
||||
namespace: {{ namespace }}
|
||||
labels:
|
||||
ownerId: {{ owner_id }}
|
||||
routerName: {{ sanitized_name }}
|
||||
routerId: {{ id }}
|
||||
routerLongId: {{ long_id }}
|
||||
envId: {{ environment_id }}
|
||||
fqdn: "{{ router_default_domain }}"
|
||||
annotations:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::cloud_provider::aws::kubernetes::{Options, VpcQoveryNetworkMode};
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo, ChartPayload, ChartSetValue,
|
||||
ChartValuesGenerated, CommonChart, CoreDNSConfigChart, HelmChart, HelmChartNamespaces,
|
||||
PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
get_chart_for_cluster_agent, get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo,
|
||||
ChartPayload, ChartSetValue, ChartValuesGenerated, ClusterAgentContext, CommonChart, CoreDNSConfigChart, HelmChart,
|
||||
HelmChartNamespaces, PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cmd::kubectl::{kubectl_delete_crash_looping_pods, kubectl_exec_get_daemonset, kubectl_exec_with_output};
|
||||
@@ -972,6 +972,17 @@ datasources:
|
||||
// },
|
||||
// };
|
||||
|
||||
let cluster_agent_context = ClusterAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
organization_long_id: &chart_config_prerequisites.organization_long_id,
|
||||
cluster_id: &chart_config_prerequisites.cluster_id,
|
||||
cluster_long_id: &chart_config_prerequisites.cluster_long_id,
|
||||
cluster_token: &chart_config_prerequisites.infra_options.qovery_cluster_secret_token,
|
||||
grpc_url: &chart_config_prerequisites.infra_options.qovery_grpc_url,
|
||||
};
|
||||
let cluster_agent = get_chart_for_cluster_agent(cluster_agent_context, chart_path)?;
|
||||
|
||||
let shell_context = ShellAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
@@ -1189,7 +1200,8 @@ datasources:
|
||||
|
||||
let mut level_7: Vec<Box<dyn HelmChart>> = vec![
|
||||
Box::new(cert_manager_config),
|
||||
Box::new(qovery_agent),
|
||||
Box::new(qovery_agent), // TODO: Migrate to the new cluster agent
|
||||
Box::new(cluster_agent),
|
||||
Box::new(shell_agent),
|
||||
Box::new(qovery_engine),
|
||||
];
|
||||
|
||||
@@ -498,7 +498,7 @@ impl EKS {
|
||||
context.insert("eks_cidr_subnet", &eks_cidr_subnet);
|
||||
context.insert("kubernetes_cluster_name", &self.name());
|
||||
context.insert("kubernetes_cluster_id", self.id());
|
||||
context.insert("kubernetes_full_cluster_id", self.context.cluster_id());
|
||||
context.insert("kubernetes_full_cluster_id", &self.long_id);
|
||||
context.insert("eks_region_cluster_id", region_cluster_id.as_str());
|
||||
context.insert("eks_worker_nodes", &self.nodes_groups);
|
||||
context.insert("eks_zone_a_subnet_blocks_private", &eks_zone_a_subnet_blocks_private);
|
||||
@@ -1159,13 +1159,10 @@ impl EKS {
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("Chart `{}` deleted", chart.name)),
|
||||
)),
|
||||
Err(e) => {
|
||||
let message_safe = format!("Can't delete chart `{}`: {}", &chart.name, e);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(format!("Can't delete chart `{}`", &chart.name), Some(e.to_string())),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1211,23 +1208,20 @@ impl EKS {
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("Chart `{}` deleted", chart.name)),
|
||||
)),
|
||||
Err(e) => {
|
||||
let message_safe = format!("Error deleting chart `{}`: {}", chart.name, e);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(
|
||||
format!("Error deleting chart `{}`", chart.name),
|
||||
Some(e.to_string()),
|
||||
),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let message_safe = "Unable to get helm list";
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe.to_string(), Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new("Unable to get helm list".to_string(), Some(e.to_string())),
|
||||
)),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::cloud_provider::digitalocean::kubernetes::DoksOptions;
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo, ChartSetValue, ChartValuesGenerated,
|
||||
CommonChart, CoreDNSConfigChart, HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
get_chart_for_cluster_agent, get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo,
|
||||
ChartSetValue, ChartValuesGenerated, ClusterAgentContext, CommonChart, CoreDNSConfigChart, HelmChart,
|
||||
HelmChartNamespaces, PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::errors::CommandError;
|
||||
@@ -793,6 +794,17 @@ datasources:
|
||||
},
|
||||
};
|
||||
|
||||
let cluster_agent_context = ClusterAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
organization_long_id: &chart_config_prerequisites.organization_long_id,
|
||||
cluster_id: &chart_config_prerequisites.cluster_id,
|
||||
cluster_long_id: &chart_config_prerequisites.cluster_long_id,
|
||||
cluster_token: &chart_config_prerequisites.infra_options.qovery_cluster_secret_token,
|
||||
grpc_url: &chart_config_prerequisites.infra_options.qovery_grpc_url,
|
||||
};
|
||||
let cluster_agent = get_chart_for_cluster_agent(cluster_agent_context, chart_path)?;
|
||||
|
||||
let shell_context = ShellAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
@@ -1038,6 +1050,7 @@ datasources:
|
||||
let mut level_6: Vec<Box<dyn HelmChart>> = vec![
|
||||
Box::new(cert_manager_config),
|
||||
Box::new(qovery_agent),
|
||||
Box::new(cluster_agent),
|
||||
Box::new(shell_agent),
|
||||
Box::new(qovery_engine),
|
||||
Box::new(digital_mobius),
|
||||
|
||||
@@ -463,7 +463,7 @@ impl DOKS {
|
||||
));
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Preparing DOKS cluster deployment.".to_string()),
|
||||
EventMessage::new_from_safe("Preparing cluster deployment.".to_string()),
|
||||
));
|
||||
|
||||
// upgrade cluster instead if required
|
||||
@@ -533,7 +533,7 @@ impl DOKS {
|
||||
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Deploying DOKS cluster.".to_string()),
|
||||
EventMessage::new_from_safe("Deploying cluster.".to_string()),
|
||||
));
|
||||
self.send_to_customer(
|
||||
format!("Deploying DOKS {} cluster deployment with id {}", self.name(), self.id()).as_str(),
|
||||
@@ -550,7 +550,7 @@ impl DOKS {
|
||||
match terraform_exec(temp_dir.as_str(), vec!["state", "rm", &entry]) {
|
||||
Ok(_) => self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("successfully removed {}", &entry)),
|
||||
EventMessage::new_from_safe(format!("Successfully removed {}", &entry)),
|
||||
)),
|
||||
Err(e) => {
|
||||
return Err(EngineError::new_terraform_cannot_remove_entry_out(
|
||||
@@ -802,7 +802,7 @@ impl DOKS {
|
||||
);
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Preparing to delete DOKS cluster.".to_string()),
|
||||
EventMessage::new_from_safe("Preparing to delete cluster.".to_string()),
|
||||
));
|
||||
|
||||
let temp_dir = match self.get_temp_dir(event_details.clone()) {
|
||||
@@ -923,13 +923,12 @@ impl DOKS {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let message_safe = format!(
|
||||
"Error while getting all namespaces for Kubernetes cluster {}",
|
||||
self.name_with_id(),
|
||||
);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.message(ErrorMessageVerbosity::FullDetails))),
|
||||
EventMessage::new(
|
||||
"Error while getting all namespaces for Kubernetes cluster".to_string(),
|
||||
Some(e.message(ErrorMessageVerbosity::FullDetailsWithoutEnvVars)),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -976,13 +975,10 @@ impl DOKS {
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("Chart `{}` deleted", chart.name)),
|
||||
)),
|
||||
Err(e) => {
|
||||
let message_safe = format!("Can't delete chart `{}`", chart.name);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(format!("Can't delete chart `{}`", chart.name), Some(e.to_string())),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1028,23 +1024,20 @@ impl DOKS {
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("Chart `{}` deleted", chart.name)),
|
||||
)),
|
||||
Err(e) => {
|
||||
let message_safe = format!("Error deleting chart `{}`", chart.name);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(
|
||||
format!("Error deleting chart `{}`", chart.name),
|
||||
Some(e.to_string()),
|
||||
),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let message_safe = "Unable to get helm list";
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe.to_string(), Some(e.to_string())),
|
||||
))
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new("Unable to get helm list".to_string(), Some(e.to_string())),
|
||||
)),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1175,8 +1168,8 @@ impl Kubernetes for DOKS {
|
||||
self.logger().log(EngineEvent::Debug(
|
||||
self.get_event_details(stage),
|
||||
EventMessage::new(
|
||||
err.to_string(),
|
||||
Some(format!("Error, couldn't open {} file", &local_kubeconfig_generated,)),
|
||||
format!("Error, couldn't open {} file", &local_kubeconfig_generated),
|
||||
Some(err.to_string()),
|
||||
),
|
||||
));
|
||||
None
|
||||
@@ -1330,7 +1323,7 @@ impl Kubernetes for DOKS {
|
||||
);
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Start preparing DOKS cluster upgrade process".to_string()),
|
||||
EventMessage::new_from_safe("Start preparing cluster upgrade process".to_string()),
|
||||
));
|
||||
|
||||
let temp_dir = self.get_temp_dir(event_details.clone())?;
|
||||
|
||||
@@ -735,6 +735,90 @@ pub fn get_chart_for_shell_agent(
|
||||
Ok(shell_agent)
|
||||
}
|
||||
|
||||
pub struct ClusterAgentContext<'a> {
|
||||
pub api_url: &'a str,
|
||||
pub api_token: &'a str,
|
||||
pub organization_long_id: &'a Uuid,
|
||||
pub cluster_id: &'a str,
|
||||
pub cluster_long_id: &'a Uuid,
|
||||
pub cluster_token: &'a str,
|
||||
pub grpc_url: &'a str,
|
||||
}
|
||||
|
||||
// This one is the new agent in rust
|
||||
pub fn get_chart_for_cluster_agent(
|
||||
context: ClusterAgentContext,
|
||||
chart_path: impl Fn(&str) -> String,
|
||||
) -> Result<CommonChart, CommandError> {
|
||||
let shell_agent_version: QoveryShellAgent = get_qovery_app_version(
|
||||
QoveryAppName::ClusterAgent,
|
||||
context.api_token,
|
||||
context.api_url,
|
||||
context.cluster_id,
|
||||
)?;
|
||||
let cluster_agent = CommonChart {
|
||||
chart_info: ChartInfo {
|
||||
name: "cluster-agent".to_string(),
|
||||
path: chart_path("common/charts/qovery/qovery-cluster-agent"),
|
||||
namespace: HelmChartNamespaces::Qovery,
|
||||
values: vec![
|
||||
ChartSetValue {
|
||||
key: "image.tag".to_string(),
|
||||
value: shell_agent_version.version,
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "replicaCount".to_string(),
|
||||
value: "1".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.RUST_BACKTRACE".to_string(),
|
||||
value: "full".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.RUST_LOG".to_string(),
|
||||
value: "DEBUG".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.GRPC_SERVER".to_string(),
|
||||
value: context.grpc_url.to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.CLUSTER_TOKEN".to_string(),
|
||||
value: context.cluster_token.to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.CLUSTER_ID".to_string(),
|
||||
value: context.cluster_long_id.to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "environmentVariables.ORGANIZATION_ID".to_string(),
|
||||
value: context.organization_long_id.to_string(),
|
||||
},
|
||||
// resources limits
|
||||
ChartSetValue {
|
||||
key: "resources.requests.cpu".to_string(),
|
||||
value: "200m".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "resources.limits.cpu".to_string(),
|
||||
value: "1".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "resources.requests.memory".to_string(),
|
||||
value: "100Mi".to_string(),
|
||||
},
|
||||
ChartSetValue {
|
||||
key: "resources.limits.memory".to_string(),
|
||||
value: "500Mi".to_string(),
|
||||
},
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
|
||||
Ok(cluster_agent)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::cloud_provider::helm::get_latest_successful_deployment;
|
||||
|
||||
@@ -34,6 +34,7 @@ pub enum QoveryAppName {
|
||||
Agent,
|
||||
Engine,
|
||||
ShellAgent,
|
||||
ClusterAgent,
|
||||
}
|
||||
|
||||
pub fn get_qovery_app_version<T: DeserializeOwned>(
|
||||
@@ -50,6 +51,7 @@ pub fn get_qovery_app_version<T: DeserializeOwned>(
|
||||
QoveryAppName::Agent => "agent",
|
||||
QoveryAppName::Engine => "engine",
|
||||
QoveryAppName::ShellAgent => "shellAgent",
|
||||
QoveryAppName::ClusterAgent => "clusterAgent",
|
||||
};
|
||||
|
||||
let url = format!(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo, ChartSetValue, ChartValuesGenerated,
|
||||
CommonChart, CoreDNSConfigChart, HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
get_chart_for_cluster_agent, get_chart_for_shell_agent, get_engine_helm_action_from_location, ChartInfo,
|
||||
ChartSetValue, ChartValuesGenerated, ClusterAgentContext, CommonChart, CoreDNSConfigChart, HelmChart,
|
||||
HelmChartNamespaces, PrometheusOperatorConfigChart, ShellAgentContext,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cloud_provider::scaleway::kubernetes::KapsuleOptions;
|
||||
@@ -666,6 +667,17 @@ datasources:
|
||||
},
|
||||
};
|
||||
|
||||
let cluster_agent_context = ClusterAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
organization_long_id: &chart_config_prerequisites.organization_long_id,
|
||||
cluster_id: &chart_config_prerequisites.cluster_id,
|
||||
cluster_long_id: &chart_config_prerequisites.cluster_long_id,
|
||||
cluster_token: &chart_config_prerequisites.infra_options.qovery_cluster_secret_token,
|
||||
grpc_url: &chart_config_prerequisites.infra_options.qovery_grpc_url,
|
||||
};
|
||||
let cluster_agent = get_chart_for_cluster_agent(cluster_agent_context, chart_path)?;
|
||||
|
||||
let shell_context = ShellAgentContext {
|
||||
api_url: &chart_config_prerequisites.infra_options.qovery_api_url,
|
||||
api_token: &chart_config_prerequisites.infra_options.agent_version_controller_token,
|
||||
@@ -869,7 +881,8 @@ datasources:
|
||||
|
||||
let mut level_7: Vec<Box<dyn HelmChart>> = vec![
|
||||
Box::new(cert_manager_config),
|
||||
Box::new(qovery_agent),
|
||||
Box::new(cluster_agent),
|
||||
Box::new(qovery_agent), // Old agent, this one should be removed/migrated
|
||||
Box::new(shell_agent),
|
||||
Box::new(qovery_engine),
|
||||
];
|
||||
|
||||
@@ -468,7 +468,7 @@ impl Kapsule {
|
||||
|
||||
// Kubernetes
|
||||
context.insert("test_cluster", &self.context.is_test_cluster());
|
||||
context.insert("kubernetes_full_cluster_id", self.context().cluster_id());
|
||||
context.insert("kubernetes_full_cluster_id", &self.long_id);
|
||||
context.insert("kubernetes_cluster_id", self.id());
|
||||
context.insert("kubernetes_cluster_name", self.cluster_name().as_str());
|
||||
context.insert("kubernetes_cluster_version", self.version());
|
||||
@@ -674,7 +674,7 @@ impl Kapsule {
|
||||
match terraform_exec(temp_dir.as_str(), vec!["state", "rm", &entry]) {
|
||||
Ok(_) => self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(format!("successfully removed {}", &entry)),
|
||||
EventMessage::new_from_safe(format!("Successfully removed {}", &entry)),
|
||||
)),
|
||||
Err(e) => {
|
||||
return Err(EngineError::new_terraform_cannot_remove_entry_out(
|
||||
@@ -909,7 +909,7 @@ impl Kapsule {
|
||||
self.logger.log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe(
|
||||
"all node groups for this cluster are ready from cloud provider API".to_string(),
|
||||
"All node groups for this cluster are ready from cloud provider API".to_string(),
|
||||
),
|
||||
));
|
||||
|
||||
@@ -1005,7 +1005,7 @@ impl Kapsule {
|
||||
event_details,
|
||||
EventMessage::new(
|
||||
"Error trying to get kubernetes events".to_string(),
|
||||
Some(err.message(ErrorMessageVerbosity::FullDetails)),
|
||||
Some(err.message(ErrorMessageVerbosity::FullDetailsWithoutEnvVars)),
|
||||
),
|
||||
)),
|
||||
};
|
||||
@@ -1046,7 +1046,7 @@ impl Kapsule {
|
||||
|
||||
self.logger().log(EngineEvent::Info(
|
||||
self.get_event_details(Stage::Infrastructure(InfrastructureStep::Pause)),
|
||||
EventMessage::new_from_safe("Preparing SCW cluster pause.".to_string()),
|
||||
EventMessage::new_from_safe("Preparing cluster pause.".to_string()),
|
||||
));
|
||||
|
||||
let temp_dir = self.get_temp_dir(event_details.clone())?;
|
||||
@@ -1177,7 +1177,7 @@ impl Kapsule {
|
||||
);
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Pausing SCW cluster deployment.".to_string()),
|
||||
EventMessage::new_from_safe("Pausing cluster deployment.".to_string()),
|
||||
));
|
||||
|
||||
match terraform_exec(temp_dir.as_str(), terraform_args) {
|
||||
@@ -1212,7 +1212,7 @@ impl Kapsule {
|
||||
);
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Preparing to delete SCW cluster.".to_string()),
|
||||
EventMessage::new_from_safe("Preparing to delete cluster.".to_string()),
|
||||
));
|
||||
|
||||
let temp_dir = self.get_temp_dir(event_details.clone())?;
|
||||
@@ -1335,7 +1335,10 @@ impl Kapsule {
|
||||
);
|
||||
self.logger().log(EngineEvent::Warning(
|
||||
event_details.clone(),
|
||||
EventMessage::new(message_safe, Some(e.message(ErrorMessageVerbosity::FullDetails))),
|
||||
EventMessage::new(
|
||||
message_safe,
|
||||
Some(e.message(ErrorMessageVerbosity::FullDetailsWithoutEnvVars)),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1605,7 +1608,7 @@ impl Kubernetes for Kapsule {
|
||||
);
|
||||
self.logger().log(EngineEvent::Info(
|
||||
event_details.clone(),
|
||||
EventMessage::new_from_safe("Start preparing SCW cluster upgrade process".to_string()),
|
||||
EventMessage::new_from_safe("Start preparing cluster upgrade process".to_string()),
|
||||
));
|
||||
|
||||
let temp_dir = self.get_temp_dir(event_details.clone())?;
|
||||
|
||||
@@ -6,6 +6,7 @@ use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use tera::Context as TeraContext;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::cloud_provider::environment::Environment;
|
||||
use crate::cloud_provider::helm::ChartInfo;
|
||||
@@ -31,6 +32,7 @@ pub trait Service: ToTransmitter {
|
||||
fn context(&self) -> &Context;
|
||||
fn service_type(&self) -> ServiceType;
|
||||
fn id(&self) -> &str;
|
||||
fn long_id(&self) -> &Uuid;
|
||||
fn name(&self) -> &str;
|
||||
fn sanitized_name(&self) -> String;
|
||||
fn name_with_id(&self) -> String {
|
||||
@@ -328,6 +330,7 @@ pub fn default_tera_context(
|
||||
) -> TeraContext {
|
||||
let mut context = TeraContext::new();
|
||||
context.insert("id", service.id());
|
||||
context.insert("long_id", service.long_id());
|
||||
context.insert("owner_id", environment.owner_id.as_str());
|
||||
context.insert("project_id", environment.project_id.as_str());
|
||||
context.insert("organization_id", environment.organization_id.as_str());
|
||||
|
||||
@@ -896,7 +896,7 @@ mod tests {
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"image": "quay.io/bitnami/postgresql:10.16.0",
|
||||
"image": "docker.io/bitnami/postgresql:10.16.0",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"livenessProbe": {
|
||||
"exec": {
|
||||
@@ -1129,7 +1129,7 @@ mod tests {
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"image": "quay.io/bitnami/postgresql:10.16.0",
|
||||
"image": "docker.io/bitnami/postgresql:10.16.0",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"livenessProbe": {
|
||||
"exec": {
|
||||
|
||||
@@ -12,6 +12,7 @@ use rand::distributions::Alphanumeric;
|
||||
use rand::Rng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::build_platform::{Build, Credentials, GitRepository, Image, SshKey};
|
||||
use crate::cloud_provider::environment::Environment;
|
||||
@@ -29,6 +30,7 @@ use crate::models::digital_ocean::{DoAppExtraSettings, DoRouterExtraSettings, Do
|
||||
use crate::models::router::RouterError;
|
||||
use crate::models::scaleway::{ScwAppExtraSettings, ScwRouterExtraSettings, ScwStorageType};
|
||||
use crate::models::types::{CloudProvider as CP, VersionsNumber, AWS, DO, SCW};
|
||||
use crate::utilities::to_short_id;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct QoveryIdentifier {
|
||||
@@ -201,7 +203,7 @@ impl Default for ApplicationAdvanceSettings {
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct Application {
|
||||
pub id: String,
|
||||
pub long_id: Uuid,
|
||||
pub name: String,
|
||||
pub action: Action,
|
||||
pub git_url: String,
|
||||
@@ -240,7 +242,7 @@ impl Application {
|
||||
match cloud_provider.kind() {
|
||||
CPKind::Aws => Ok(Box::new(models::application::Application::<AWS>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
self.ports.clone(),
|
||||
@@ -259,7 +261,7 @@ impl Application {
|
||||
)?)),
|
||||
CPKind::Do => Ok(Box::new(models::application::Application::<DO>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
self.ports.clone(),
|
||||
@@ -278,7 +280,7 @@ impl Application {
|
||||
)?)),
|
||||
CPKind::Scw => Ok(Box::new(models::application::Application::<SCW>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
self.ports.clone(),
|
||||
@@ -300,7 +302,7 @@ impl Application {
|
||||
|
||||
fn to_image(&self, cr_info: &ContainerRegistryInfo) -> Image {
|
||||
Image {
|
||||
application_id: self.id.clone(),
|
||||
application_id: to_short_id(&self.long_id),
|
||||
name: (cr_info.get_image_name)(&self.name),
|
||||
tag: "".to_string(), // It needs to be compute after creation
|
||||
commit_id: self.commit_id.clone(),
|
||||
@@ -439,6 +441,7 @@ pub struct GitCredentials {
|
||||
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct Storage {
|
||||
pub id: String,
|
||||
pub long_id: Uuid,
|
||||
pub name: String,
|
||||
pub storage_type: StorageType,
|
||||
pub size_in_gib: u16,
|
||||
@@ -497,7 +500,7 @@ impl Storage {
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
|
||||
pub struct Router {
|
||||
pub id: String,
|
||||
pub long_id: Uuid,
|
||||
pub name: String,
|
||||
pub action: Action,
|
||||
pub default_domain: String,
|
||||
@@ -541,7 +544,7 @@ impl Router {
|
||||
CPKind::Aws => {
|
||||
let router = Box::new(models::router::Router::<AWS>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.name.as_str(),
|
||||
self.action.to_service_action(),
|
||||
self.default_domain.as_str(),
|
||||
@@ -557,7 +560,7 @@ impl Router {
|
||||
CPKind::Do => {
|
||||
let router = Box::new(models::router::Router::<DO>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.name.as_str(),
|
||||
self.action.to_service_action(),
|
||||
self.default_domain.as_str(),
|
||||
@@ -573,7 +576,7 @@ impl Router {
|
||||
CPKind::Scw => {
|
||||
let router = Box::new(models::router::Router::<SCW>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.name.as_str(),
|
||||
self.action.to_service_action(),
|
||||
self.default_domain.as_str(),
|
||||
@@ -612,7 +615,7 @@ pub enum DatabaseMode {
|
||||
pub struct Database {
|
||||
pub kind: DatabaseKind,
|
||||
pub action: Action,
|
||||
pub id: String,
|
||||
pub long_id: Uuid,
|
||||
pub name: String,
|
||||
pub version: String,
|
||||
pub fqdn_id: String,
|
||||
@@ -663,7 +666,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Postgresql, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<AWS, Managed, PostgresSQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -684,7 +687,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Postgresql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<AWS, Container, PostgresSQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -706,7 +709,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Mysql, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<AWS, Managed, MySQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -727,7 +730,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Mysql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<AWS, Container, MySQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -748,7 +751,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Redis, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<AWS, Managed, Redis>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -769,7 +772,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Redis, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<AWS, Container, Redis>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -790,7 +793,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Mongodb, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<AWS, Managed, MongoDB>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -811,7 +814,7 @@ impl Database {
|
||||
(CPKind::Aws, DatabaseKind::Mongodb, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<AWS, Container, MongoDB>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -833,7 +836,7 @@ impl Database {
|
||||
(CPKind::Do, DatabaseKind::Postgresql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<DO, Container, PostgresSQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -854,7 +857,7 @@ impl Database {
|
||||
(CPKind::Do, DatabaseKind::Mysql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<DO, Container, MySQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -875,7 +878,7 @@ impl Database {
|
||||
(CPKind::Do, DatabaseKind::Redis, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<DO, Container, Redis>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -896,7 +899,7 @@ impl Database {
|
||||
(CPKind::Do, DatabaseKind::Mongodb, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<DO, Container, MongoDB>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -933,7 +936,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Postgresql, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<SCW, Managed, PostgresSQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -954,7 +957,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Postgresql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<SCW, Container, PostgresSQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -975,7 +978,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Mysql, DatabaseMode::MANAGED) => {
|
||||
let db = models::database::Database::<SCW, Managed, MySQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -996,7 +999,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Mysql, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<SCW, Container, MySQL>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -1017,7 +1020,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Redis, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<SCW, Container, Redis>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
@@ -1038,7 +1041,7 @@ impl Database {
|
||||
(CPKind::Scw, DatabaseKind::Mongodb, DatabaseMode::CONTAINER) => {
|
||||
let db = models::database::Database::<SCW, Container, MongoDB>::new(
|
||||
context.clone(),
|
||||
self.id.as_str(),
|
||||
self.long_id,
|
||||
self.action.to_service_action(),
|
||||
self.name.as_str(),
|
||||
version,
|
||||
|
||||
@@ -15,9 +15,11 @@ use crate::events::{EnvironmentStep, EventDetails, Stage, ToTransmitter, Transmi
|
||||
use crate::io_models::{ApplicationAdvanceSettings, Context, Listen, Listener, Listeners, Port, QoveryIdentifier};
|
||||
use crate::logger::Logger;
|
||||
use crate::models::types::{CloudProvider, ToTeraContext};
|
||||
use crate::utilities::to_short_id;
|
||||
use function_name::named;
|
||||
use std::marker::PhantomData;
|
||||
use tera::Context as TeraContext;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum ApplicationError {
|
||||
@@ -29,6 +31,7 @@ pub struct Application<T: CloudProvider> {
|
||||
_marker: PhantomData<T>,
|
||||
pub(super) context: Context,
|
||||
pub(super) id: String,
|
||||
pub(super) long_id: Uuid,
|
||||
pub(super) action: Action,
|
||||
pub(super) name: String,
|
||||
pub(super) ports: Vec<Port>,
|
||||
@@ -50,7 +53,7 @@ pub struct Application<T: CloudProvider> {
|
||||
impl<T: CloudProvider> Application<T> {
|
||||
pub fn new(
|
||||
context: Context,
|
||||
id: &str,
|
||||
long_id: Uuid,
|
||||
action: Action,
|
||||
name: &str,
|
||||
ports: Vec<Port>,
|
||||
@@ -72,7 +75,8 @@ impl<T: CloudProvider> Application<T> {
|
||||
Ok(Self {
|
||||
_marker: PhantomData,
|
||||
context,
|
||||
id: id.to_string(),
|
||||
id: to_short_id(&long_id),
|
||||
long_id,
|
||||
action,
|
||||
name: name.to_string(),
|
||||
ports,
|
||||
@@ -94,6 +98,7 @@ impl<T: CloudProvider> Application<T> {
|
||||
pub(super) fn default_tera_context(&self, kubernetes: &dyn Kubernetes, environment: &Environment) -> TeraContext {
|
||||
let mut context = TeraContext::new();
|
||||
context.insert("id", self.id());
|
||||
context.insert("long_id", &self.long_id);
|
||||
context.insert("owner_id", environment.owner_id.as_str());
|
||||
context.insert("project_id", environment.project_id.as_str());
|
||||
context.insert("organization_id", environment.organization_id.as_str());
|
||||
@@ -140,9 +145,6 @@ impl<T: CloudProvider> Application<T> {
|
||||
context.insert("is_registry_secret", &true);
|
||||
context.insert("registry_secret", self.build().image.registry_host());
|
||||
|
||||
// TODO: Remove this
|
||||
context.insert("clone", &false);
|
||||
|
||||
if self.context.resource_expiration_in_seconds().is_some() {
|
||||
context.insert("resource_expiration_in_seconds", &self.context.resource_expiration_in_seconds())
|
||||
}
|
||||
@@ -335,6 +337,10 @@ where
|
||||
fn selector(&self) -> Option<String> {
|
||||
self.selector()
|
||||
}
|
||||
|
||||
fn long_id(&self) -> &Uuid {
|
||||
&self.long_id
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: CloudProvider> Helm for Application<T> {
|
||||
|
||||
@@ -15,10 +15,12 @@ use crate::models::database_utils::{
|
||||
get_self_hosted_redis_version,
|
||||
};
|
||||
use crate::models::types::{CloudProvider, ToTeraContext, VersionsNumber};
|
||||
use crate::utilities::to_short_id;
|
||||
use function_name::named;
|
||||
use std::borrow::Borrow;
|
||||
use std::marker::PhantomData;
|
||||
use tera::Context as TeraContext;
|
||||
use uuid::Uuid;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Database mode
|
||||
@@ -71,6 +73,7 @@ pub struct Database<C: CloudProvider, M: DatabaseMode, T: DatabaseType<C, M>> {
|
||||
_marker: PhantomData<(C, M, T)>,
|
||||
pub(super) context: Context,
|
||||
pub(super) id: String,
|
||||
pub(super) long_id: Uuid,
|
||||
pub(super) action: Action,
|
||||
pub(super) name: String,
|
||||
pub(super) version: VersionsNumber,
|
||||
@@ -89,7 +92,7 @@ pub struct Database<C: CloudProvider, M: DatabaseMode, T: DatabaseType<C, M>> {
|
||||
impl<C: CloudProvider, M: DatabaseMode, T: DatabaseType<C, M>> Database<C, M, T> {
|
||||
pub fn new(
|
||||
context: Context,
|
||||
id: &str,
|
||||
long_id: Uuid,
|
||||
action: Action,
|
||||
name: &str,
|
||||
version: VersionsNumber,
|
||||
@@ -110,7 +113,8 @@ impl<C: CloudProvider, M: DatabaseMode, T: DatabaseType<C, M>> Database<C, M, T>
|
||||
_marker: PhantomData,
|
||||
context,
|
||||
action,
|
||||
id: id.to_string(),
|
||||
id: to_short_id(&long_id),
|
||||
long_id,
|
||||
name: name.to_string(),
|
||||
version,
|
||||
fqdn: fqdn.to_string(),
|
||||
@@ -178,6 +182,10 @@ where
|
||||
&self.id
|
||||
}
|
||||
|
||||
fn long_id(&self) -> &Uuid {
|
||||
&self.long_id
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
&self.name
|
||||
}
|
||||
|
||||
@@ -14,10 +14,12 @@ use crate::io_models::{Context, Listen, Listener, Listeners};
|
||||
use crate::logger::Logger;
|
||||
use crate::models::types::CloudProvider;
|
||||
use crate::models::types::ToTeraContext;
|
||||
use crate::utilities::to_short_id;
|
||||
use function_name::named;
|
||||
use std::borrow::Borrow;
|
||||
use std::marker::PhantomData;
|
||||
use tera::Context as TeraContext;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum RouterError {
|
||||
@@ -29,6 +31,7 @@ pub struct Router<T: CloudProvider> {
|
||||
_marker: PhantomData<T>,
|
||||
pub(crate) context: Context,
|
||||
pub(crate) id: String,
|
||||
pub(crate) long_id: Uuid,
|
||||
pub(crate) action: Action,
|
||||
pub(crate) name: String,
|
||||
pub(crate) default_domain: String,
|
||||
@@ -43,7 +46,7 @@ pub struct Router<T: CloudProvider> {
|
||||
impl<T: CloudProvider> Router<T> {
|
||||
pub fn new(
|
||||
context: Context,
|
||||
id: &str,
|
||||
long_id: Uuid,
|
||||
name: &str,
|
||||
action: Action,
|
||||
default_domain: &str,
|
||||
@@ -57,7 +60,8 @@ impl<T: CloudProvider> Router<T> {
|
||||
Ok(Self {
|
||||
_marker: PhantomData,
|
||||
context,
|
||||
id: id.to_string(),
|
||||
id: to_short_id(&long_id),
|
||||
long_id,
|
||||
name: name.to_string(),
|
||||
action,
|
||||
default_domain: default_domain.to_string(),
|
||||
@@ -243,6 +247,10 @@ where
|
||||
&self.id
|
||||
}
|
||||
|
||||
fn long_id(&self) -> &Uuid {
|
||||
&self.long_id
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
&self.name
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ use std::path::Path;
|
||||
|
||||
use reqwest::header;
|
||||
use reqwest::header::{HeaderMap, HeaderValue};
|
||||
use uuid::Uuid;
|
||||
|
||||
// generate the right header for digital ocean with token
|
||||
pub fn get_header_with_bearer(token: &str) -> HeaderMap<HeaderValue> {
|
||||
@@ -48,6 +49,10 @@ pub fn compute_image_tag<P: AsRef<Path> + Hash, T: AsRef<Path> + Hash>(
|
||||
tag
|
||||
}
|
||||
|
||||
pub fn to_short_id(id: &Uuid) -> String {
|
||||
format!("z{}", id.to_string().split_at(8).0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests_utilities {
|
||||
use crate::utilities::compute_image_tag;
|
||||
|
||||
@@ -39,12 +39,14 @@ use qovery_engine::logger::Logger;
|
||||
use qovery_engine::models::digital_ocean::DoRegion;
|
||||
use qovery_engine::models::scaleway::ScwZone;
|
||||
use qovery_engine::transaction::{DeploymentOption, Transaction, TransactionResult};
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use tracing::{span, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub enum RegionActivationStatus {
|
||||
Deactivated,
|
||||
@@ -255,7 +257,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
action: Action::Create,
|
||||
applications: vec![
|
||||
Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: app_name_1.clone(),
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(),
|
||||
@@ -270,6 +272,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
}),
|
||||
storage: vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: 10,
|
||||
@@ -301,7 +304,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
advance_settings: Default::default(),
|
||||
},
|
||||
Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: app_name_2.clone(),
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "5990752647af11ef21c3d46a51abbde3da1ab351".to_string(),
|
||||
@@ -316,6 +319,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
}),
|
||||
storage: vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: 10,
|
||||
@@ -347,7 +351,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
advance_settings: Default::default(),
|
||||
},
|
||||
Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: app_name_3.clone(),
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "158ea8ebc9897c50a7c56b910db33ce837ac1e61".to_string(),
|
||||
@@ -362,6 +366,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
}),
|
||||
storage: vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: 10,
|
||||
@@ -397,7 +402,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
],
|
||||
routers: vec![
|
||||
Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "main".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -410,7 +415,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
sticky_sessions_enabled: false,
|
||||
},
|
||||
Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "second-router".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -423,7 +428,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
sticky_sessions_enabled: false,
|
||||
},
|
||||
Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "third-router".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -440,7 +445,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_name.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: fqdn.clone(),
|
||||
@@ -462,7 +467,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_name_2.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: fqdn_2.clone(),
|
||||
@@ -484,7 +489,7 @@ pub fn environment_3_apps_3_routers_3_databases(
|
||||
Database {
|
||||
kind: DatabaseKind::Mongodb,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_db_name_mongo.clone(),
|
||||
version: version_mongo.to_string(),
|
||||
fqdn_id: database_host_mongo.clone(),
|
||||
@@ -512,7 +517,6 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
|
||||
let suffix = generate_id();
|
||||
let application_id = generate_id();
|
||||
let application_name = format!("{}-{}", "simple-app".to_string(), &suffix);
|
||||
let router_id = generate_id();
|
||||
let router_name = "main".to_string();
|
||||
let application_domain = format!("{}.{}.{}", application_id, context.cluster_id().to_string(), test_domain);
|
||||
EnvironmentRequest {
|
||||
@@ -523,7 +527,7 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
|
||||
organization_id: context.organization_id().to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: application_id,
|
||||
long_id: Uuid::new_v4(),
|
||||
name: application_name,
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "fc575a2f3be0b9100492c8a463bf18134a8698a5".to_string(),
|
||||
@@ -556,7 +560,7 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
|
||||
advance_settings: Default::default(),
|
||||
}],
|
||||
routers: vec![Router {
|
||||
id: router_id,
|
||||
long_id: Uuid::new_v4(),
|
||||
name: router_name,
|
||||
action: Action::Create,
|
||||
default_domain: application_domain,
|
||||
@@ -575,7 +579,6 @@ pub fn working_minimal_environment(context: &Context, test_domain: &str) -> Envi
|
||||
|
||||
pub fn database_test_environment(context: &Context) -> EnvironmentRequest {
|
||||
let suffix = generate_id();
|
||||
let application_id = generate_id();
|
||||
let application_name = format!("{}-{}", "simple-app".to_string(), &suffix);
|
||||
|
||||
EnvironmentRequest {
|
||||
@@ -586,7 +589,7 @@ pub fn database_test_environment(context: &Context) -> EnvironmentRequest {
|
||||
organization_id: context.organization_id().to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: application_id,
|
||||
long_id: Uuid::new_v4(),
|
||||
name: application_name,
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "fc575a2f3be0b9100492c8a463bf18134a8698a5".to_string(),
|
||||
@@ -657,7 +660,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
databases: vec![Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_name.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: fqdn.clone(),
|
||||
@@ -678,7 +681,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
}],
|
||||
applications: vec![
|
||||
Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: application_name1.to_string(),
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(),
|
||||
@@ -693,6 +696,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
}),
|
||||
storage: vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: 10,
|
||||
@@ -724,7 +728,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
advance_settings: Default::default(),
|
||||
},
|
||||
Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: application_name2.to_string(),
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
commit_id: "680550d1937b3f90551849c0da8f77c39916913b".to_string(),
|
||||
@@ -739,6 +743,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
}),
|
||||
storage: vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: 10,
|
||||
@@ -772,7 +777,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
],
|
||||
routers: vec![
|
||||
Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "main".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -785,7 +790,7 @@ pub fn environnement_2_app_2_routers_1_psql(
|
||||
sticky_sessions_enabled: false,
|
||||
},
|
||||
Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "second-router".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -831,7 +836,7 @@ pub fn echo_app_environment(context: &Context, test_domain: &str) -> Environment
|
||||
organization_id: context.organization_id().to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: format!("{}-{}", "echo-app".to_string(), &suffix),
|
||||
/*name: "simple-app".to_string(),*/
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
@@ -867,7 +872,7 @@ pub fn echo_app_environment(context: &Context, test_domain: &str) -> Environment
|
||||
advance_settings: Default::default(),
|
||||
}],
|
||||
routers: vec![Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "main".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id().to_string(), test_domain),
|
||||
@@ -894,7 +899,7 @@ pub fn environment_only_http_server(context: &Context) -> EnvironmentRequest {
|
||||
organization_id: context.organization_id().to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: format!("{}-{}", "mini-http".to_string(), &suffix),
|
||||
/*name: "simple-app".to_string(),*/
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
@@ -935,6 +940,7 @@ pub fn environment_only_http_server(context: &Context) -> EnvironmentRequest {
|
||||
|
||||
pub fn environment_only_http_server_router(context: &Context, test_domain: &str) -> EnvironmentRequest {
|
||||
let suffix = generate_id();
|
||||
let id = Uuid::new_v4();
|
||||
EnvironmentRequest {
|
||||
execution_id: context.execution_id().to_string(),
|
||||
id: generate_id(),
|
||||
@@ -943,7 +949,7 @@ pub fn environment_only_http_server_router(context: &Context, test_domain: &str)
|
||||
organization_id: context.organization_id().to_string(),
|
||||
action: Action::Create,
|
||||
applications: vec![Application {
|
||||
id: generate_id(),
|
||||
long_id: id,
|
||||
name: format!("{}-{}", "mini-http".to_string(), &suffix),
|
||||
/*name: "simple-app".to_string(),*/
|
||||
git_url: "https://github.com/Qovery/engine-testing.git".to_string(),
|
||||
@@ -977,7 +983,7 @@ pub fn environment_only_http_server_router(context: &Context, test_domain: &str)
|
||||
advance_settings: Default::default(),
|
||||
}],
|
||||
routers: vec![Router {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "main".to_string(),
|
||||
action: Action::Create,
|
||||
default_domain: format!("{}.{}.{}", generate_id(), context.cluster_id(), test_domain),
|
||||
@@ -1045,7 +1051,7 @@ pub fn test_db(
|
||||
let _enter = span.enter();
|
||||
let context_for_delete = context.clone_not_same_execution_id();
|
||||
|
||||
let app_id = generate_id();
|
||||
let app_id = Uuid::new_v4();
|
||||
let database_username = "superuser".to_string();
|
||||
let database_password = generate_password();
|
||||
let db_kind_str = db_kind.name().to_string();
|
||||
@@ -1080,7 +1086,7 @@ pub fn test_db(
|
||||
let db = Database {
|
||||
kind: db_kind.clone(),
|
||||
action: Action::Create,
|
||||
id: db_id.clone(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: db_id.clone(),
|
||||
version: version.to_string(),
|
||||
fqdn_id: database_host.clone(),
|
||||
@@ -1107,8 +1113,8 @@ pub fn test_db(
|
||||
.applications
|
||||
.into_iter()
|
||||
.map(|mut app| {
|
||||
app.id = app_id.clone();
|
||||
app.name = app_id.clone();
|
||||
app.long_id = app_id.clone();
|
||||
app.name = to_short_id(&app_id);
|
||||
app.branch = app_name.clone();
|
||||
app.commit_id = db_infos.app_commit.clone();
|
||||
app.ports = vec![Port {
|
||||
|
||||
@@ -53,6 +53,7 @@ use qovery_engine::io_models::DatabaseMode::MANAGED;
|
||||
use qovery_engine::logger::{Logger, StdIoLogger};
|
||||
use qovery_engine::models::scaleway::ScwZone;
|
||||
use qovery_engine::runtime::block_on;
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use time::Instant;
|
||||
use url::Url;
|
||||
|
||||
@@ -437,10 +438,11 @@ pub fn generate_password() -> String {
|
||||
.exclude_similar_characters(true)
|
||||
.strict(true);
|
||||
|
||||
let mut password = "fake".to_string() + &pg
|
||||
.generate_one()
|
||||
.expect("error while trying to generate a password")
|
||||
.to_string();
|
||||
let mut password = "fake".to_string()
|
||||
+ &pg
|
||||
.generate_one()
|
||||
.expect("error while trying to generate a password")
|
||||
.to_string();
|
||||
|
||||
for forbidden_char in forbidden_chars {
|
||||
password = password.replace(forbidden_char, "-");
|
||||
@@ -891,7 +893,7 @@ pub fn db_fqnd(db: Database) -> String {
|
||||
match db.publicly_accessible {
|
||||
true => db.fqdn,
|
||||
false => match db.mode == MANAGED {
|
||||
true => format!("{}-dns", db.id),
|
||||
true => format!("{}-dns", to_short_id(&db.long_id)),
|
||||
false => match db.kind {
|
||||
DatabaseKind::Postgresql => "postgresqlpostgres",
|
||||
DatabaseKind::Mysql => "mysqlmysqldatabase",
|
||||
@@ -933,7 +935,7 @@ pub fn db_infos(
|
||||
DBInfos {
|
||||
db_port: database_port.clone(),
|
||||
db_name: database_db_name.to_string(),
|
||||
app_commit: "3fdc7e784c1d98b80446be7ff25e35370306d9a8".to_string(),
|
||||
app_commit: "da5dd2b58b78576921373fcb4d4bddc796a804a8".to_string(),
|
||||
app_env_vars: btreemap! {
|
||||
"IS_DOCUMENTDB".to_string() => base64::encode((database_mode == MANAGED).to_string()),
|
||||
"QOVERY_DATABASE_TESTING_DATABASE_FQDN".to_string() => base64::encode(db_fqdn.clone()),
|
||||
@@ -951,7 +953,7 @@ pub fn db_infos(
|
||||
DBInfos {
|
||||
db_port: database_port.clone(),
|
||||
db_name: database_db_name.to_string(),
|
||||
app_commit: "fc8a87b39cdee84bb789893fb823e3e62a1999c0".to_string(),
|
||||
app_commit: "42f6553b6be617f954f903e01236e225bbb9f468".to_string(),
|
||||
app_env_vars: btreemap! {
|
||||
"MYSQL_HOST".to_string() => base64::encode(db_fqdn.clone()),
|
||||
"MYSQL_PORT".to_string() => base64::encode(database_port.to_string()),
|
||||
@@ -971,7 +973,7 @@ pub fn db_infos(
|
||||
DBInfos {
|
||||
db_port: database_port.clone(),
|
||||
db_name: database_db_name.to_string(),
|
||||
app_commit: "c3eda167df49fa9757f281d6f3655ba46287c61d".to_string(),
|
||||
app_commit: "61c7a9b55a085229583b6a394dd168a4159dfd09".to_string(),
|
||||
app_env_vars: btreemap! {
|
||||
"PG_DBNAME".to_string() => base64::encode(database_db_name.clone()),
|
||||
"PG_HOST".to_string() => base64::encode(db_fqdn.clone()),
|
||||
@@ -987,7 +989,7 @@ pub fn db_infos(
|
||||
DBInfos {
|
||||
db_port: database_port.clone(),
|
||||
db_name: database_db_name.to_string(),
|
||||
app_commit: "80ad41fbe9549f8de8dbe2ca4dd5d23e8ffc92de".to_string(),
|
||||
app_commit: "e4b1162741ce162b834b68498e43bf60f0f58cbe".to_string(),
|
||||
app_env_vars: btreemap! {
|
||||
"IS_ELASTICCACHE".to_string() => base64::encode((database_mode == MANAGED).to_string()),
|
||||
"REDIS_HOST".to_string() => base64::encode(db_fqdn.clone()),
|
||||
|
||||
@@ -5,6 +5,7 @@ use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Database, DatabaseKind, DatabaseMode, Port, Protocol};
|
||||
use test_utilities::aws::aws_default_engine_config;
|
||||
use tracing::{span, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
use self::test_utilities::aws::{AWS_DATABASE_DISK_TYPE, AWS_DATABASE_INSTANCE_TYPE};
|
||||
use self::test_utilities::utilities::{
|
||||
@@ -12,6 +13,7 @@ use self::test_utilities::utilities::{
|
||||
};
|
||||
use qovery_engine::io_models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use test_utilities::common::{test_db, Infrastructure};
|
||||
|
||||
/**
|
||||
@@ -261,7 +263,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
environment.databases = vec![Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_db_name.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: database_host.clone(),
|
||||
@@ -323,7 +325,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
assert!(matches!(ret, TransactionResult::Ok));
|
||||
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql{}-0", &environment_check.databases[0].id);
|
||||
let database_name = format!("postgresql{}-0", to_short_id(&environment_check.databases[0].long_id));
|
||||
match is_pod_restarted_env(context, Kind::Aws, environment_check, database_name.as_str(), secrets) {
|
||||
(true, _) => assert!(true),
|
||||
(false, _) => assert!(false),
|
||||
|
||||
@@ -9,12 +9,14 @@ use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::cmd::kubectl::kubernetes_get_all_pdbs;
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use std::collections::BTreeMap;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use test_utilities::aws::aws_default_engine_config;
|
||||
use test_utilities::utilities::{context, init, kubernetes_config_path};
|
||||
use tracing::{span, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[cfg(feature = "test-aws-minimal")]
|
||||
#[named]
|
||||
@@ -159,7 +161,7 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
);
|
||||
|
||||
let ea = environment.clone();
|
||||
let selector = format!("appId={}", environment.applications[0].id);
|
||||
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
|
||||
|
||||
let ret = environment.deploy_environment(&ea, logger.clone(), &engine_config);
|
||||
assert!(matches!(ret, TransactionResult::Ok));
|
||||
@@ -220,7 +222,12 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
None,
|
||||
);
|
||||
for pdb in pdbs.expect("Unable to get pdbs").items.expect("Unable to get pdbs") {
|
||||
assert_eq!(pdb.metadata.name.contains(&environment.applications[0].id), false)
|
||||
assert_eq!(
|
||||
pdb.metadata
|
||||
.name
|
||||
.contains(&to_short_id(&environment.applications[0].long_id)),
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
// Check we can resume the env
|
||||
@@ -265,7 +272,11 @@ fn deploy_a_working_environment_and_pause_it_eks() {
|
||||
);
|
||||
let mut filtered_pdb = false;
|
||||
for pdb in pdbs.expect("Unable to get pdbs").items.expect("Unable to get pdbs") {
|
||||
if pdb.metadata.name.contains(&environment.applications[0].id) {
|
||||
if pdb
|
||||
.metadata
|
||||
.name
|
||||
.contains(&to_short_id(&environment.applications[0].long_id))
|
||||
{
|
||||
filtered_pdb = true;
|
||||
break;
|
||||
}
|
||||
@@ -575,6 +586,7 @@ fn deploy_a_working_environment_with_storage_on_aws_eks() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
@@ -657,6 +669,7 @@ fn redeploy_same_app_with_ebs() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use ::function_name::named;
|
||||
use tracing::{span, warn, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
use qovery_engine::cloud_provider::{Kind as ProviderKind, Kind};
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Database, DatabaseKind, DatabaseMode, Port, Protocol};
|
||||
@@ -9,6 +10,7 @@ use test_utilities::utilities::{
|
||||
};
|
||||
|
||||
use qovery_engine::io_models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use test_utilities::common::{database_test_environment, test_db, Infrastructure};
|
||||
use test_utilities::digitalocean::{
|
||||
clean_environments, do_default_engine_config, DO_MANAGED_DATABASE_DISK_TYPE, DO_MANAGED_DATABASE_INSTANCE_TYPE,
|
||||
@@ -279,7 +281,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
environment.databases = vec![Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_db_name.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: database_host.clone(),
|
||||
@@ -355,7 +357,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
assert!(matches!(ret, TransactionResult::Ok));
|
||||
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].id);
|
||||
let database_name = format!("postgresql-{}-0", to_short_id(&environment_check.databases[0].long_id));
|
||||
match is_pod_restarted_env(
|
||||
context.clone(),
|
||||
ProviderKind::Do,
|
||||
|
||||
@@ -9,6 +9,7 @@ use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use std::collections::BTreeMap;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
@@ -16,6 +17,7 @@ use test_utilities::common::Infrastructure;
|
||||
use test_utilities::digitalocean::do_default_engine_config;
|
||||
use test_utilities::utilities::context;
|
||||
use tracing::{span, warn, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
// Note: All those tests relies on a test cluster running on DigitalOcean infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
@@ -222,7 +224,7 @@ fn digitalocean_doks_deploy_a_working_environment_and_pause() {
|
||||
);
|
||||
|
||||
let env_action = environment.clone();
|
||||
let selector = format!("appId={}", environment.applications[0].id);
|
||||
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
|
||||
|
||||
let ret = environment.deploy_environment(&env_action, logger.clone(), &engine_config);
|
||||
assert!(matches!(ret, TransactionResult::Ok));
|
||||
@@ -451,6 +453,7 @@ fn digitalocean_doks_deploy_a_working_environment_with_storage() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
@@ -534,6 +537,7 @@ fn digitalocean_doks_redeploy_same_app() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use ::function_name::named;
|
||||
use tracing::{span, warn, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
use qovery_engine::cloud_provider::{Kind as ProviderKind, Kind};
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Database, DatabaseKind, DatabaseMode, Port, Protocol};
|
||||
@@ -10,6 +11,7 @@ use test_utilities::utilities::{
|
||||
};
|
||||
|
||||
use qovery_engine::io_models::DatabaseMode::{CONTAINER, MANAGED};
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use test_utilities::common::test_db;
|
||||
use test_utilities::common::{database_test_environment, Infrastructure};
|
||||
use test_utilities::scaleway::{
|
||||
@@ -284,7 +286,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
environment.databases = vec![Database {
|
||||
kind: DatabaseKind::Postgresql,
|
||||
action: Action::Create,
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: database_db_name.clone(),
|
||||
version: "11.8.0".to_string(),
|
||||
fqdn_id: database_host.clone(),
|
||||
@@ -360,7 +362,7 @@ fn postgresql_deploy_a_working_environment_and_redeploy() {
|
||||
assert!(matches!(result, TransactionResult::Ok));
|
||||
|
||||
// TO CHECK: DATABASE SHOULDN'T BE RESTARTED AFTER A REDEPLOY
|
||||
let database_name = format!("postgresql-{}-0", &environment_check.databases[0].id);
|
||||
let database_name = format!("postgresql-{}-0", to_short_id(&environment_check.databases[0].long_id));
|
||||
match is_pod_restarted_env(
|
||||
context.clone(),
|
||||
ProviderKind::Scw,
|
||||
|
||||
@@ -9,12 +9,14 @@ use ::function_name::named;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
use qovery_engine::io_models::{Action, CloneForTest, Port, Protocol, Storage, StorageType};
|
||||
use qovery_engine::transaction::TransactionResult;
|
||||
use qovery_engine::utilities::to_short_id;
|
||||
use std::collections::BTreeMap;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use test_utilities::common::Infrastructure;
|
||||
use test_utilities::scaleway::scw_default_engine_config;
|
||||
use tracing::{span, warn, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
// Note: All those tests relies on a test cluster running on Scaleway infrastructure.
|
||||
// This cluster should be live in order to have those tests passing properly.
|
||||
@@ -230,7 +232,7 @@ fn scaleway_kapsule_deploy_a_working_environment_and_pause() {
|
||||
);
|
||||
|
||||
let env_action = environment.clone();
|
||||
let selector = format!("appId={}", environment.applications[0].id);
|
||||
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
|
||||
|
||||
let result = environment.deploy_environment(&env_action, logger.clone(), &engine_config);
|
||||
assert!(matches!(result, TransactionResult::Ok));
|
||||
@@ -466,6 +468,7 @@ fn scaleway_kapsule_deploy_a_working_environment_with_storage() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
@@ -541,7 +544,7 @@ fn deploy_a_working_environment_and_pause_it() {
|
||||
);
|
||||
|
||||
let ea = environment.clone();
|
||||
let selector = format!("appId={}", environment.applications[0].id);
|
||||
let selector = format!("appId={}", to_short_id(&environment.applications[0].long_id));
|
||||
|
||||
let result = environment.deploy_environment(&ea, logger.clone(), &engine_config);
|
||||
assert!(matches!(result, TransactionResult::Ok));
|
||||
@@ -634,6 +637,7 @@ fn scaleway_kapsule_redeploy_same_app() {
|
||||
.map(|mut app| {
|
||||
app.storage = vec![Storage {
|
||||
id: generate_id(),
|
||||
long_id: Uuid::new_v4(),
|
||||
name: "photos".to_string(),
|
||||
storage_type: StorageType::Ssd,
|
||||
size_in_gib: storage_size,
|
||||
|
||||
Reference in New Issue
Block a user