diff --git a/.dmtlint.yaml b/.dmtlint.yaml index e3fea14ef1..3b1b6b4b8c 100644 --- a/.dmtlint.yaml +++ b/.dmtlint.yaml @@ -53,3 +53,36 @@ linters-settings: - tools/addlicense/testdata - test/performance/ssh - test/e2e/legacy/testdata/sshkeys + container: + exclude-rules: + seccomp-profile: + - kind: Deployment + name: virt-operator + container: kube-rbac-proxy + - kind: Deployment + name: virt-operator + container: virt-operator + - kind: Deployment + name: dvcr + container: dvcr + - kind: Deployment + name: dvcr + container: kube-rbac-proxy + - kind: Job + name: pre-delete-hook + container: pre-delete-hook + - kind: Deployment + name: virtualization-controller + container: virtualization-controller + - kind: Deployment + name: virtualization-controller + container: kube-rbac-proxy + - kind: Deployment + name: cdi-operator + container: kube-rbac-proxy + - kind: Deployment + name: cdi-operator + container: cdi-operator + - kind: Deployment + name: virtualization-api + container: virtualization-api diff --git a/templates/dvcr/_helpers.tpl b/templates/dvcr/_helpers.tpl index 7334561610..2e3c3300a9 100644 --- a/templates/dvcr/_helpers.tpl +++ b/templates/dvcr/_helpers.tpl @@ -27,10 +27,10 @@ true name: dvcr-secrets key: salt -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY value: "/var/lib/registry" -{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage" }} +{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage" }} {{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.type "S3" }} - name: REGISTRY_STORAGE_S3_REGION value: "{{ .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.s3.region }}" @@ -53,7 +53,7 @@ true {{- end }} {{- define "dvcr.envs.garbageCollection" -}} -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY value: "/var/lib/registry" {{- end }} @@ -64,7 +64,7 @@ true - name: "dvcr-config" mountPath: "/etc/docker/registry" -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} - name: data mountPath: /var/lib/registry/ {{- end }} @@ -82,7 +82,7 @@ true {{- define "dvcr.volumeMounts.garbageCollection" -}} - name: "dvcr-config" mountPath: "/etc/docker/registry" -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} - name: data mountPath: /var/lib/registry/ {{- end }} @@ -94,7 +94,7 @@ true configMap: name: dvcr-config -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} - name: data persistentVolumeClaim: claimName: dvcr @@ -118,18 +118,18 @@ true replicas: 1 strategy: type: Recreate -{{- else if and (include "helm_lib_ha_enabled" .) (eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage") }} +{{- else if and (include "helm_lib_ha_enabled" .) (eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage") }} replicas: 2 strategy: type: RollingUpdate rollingUpdate: maxSurge: 0 maxUnavailable: 1 -{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage" }} +{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage" }} replicas: 1 strategy: type: RollingUpdate -{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} replicas: 1 strategy: type: Recreate @@ -140,7 +140,7 @@ strategy: {{- $context := index . 0 -}} {{- $yes := index . 1 -}} {{- $no := index . 2 -}} - {{- if and (include "helm_lib_ha_enabled" $context) (eq $context.Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage") }} + {{- if and (include "helm_lib_ha_enabled" $context) (eq ($context.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage") }} {{- $yes -}} {{- else }} {{- $no -}} diff --git a/templates/dvcr/deployment.yaml b/templates/dvcr/deployment.yaml index 5024bb299e..722ff35844 100644 --- a/templates/dvcr/deployment.yaml +++ b/templates/dvcr/deployment.yaml @@ -34,12 +34,14 @@ spec: maxAllowed: cpu: 100m memory: 250Mi + {{- if eq (include "dvcr.isGarbageCollection" . ) "true" }} - containerName: dvcr-garbage-collection minAllowed: {{- include "dvcr.resources.garbageCollection" . | nindent 8 }} maxAllowed: cpu: 100m memory: 250Mi + {{- end }} {{- end }} --- apiVersion: policy/v1 diff --git a/templates/dvcr/pvc.yaml b/templates/dvcr/pvc.yaml index 7b4e7b7bb8..41b1a6d4a7 100644 --- a/templates/dvcr/pvc.yaml +++ b/templates/dvcr/pvc.yaml @@ -1,5 +1,5 @@ {{- if eq (include "dvcr.isEnabled" . ) "true"}} -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }} {{- $storageClassName := dig "storageClassName" "" .Values.virtualization.internal.moduleConfig.dvcr.storage.persistentVolumeClaim }} kind: PersistentVolumeClaim apiVersion: v1 diff --git a/templates/dvcr/secret.yaml b/templates/dvcr/secret.yaml index 68f5d32afc..5422a149f8 100644 --- a/templates/dvcr/secret.yaml +++ b/templates/dvcr/secret.yaml @@ -40,7 +40,8 @@ type: kubernetes.io/dockerconfigjson data: {{- include "dvcr.generate_dockercfg" (list . $registry "admin" .Values.virtualization.internal.dvcr.passwordRW) | nindent 2 }} -{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage"}} +{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage"}} + --- apiVersion: v1 kind: Secret