Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.installer.skipValidation }}
{{- if not (and .Values.installer.skipValidation .Values.installer.skipUsageValidation) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- if not .Values.installer.skipUsageValidation }}
apiVersion: v1
kind: ConfigMap
metadata:
name: validate-values-config
annotations:
helm.sh/hook: pre-install
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation,hook-failed
helm.sh/hook-weight: "-10"
data:
values.yaml: |
{{ .Values | toYaml | indent 4 }}

---
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 }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command: ["sh", "-c"]
args:
- |
cf account validate-usage --fail-condition=reached --subject=clusters --values /job_tmp/values.yaml --namespace ${NAMESPACE} --hook --log-level debug
volumeMounts:
- name: customized-values
mountPath: "/job_tmp"
volumes:
- name: customized-values
configMap:
name: validate-values-config
{{- end }}
2 changes: 2 additions & 0 deletions charts/gitops-runtime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
2 changes: 1 addition & 1 deletion installer-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM debian:12.10-slim

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

ARG CF_CLI_VERSION=v0.2.6
ARG CF_CLI_VERSION=v0.2.7
ARG TARGETARCH

RUN apt-get update && apt-get install curl -y
Expand Down