From 4372452fa1acf82fa7d23dbab8b8f9172bfbc481 Mon Sep 17 00:00:00 2001 From: andrii-codefresh Date: Thu, 17 Apr 2025 12:46:09 +0300 Subject: [PATCH 1/2] feat: limits enforcement in runtime installation --- .../hooks/pre-install/validate-usage.yaml | 24 +++++++++++++++++++ charts/gitops-runtime/values.yaml | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 charts/gitops-runtime/templates/hooks/pre-install/validate-usage.yaml diff --git a/charts/gitops-runtime/templates/hooks/pre-install/validate-usage.yaml b/charts/gitops-runtime/templates/hooks/pre-install/validate-usage.yaml new file mode 100644 index 00000000..b16d71f4 --- /dev/null +++ b/charts/gitops-runtime/templates/hooks/pre-install/validate-usage.yaml @@ -0,0 +1,24 @@ +{{- if not .Values.installer.skipUsageValidation }} +apiVersion: batch/v1 +kind: Job +metadata: + name: validate-usage + annotations: + helm.sh/hook: pre-install + helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation +spec: + backoffLimit: 0 + ttlSecondsAfterFinished: 300 + template: + spec: + serviceAccountName: validate-values-sa + restartPolicy: Never + containers: + - name: validate-usage + image: "{{ .Values.installer.image.repository }}:{{ .Values.installer.image.tag | default .Chart.Version }}" + imagePullPolicy: {{ .Values.installer.image.pullPolicy }} + command: ["sh", "-c"] + args: + - | + cf account validate-usage --fail-condition=reached --subject=clusters --log-level debug +{{- end }} diff --git a/charts/gitops-runtime/values.yaml b/charts/gitops-runtime/values.yaml index 2c644edc..a0899f31 100644 --- a/charts/gitops-runtime/values.yaml +++ b/charts/gitops-runtime/values.yaml @@ -177,6 +177,8 @@ global: installer: # -- if set to true, pre-install hook will *not* run skipValidation: false + # -- if set to true, pre-install hook will *not* run + skipUsageValidation: false image: repository: quay.io/codefresh/gitops-runtime-installer tag: "" From 2819447101cd5f0c2bc89cc0ec537d669063b587 Mon Sep 17 00:00:00 2001 From: andrii-codefresh Date: Thu, 17 Apr 2025 12:59:25 +0300 Subject: [PATCH 2/2] use new cli-v2 --- installer-image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer-image/Dockerfile b/installer-image/Dockerfile index 0d2e8ddb..b6fbaa6a 100644 --- a/installer-image/Dockerfile +++ b/installer-image/Dockerfile @@ -3,7 +3,7 @@ FROM debian:12.9-slim RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections -ARG CF_CLI_VERSION=v0.1.70 +ARG CF_CLI_VERSION=v0.2.6 ARG TARGETARCH RUN apt-get update && apt-get install curl -y