diff --git a/packages/kontinuous/tests/__snapshots__/app-simple-options.prod.yaml b/packages/kontinuous/tests/__snapshots__/app-simple-options.prod.yaml index 1f2770297..139ae2eb0 100644 --- a/packages/kontinuous/tests/__snapshots__/app-simple-options.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/app-simple-options.prod.yaml @@ -243,6 +243,46 @@ spec: component: app type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app + namespace: test-app-simple-options + labels: + component: app + kontinuous/deployment: test-app-simple-options-feature-branch-1-ffac537e6cbb-ze31pkw6 + kontinuous/deployment.env: test-app-simple-options-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-5g3qm0bo + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app/templates/autoscaler.yaml + kontinuous/deployment: test-app-simple-options-feature-branch-1-ffac537e6cbb-ze31pkw6 +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/app-simple.prod.yaml b/packages/kontinuous/tests/__snapshots__/app-simple.prod.yaml index e4208ba52..f759e5814 100644 --- a/packages/kontinuous/tests/__snapshots__/app-simple.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/app-simple.prod.yaml @@ -229,6 +229,46 @@ spec: component: app type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app + namespace: test-app-simple + labels: + component: app + kontinuous/deployment: test-app-simple-feature-branch-1-ffac537e6cbbf934b087-4w1j23zk + kontinuous/deployment.env: test-app-simple-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-5g3qm0bo + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app/templates/autoscaler.yaml + kontinuous/deployment: test-app-simple-feature-branch-1-ffac537e6cbbf934b087-4w1j23zk +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml b/packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml index 7d7c64736..43f51946f 100644 --- a/packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/extends-ovh.prod.yaml @@ -731,6 +731,46 @@ spec: component: app type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app + namespace: test-extends-ovh + labels: + component: app + kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv + kontinuous/deployment.env: test-extends-ovh-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-5g3qm0bo + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app/templates/autoscaler.yaml + kontinuous/deployment: test-extends-ovh-feature-branch-1-ffac537e6cbbf934b08-5oa7s3iv +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/hasura-no-ing.prod.yaml b/packages/kontinuous/tests/__snapshots__/hasura-no-ing.prod.yaml index 5b498e928..c6ef1e3c6 100644 --- a/packages/kontinuous/tests/__snapshots__/hasura-no-ing.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/hasura-no-ing.prod.yaml @@ -215,5 +215,45 @@ spec: selector: component: hasura type: ClusterIP +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hasura + namespace: test-hasura-no-ing + labels: + component: hasura + kontinuous/deployment: test-hasura-no-ing-feature-branch-1-ffac537e6cbbf934b-4sslo35s + kontinuous/deployment.env: test-hasura-no-ing-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-hasura-2gwbp4ld + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.hasura + kontinuous/source: project/charts/fabrique/charts/contrib/charts/hasura/templates/autoscaler.yaml + kontinuous/deployment: test-hasura-no-ing-feature-branch-1-ffac537e6cbbf934b-4sslo35s +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: hasura " `; diff --git a/packages/kontinuous/tests/__snapshots__/ingress-external-domain.prod.yaml b/packages/kontinuous/tests/__snapshots__/ingress-external-domain.prod.yaml index 92f7834f5..dec55f6b6 100644 --- a/packages/kontinuous/tests/__snapshots__/ingress-external-domain.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/ingress-external-domain.prod.yaml @@ -229,6 +229,46 @@ spec: component: app type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app + namespace: test-ingress-external-domain + labels: + component: app + kontinuous/deployment: test-ingress-external-domain-feature-branch-1-ffac537-4dx6300n + kontinuous/deployment.env: test-ingress-external-domain-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-5g3qm0bo + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app/templates/autoscaler.yaml + kontinuous/deployment: test-ingress-external-domain-feature-branch-1-ffac537-4dx6300n +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/pg.prod.yaml b/packages/kontinuous/tests/__snapshots__/pg.prod.yaml index b8f236d10..891ef4f05 100644 --- a/packages/kontinuous/tests/__snapshots__/pg.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/pg.prod.yaml @@ -471,6 +471,47 @@ spec: component: hasura type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hasura + namespace: test-pg + labels: + component: hasura + kontinuous/deployment: test-pg-feature-branch-1-ffac537e6cbbf934b08745a37893-4f12g0z3 + kontinuous/deployment.env: test-pg-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-hasura-2gwbp4ld + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.hasura + kontinuous/source: project/charts/fabrique/charts/contrib/charts/hasura/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"cnpg\\"]' + kontinuous/deployment: test-pg-feature-branch-1-ffac537e6cbbf934b08745a37893-4f12g0z3 +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: hasura +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/repo.domifa.prod.yaml b/packages/kontinuous/tests/__snapshots__/repo.domifa.prod.yaml index 8912b5e8f..0a4d08499 100644 --- a/packages/kontinuous/tests/__snapshots__/repo.domifa.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/repo.domifa.prod.yaml @@ -2096,6 +2096,211 @@ spec: component: portail-usagers type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: backend-cron + namespace: test-repo.domifa + labels: + component: backend-cron + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak + kontinuous/deployment.env: test-repo-domifa-prod-26ul0o86 + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-backend-cron-2yie5z9d + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.backend-cron + kontinuous/source: project/charts/fabrique/charts/contrib/charts/backend-cron/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"build-backend\\"]' + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: backend-cron +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: backend + namespace: test-repo.domifa + labels: + component: backend + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak + kontinuous/deployment.env: test-repo-domifa-prod-26ul0o86 + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-backend-hse0uu89 + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.backend + kontinuous/source: project/charts/fabrique/charts/contrib/charts/backend/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"build-backend\\"]' + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: backend +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: frontend + namespace: test-repo.domifa + labels: + component: frontend + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak + kontinuous/deployment.env: test-repo-domifa-prod-26ul0o86 + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-frontend-69txr3t1 + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.frontend + kontinuous/source: project/charts/fabrique/charts/contrib/charts/frontend/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"build-frontend\\"]' + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: frontend +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: portail-admins + namespace: test-repo.domifa + labels: + component: portail-admins + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak + kontinuous/deployment.env: test-repo-domifa-prod-26ul0o86 + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-portail-admins-620z998r + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.portail-admins + kontinuous/source: project/charts/fabrique/charts/contrib/charts/portail-admins/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"build-portail-admins\\"]' + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: portail-admins +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: portail-usagers + namespace: test-repo.domifa + labels: + component: portail-usagers + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak + kontinuous/deployment.env: test-repo-domifa-prod-26ul0o86 + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-portail-usagers-1kufzfe4 + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.portail-usagers + kontinuous/source: project/charts/fabrique/charts/contrib/charts/portail-usagers/templates/autoscaler.yaml + kontinuous/plugin.needs: '[\\"build-portail-usagers\\"]' + kontinuous/deployment: test-repo-domifa-feature-branch-1-ffac537e6cbbf934b08-2xrjelak +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: portail-usagers +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/packages/kontinuous/tests/__snapshots__/sample-1.prod.yaml b/packages/kontinuous/tests/__snapshots__/sample-1.prod.yaml index e84deefe0..42f185acc 100644 --- a/packages/kontinuous/tests/__snapshots__/sample-1.prod.yaml +++ b/packages/kontinuous/tests/__snapshots__/sample-1.prod.yaml @@ -743,6 +743,126 @@ spec: component: pgweb type: ClusterIP --- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app-2nd-instance + namespace: test-sample-1 + labels: + component: app-2nd-instance + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx + kontinuous/deployment.env: test-sample-1-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-2nd-instance-2v068zao + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app-2nd-instance + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app-2nd-instance/templates/autoscaler.yaml + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app-2nd-instance +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: app + namespace: test-sample-1 + labels: + component: app + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx + kontinuous/deployment.env: test-sample-1-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-app-5g3qm0bo + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.app + kontinuous/source: project/charts/fabrique/charts/contrib/charts/app/templates/autoscaler.yaml + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: app +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hasura + namespace: test-sample-1 + labels: + component: hasura + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx + kontinuous/deployment.env: test-sample-1-prod + kontinuous/ref: feature-branch-1 + kontinuous/gitSha: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/appVersion: ffac537e6cbbf934b08745a378932722df287a53 + kontinuous/resourceName: horizontalpodautoscaler-hasura-2gwbp4ld + app.kubernetes.io/manifest-managed-by: kontinuous + app.kubernetes.io/manifest-created-by: kontinuous + annotations: + kontinuous/chartPath: project.fabrique.contrib.hasura + kontinuous/source: project/charts/fabrique/charts/contrib/charts/hasura/templates/autoscaler.yaml + kontinuous/deployment: test-sample-1-feature-branch-1-ffac537e6cbbf934b08745-5y3s29fx +spec: + minReplicas: 2 + maxReplicas: 10 + metrics: + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: memory + target: + averageUtilization: 80 + type: Utilization + type: Resource + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: hasura +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/plugins/contrib/charts/app/values.yaml b/plugins/contrib/charts/app/values.yaml index 40d7455b4..c44e9fe39 100644 --- a/plugins/contrib/charts/app/values.yaml +++ b/plugins/contrib/charts/app/values.yaml @@ -30,7 +30,7 @@ resources: cpu: memory: autoscale: - enabled: false + enabled: minReplicas: 2 maxReplicas: 10 averageUtilization: diff --git a/plugins/contrib/charts/daemon/values.yaml b/plugins/contrib/charts/daemon/values.yaml index fc5b174e3..96705a6e0 100644 --- a/plugins/contrib/charts/daemon/values.yaml +++ b/plugins/contrib/charts/daemon/values.yaml @@ -6,19 +6,19 @@ imageRepository: imagePackage: daemon imageTag: image: -replicas: +replicas: env: [] vars: {} envFrom: [] resources: limits: - cpu: + cpu: memory: requests: - cpu: - memory: + cpu: + memory: autoscale: - enabled: false + enabled: minReplicas: 2 maxReplicas: 10 averageUtilization: @@ -30,5 +30,5 @@ volumeMounts: [] entrypoint: args: [] antiAffinity: - enabled: -strategyType: RollingUpdate \ No newline at end of file + enabled: +strategyType: RollingUpdate diff --git a/plugins/contrib/charts/hasura/values.yaml b/plugins/contrib/charts/hasura/values.yaml index 1eeaaaaed..bdf6cf9a5 100644 --- a/plugins/contrib/charts/hasura/values.yaml +++ b/plugins/contrib/charts/hasura/values.yaml @@ -45,7 +45,7 @@ resources: cpu: memory: autoscale: - enabled: false + enabled: minReplicas: 2 maxReplicas: 10 averageUtilization: diff --git a/plugins/contrib/kontinuous.yaml b/plugins/contrib/kontinuous.yaml index 37bc2301e..8cf222a2a 100644 --- a/plugins/contrib/kontinuous.yaml +++ b/plugins/contrib/kontinuous.yaml @@ -5,6 +5,8 @@ options: valuesCompilers: globalDefaults: enabled: true + enableHpaWhenGreaterThan1replica: + enabled: false patches: certs: diff --git a/plugins/contrib/values-compilers/20-enable-hpa-when-greater-than1replica.js b/plugins/contrib/values-compilers/20-enable-hpa-when-greater-than1replica.js new file mode 100644 index 000000000..1fb6b9ad1 --- /dev/null +++ b/plugins/contrib/values-compilers/20-enable-hpa-when-greater-than1replica.js @@ -0,0 +1,24 @@ +const extractComponents = require("./helpers/extract-components") + +module.exports = async (values, _options, { utils }) => { + const { deepmerge } = utils + + const components = extractComponents(["app", "hasura", "daemon"], values) + + components.forEach(([_key, componentValues]) => { + const replicas = componentValues.replicas ?? values.global.replicas + if (replicas < 2) { + return + } + if (componentValues.autoscale.enabled === false) { + return + } + const valuesPatch = { + autoscale: { + enabled: true, + }, + } + + deepmerge(componentValues, valuesPatch) + }) +} diff --git a/plugins/contrib/values-compilers/helpers/extract-components.js b/plugins/contrib/values-compilers/helpers/extract-components.js index 672eb3096..d619f30ba 100644 --- a/plugins/contrib/values-compilers/helpers/extract-components.js +++ b/plugins/contrib/values-compilers/helpers/extract-components.js @@ -1,12 +1,15 @@ -function isComponent(name, component) { - return component[`~chart`]?.endsWith(`.contrib.${name}`) +function isComponent(names, component) { + if (!Array.isArray(names)) { + names = [names] + } + return names.some((name) => component[`~chart`]?.endsWith(`.contrib.${name}`)) } -function extractComponents(name, values, acc = []) { +function extractComponents(names, values, acc = []) { Object.entries(values).forEach(([key, component]) => { if (typeof component === "object" && component !== null) { - extractComponents(name, component, acc) - if (component._isChartValues && isComponent(name, component)) { + extractComponents(names, component, acc) + if (component._isChartValues && isComponent(names, component)) { acc.push([key, component]) } } diff --git a/plugins/fabrique/kontinuous.yaml b/plugins/fabrique/kontinuous.yaml index 93d0a48e8..94b446afc 100644 --- a/plugins/fabrique/kontinuous.yaml +++ b/plugins/fabrique/kontinuous.yaml @@ -19,6 +19,8 @@ dependencies: pgBackupEndpointURL: https://s3.gra.io.cloud.ovh.net buildkitServiceEnabled: true buildkitSvcCount: 6 + enableHpaWhenGreaterThan1replica: + enabled: true patches: updateManifestsWithPreprodResources: diff --git a/plugins/fabrique/values-compilers/index.js b/plugins/fabrique/values-compilers/index.js index a992afc13..3ee385c24 100644 --- a/plugins/fabrique/values-compilers/index.js +++ b/plugins/fabrique/values-compilers/index.js @@ -13,4 +13,5 @@ module.exports = [ "../charts/contrib/values-compilers/09-pgadmin", "../charts/contrib/values-compilers/10-tpl-meta-values", "../charts/contrib/values-compilers/11-get-git-default-branch", + "../charts/contrib/values-compilers/20-enable-hpa-when-greater-than1replica", ]