mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
Merge branch 'dev' into feat/edge_init
# Conflicts: # src/cloud_provider/aws/kubernetes/mod.rs # src/cloud_provider/digitalocean/kubernetes/mod.rs # src/cloud_provider/scaleway/kubernetes/mod.rs # tests/aws/aws_kubernetes.rs # tests/scaleway/scw_kubernetes.rs
This commit is contained in:
9
.github/workflows/tests.yml
vendored
9
.github/workflows/tests.yml
vendored
@@ -21,20 +21,23 @@ jobs:
|
||||
- uses: hashicorp/setup-terraform@v1
|
||||
with:
|
||||
terraform_version: 0.14.10
|
||||
- uses: sergeysova/jq-action@v2
|
||||
id: sccache_release
|
||||
with:
|
||||
cmd: 'curl --silent "https://api.github.com/repos/Qovery/sccache-bin/releases/latest" | jq .tag_name'
|
||||
multiline: false
|
||||
- name: build-linter-utests
|
||||
run: |
|
||||
echo "########## LINTER ##########"
|
||||
cargo fmt --all -- --check --color=always || (echo "Use cargo fmt to format your code"; exit 1)
|
||||
rustup component add clippy
|
||||
cargo clippy --locked --all --all-features --lib -- -D warnings || (echo "Solve your clippy warnings to continue"; exit 1)
|
||||
|
||||
export PATH=$GITHUB_WORKSPACE/bin:$PATH
|
||||
export RUSTC_WRAPPER=$GITHUB_WORKSPACE/bin/sccache
|
||||
export SCCACHE_REDIS=${{ secrets.SCCACHE_REDIS }}
|
||||
export TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
|
||||
mkdir -p $GITHUB_WORKSPACE/bin $HOME/.terraform.d/plugin-cache
|
||||
sccache_release=$(curl --silent "https://github.com/Qovery/sccache-bin/releases/latest" | sed -r 's/^.+tag\/(.+)">.+/\1/')
|
||||
curl -sLo $GITHUB_WORKSPACE/bin/sccache https://github.com/Qovery/sccache-bin/releases/download/${sccache_release}/sccache
|
||||
curl -sLo $GITHUB_WORKSPACE/bin/sccache https://github.com/Qovery/sccache-bin/releases/download/${{ steps.sccache_release.outputs.value }}/sccache
|
||||
chmod 755 $GITHUB_WORKSPACE/bin/sccache
|
||||
echo "########## SHARED CACHE STATUS ##########"
|
||||
sccache --version
|
||||
|
||||
@@ -17,10 +17,14 @@ controller:
|
||||
targetCPUUtilizationPercentage: 50
|
||||
targetMemoryUtilizationPercentage: 50
|
||||
|
||||
publishService:
|
||||
enabled: true
|
||||
|
||||
service:
|
||||
enabled: true
|
||||
annotations:
|
||||
service.beta.kubernetes.io/aws-load-balancer-type: nlb
|
||||
external-dns.alpha.kubernetes.io/hostname: "{{ wildcard_managed_dns }}"
|
||||
externalTrafficPolicy: "Local"
|
||||
sessionAffinity: ""
|
||||
healthCheckNodePort: 0
|
||||
@@ -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/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -23,4 +23,5 @@ controller:
|
||||
service.beta.kubernetes.io/do-loadbalancer-size-slug: "lb-small"
|
||||
service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
|
||||
service.beta.kubernetes.io/do-loadbalancer-hostname: {{ do_loadbalancer_hostname }}
|
||||
external-dns.alpha.kubernetes.io/hostname: "{{ wildcard_managed_dns }}"
|
||||
externalTrafficPolicy: "Local"
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -22,4 +22,5 @@ controller:
|
||||
service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2: "false"
|
||||
service.beta.kubernetes.io/scw-loadbalancer-health-check-type: tcp
|
||||
service.beta.kubernetes.io/scw-loadbalancer-use-hostname: "false"
|
||||
external-dns.alpha.kubernetes.io/hostname: "{{ wildcard_managed_dns }}"
|
||||
externalTrafficPolicy: "Local"
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -350,6 +350,8 @@ fn tera_context(
|
||||
&managed_dns_resolvers_terraform_format,
|
||||
);
|
||||
|
||||
context.insert("wildcard_managed_dns", &self.dns_provider().domain().wildcarded().to_string());
|
||||
|
||||
match kubernetes.dns_provider().kind() {
|
||||
dns_provider::Kind::Cloudflare => {
|
||||
context.insert("external_dns_provider", kubernetes.dns_provider().provider_name());
|
||||
|
||||
@@ -257,6 +257,7 @@ impl DOKS {
|
||||
"managed_dns_resolvers_terraform_format",
|
||||
&managed_dns_resolvers_terraform_format,
|
||||
);
|
||||
context.insert("wildcard_managed_dns", &self.dns_provider().domain().wildcarded().to_string());
|
||||
match self.dns_provider.kind() {
|
||||
dns_provider::Kind::Cloudflare => {
|
||||
context.insert("external_dns_provider", self.dns_provider.provider_name());
|
||||
@@ -463,7 +464,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,13 +534,43 @@ 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(),
|
||||
&listeners_helper,
|
||||
);
|
||||
|
||||
// temporary: remove helm/kube management from terraform
|
||||
match terraform_init_validate_state_list(temp_dir.as_str()) {
|
||||
Ok(x) => {
|
||||
let items_type = vec!["helm_release", "kubernetes_namespace"];
|
||||
for item in items_type {
|
||||
for entry in x.clone() {
|
||||
if entry.starts_with(item) {
|
||||
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)),
|
||||
)),
|
||||
Err(e) => {
|
||||
return Err(EngineError::new_terraform_cannot_remove_entry_out(
|
||||
event_details,
|
||||
entry.to_string(),
|
||||
e,
|
||||
))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Error(
|
||||
EngineError::new_terraform_state_does_not_exist(event_details.clone(), e),
|
||||
None,
|
||||
)),
|
||||
};
|
||||
|
||||
// Logs bucket
|
||||
if let Err(e) = self.spaces.create_bucket(self.logs_bucket_name().as_str()) {
|
||||
let error =
|
||||
@@ -772,7 +803,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()) {
|
||||
@@ -893,13 +924,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)),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -946,13 +976,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())),
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -998,23 +1025,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())),
|
||||
)),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1145,8 +1169,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
|
||||
@@ -1300,7 +1324,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())?;
|
||||
|
||||
@@ -456,6 +456,7 @@ impl Kapsule {
|
||||
"managed_dns_resolvers_terraform_format",
|
||||
&managed_dns_resolvers_terraform_format,
|
||||
);
|
||||
context.insert("wildcard_managed_dns", &self.dns_provider().domain().wildcarded().to_string());
|
||||
match self.dns_provider.kind() {
|
||||
dns_provider::Kind::Cloudflare => {
|
||||
context.insert("external_dns_provider", self.dns_provider.provider_name());
|
||||
@@ -664,6 +665,36 @@ impl Kapsule {
|
||||
&listeners_helper,
|
||||
);
|
||||
|
||||
// temporary: remove helm/kube management from terraform
|
||||
match terraform_init_validate_state_list(temp_dir.as_str()) {
|
||||
Ok(x) => {
|
||||
let items_type = vec!["helm_release", "kubernetes_namespace"];
|
||||
for item in items_type {
|
||||
for entry in x.clone() {
|
||||
if entry.starts_with(item) {
|
||||
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)),
|
||||
)),
|
||||
Err(e) => {
|
||||
return Err(EngineError::new_terraform_cannot_remove_entry_out(
|
||||
event_details,
|
||||
entry.to_string(),
|
||||
e,
|
||||
))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => self.logger().log(EngineEvent::Error(
|
||||
EngineError::new_terraform_state_does_not_exist(event_details.clone(), e),
|
||||
None,
|
||||
)),
|
||||
};
|
||||
|
||||
// TODO(benjaminch): move this elsewhere
|
||||
// Create object-storage buckets
|
||||
self.logger().log(EngineEvent::Info(
|
||||
@@ -879,7 +910,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(),
|
||||
),
|
||||
));
|
||||
|
||||
@@ -975,7 +1006,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)),
|
||||
),
|
||||
)),
|
||||
};
|
||||
@@ -1016,7 +1047,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())?;
|
||||
@@ -1147,7 +1178,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) {
|
||||
@@ -1182,7 +1213,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())?;
|
||||
@@ -1305,7 +1336,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)),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1575,7 +1609,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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -64,7 +64,9 @@ pub fn aws_default_engine_config(context: &Context, logger: Box<dyn Logger>) ->
|
||||
AWS_TEST_REGION.to_string().as_str(),
|
||||
KubernetesKind::Eks,
|
||||
AWS_KUBERNETES_VERSION.to_string(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,11 @@ pub fn dns_provider_cloudflare(context: &Context, domain: &ClusterDomain) -> Box
|
||||
let secrets = FuncTestsSecrets::new();
|
||||
let domain = Domain::new(match domain {
|
||||
ClusterDomain::Custom(domain) => domain.to_string(),
|
||||
ClusterDomain::Default => secrets.CLOUDFLARE_DOMAIN.expect("CLOUDFLARE_DOMAIN is not set"),
|
||||
ClusterDomain::Default { cluster_id } => format!(
|
||||
"{}.{}",
|
||||
cluster_id,
|
||||
secrets.CLOUDFLARE_DOMAIN.expect("CLOUDFLARE_DOMAIN is not set")
|
||||
),
|
||||
});
|
||||
Box::new(Cloudflare::new(
|
||||
context.clone(),
|
||||
|
||||
@@ -42,12 +42,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,
|
||||
@@ -55,7 +57,7 @@ pub enum RegionActivationStatus {
|
||||
}
|
||||
|
||||
pub enum ClusterDomain {
|
||||
Default,
|
||||
Default { cluster_id: String },
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
@@ -259,7 +261,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(),
|
||||
@@ -274,6 +276,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,
|
||||
@@ -305,7 +308,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(),
|
||||
@@ -320,6 +323,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,
|
||||
@@ -351,7 +355,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(),
|
||||
@@ -366,6 +370,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,
|
||||
@@ -401,7 +406,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),
|
||||
@@ -414,7 +419,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),
|
||||
@@ -427,7 +432,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),
|
||||
@@ -444,7 +449,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(),
|
||||
@@ -466,7 +471,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(),
|
||||
@@ -488,7 +493,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(),
|
||||
@@ -516,7 +521,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 {
|
||||
@@ -527,7 +531,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(),
|
||||
@@ -560,7 +564,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,
|
||||
@@ -579,7 +583,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 {
|
||||
@@ -590,7 +593,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(),
|
||||
@@ -661,7 +664,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(),
|
||||
@@ -682,7 +685,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(),
|
||||
@@ -697,6 +700,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,
|
||||
@@ -728,7 +732,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(),
|
||||
@@ -743,6 +747,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,
|
||||
@@ -776,7 +781,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),
|
||||
@@ -789,7 +794,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),
|
||||
@@ -835,7 +840,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(),
|
||||
@@ -871,7 +876,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),
|
||||
@@ -898,7 +903,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(),
|
||||
@@ -939,6 +944,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(),
|
||||
@@ -947,7 +953,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(),
|
||||
@@ -981,7 +987,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),
|
||||
@@ -1049,7 +1055,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(provider_kind.clone(), database_mode.clone());
|
||||
let db_kind_str = db_kind.name().to_string();
|
||||
@@ -1084,7 +1090,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(),
|
||||
@@ -1111,8 +1117,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 {
|
||||
@@ -1148,7 +1154,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::Eks,
|
||||
kubernetes_version.clone(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
Kind::Do => DO::docker_cr_engine(
|
||||
@@ -1157,7 +1165,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::Doks,
|
||||
kubernetes_version.clone(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
Kind::Scw => Scaleway::docker_cr_engine(
|
||||
@@ -1166,7 +1176,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::ScwKapsule,
|
||||
kubernetes_version.clone(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
};
|
||||
@@ -1201,7 +1213,7 @@ pub fn test_db(
|
||||
};
|
||||
}
|
||||
DatabaseMode::MANAGED => {
|
||||
match get_svc(context, provider_kind.clone(), environment.clone(), secrets.clone()) {
|
||||
match get_svc(context.clone(), provider_kind.clone(), environment.clone(), secrets.clone()) {
|
||||
Ok(svc) => {
|
||||
let service = svc
|
||||
.items
|
||||
@@ -1224,6 +1236,8 @@ pub fn test_db(
|
||||
}
|
||||
}
|
||||
|
||||
let cluster_id = context.cluster_id().to_string();
|
||||
|
||||
let engine_config_for_delete = match provider_kind {
|
||||
Kind::Aws => AWS::docker_cr_engine(
|
||||
&context_for_delete,
|
||||
@@ -1231,7 +1245,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::Eks,
|
||||
kubernetes_version,
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: cluster_id.to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
Kind::Do => DO::docker_cr_engine(
|
||||
@@ -1240,7 +1256,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::Doks,
|
||||
kubernetes_version,
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: cluster_id.to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
Kind::Scw => Scaleway::docker_cr_engine(
|
||||
@@ -1249,7 +1267,9 @@ pub fn test_db(
|
||||
localisation.as_str(),
|
||||
KubernetesKind::ScwKapsule,
|
||||
kubernetes_version,
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: cluster_id.to_string(),
|
||||
},
|
||||
None,
|
||||
),
|
||||
};
|
||||
|
||||
@@ -50,7 +50,9 @@ pub fn do_default_engine_config(context: &Context, logger: Box<dyn Logger>) -> E
|
||||
DO_TEST_REGION.to_string().as_str(),
|
||||
KubernetesKind::Doks,
|
||||
DO_KUBERNETES_VERSION.to_string(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ pub fn scw_default_engine_config(context: &Context, logger: Box<dyn Logger>) ->
|
||||
SCW_TEST_ZONE.to_string().as_str(),
|
||||
KubernetesKind::ScwKapsule,
|
||||
SCW_KUBERNETES_VERSION.to_string(),
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default {
|
||||
cluster_id: context.cluster_id().to_string(),
|
||||
},
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -897,7 +898,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",
|
||||
@@ -939,7 +940,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()),
|
||||
@@ -957,7 +958,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()),
|
||||
@@ -977,7 +978,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()),
|
||||
@@ -993,7 +994,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,
|
||||
|
||||
@@ -4,6 +4,7 @@ use std::str::FromStr;
|
||||
|
||||
use ::function_name::named;
|
||||
use test_utilities::common::{cluster_test, ClusterDomain, ClusterTestType};
|
||||
use test_utilities::utilities::{context, engine_run_test, generate_cluster_id, generate_id, logger};
|
||||
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode;
|
||||
use qovery_engine::cloud_provider::aws::kubernetes::VpcQoveryNetworkMode::{WithNatGateways, WithoutNatGateways};
|
||||
@@ -11,9 +12,6 @@ use qovery_engine::cloud_provider::aws::regions::AwsRegion;
|
||||
use qovery_engine::cloud_provider::kubernetes::Kind as KKind;
|
||||
use qovery_engine::cloud_provider::Kind;
|
||||
|
||||
use self::test_utilities::aws::{AWS_KUBERNETES_MAJOR_VERSION, AWS_KUBERNETES_MINOR_VERSION};
|
||||
use self::test_utilities::utilities::{context, engine_run_test, generate_cluster_id, generate_id, logger};
|
||||
|
||||
#[cfg(feature = "test-aws-infra")]
|
||||
fn create_and_destroy_eks_cluster(
|
||||
region: String,
|
||||
@@ -40,7 +38,7 @@ fn create_and_destroy_eks_cluster(
|
||||
test_type,
|
||||
major_boot_version,
|
||||
minor_boot_version,
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default { cluster_id },
|
||||
Option::from(vpc_network_mode),
|
||||
None,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -20,18 +20,19 @@ fn create_and_destroy_kapsule_cluster(
|
||||
vpc_network_mode: Option<VpcQoveryNetworkMode>,
|
||||
) {
|
||||
engine_run_test(|| {
|
||||
let cluster_id = generate_cluster_id(zone.as_str());
|
||||
cluster_test(
|
||||
test_name,
|
||||
Kind::Scw,
|
||||
KKind::ScwKapsule,
|
||||
context(generate_id().as_str(), generate_cluster_id(zone.as_str()).as_str()),
|
||||
context(generate_id().as_str(), cluster_id.as_str()),
|
||||
logger(),
|
||||
zone.as_str(),
|
||||
None,
|
||||
test_type,
|
||||
major_boot_version,
|
||||
minor_boot_version,
|
||||
&ClusterDomain::Default,
|
||||
&ClusterDomain::Default { cluster_id },
|
||||
vpc_network_mode,
|
||||
None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user