Skip to content

Commit 16202e9

Browse files
nevermarineSinelnikov Michail
andauthored
chore(core): fix dmt errors on dvcr storage (#1746)
Signed-off-by: Maksim Fedotov <[email protected]> Signed-off-by: Sinelnikov Michail <[email protected]> Co-authored-by: Sinelnikov Michail <[email protected]>
1 parent 0106751 commit 16202e9

File tree

5 files changed

+48
-12
lines changed

5 files changed

+48
-12
lines changed

.dmtlint.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,36 @@ linters-settings:
5353
- tools/addlicense/testdata
5454
- test/performance/ssh
5555
- test/e2e/legacy/testdata/sshkeys
56+
container:
57+
exclude-rules:
58+
seccomp-profile:
59+
- kind: Deployment
60+
name: virt-operator
61+
container: kube-rbac-proxy
62+
- kind: Deployment
63+
name: virt-operator
64+
container: virt-operator
65+
- kind: Deployment
66+
name: dvcr
67+
container: dvcr
68+
- kind: Deployment
69+
name: dvcr
70+
container: kube-rbac-proxy
71+
- kind: Job
72+
name: pre-delete-hook
73+
container: pre-delete-hook
74+
- kind: Deployment
75+
name: virtualization-controller
76+
container: virtualization-controller
77+
- kind: Deployment
78+
name: virtualization-controller
79+
container: kube-rbac-proxy
80+
- kind: Deployment
81+
name: cdi-operator
82+
container: kube-rbac-proxy
83+
- kind: Deployment
84+
name: cdi-operator
85+
container: cdi-operator
86+
- kind: Deployment
87+
name: virtualization-api
88+
container: virtualization-api

templates/dvcr/_helpers.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ true
2727
name: dvcr-secrets
2828
key: salt
2929

30-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
30+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
3131
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
3232
value: "/var/lib/registry"
33-
{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage" }}
33+
{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage" }}
3434
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.type "S3" }}
3535
- name: REGISTRY_STORAGE_S3_REGION
3636
value: "{{ .Values.virtualization.internal.moduleConfig.dvcr.storage.objectStorage.s3.region }}"
@@ -53,7 +53,7 @@ true
5353
{{- end }}
5454

5555
{{- define "dvcr.envs.garbageCollection" -}}
56-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
56+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
5757
- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
5858
value: "/var/lib/registry"
5959
{{- end }}
@@ -64,7 +64,7 @@ true
6464
- name: "dvcr-config"
6565
mountPath: "/etc/docker/registry"
6666

67-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
67+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
6868
- name: data
6969
mountPath: /var/lib/registry/
7070
{{- end }}
@@ -82,7 +82,7 @@ true
8282
{{- define "dvcr.volumeMounts.garbageCollection" -}}
8383
- name: "dvcr-config"
8484
mountPath: "/etc/docker/registry"
85-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
85+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
8686
- name: data
8787
mountPath: /var/lib/registry/
8888
{{- end }}
@@ -94,7 +94,7 @@ true
9494
configMap:
9595
name: dvcr-config
9696

97-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
97+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
9898
- name: data
9999
persistentVolumeClaim:
100100
claimName: dvcr
@@ -118,18 +118,18 @@ true
118118
replicas: 1
119119
strategy:
120120
type: Recreate
121-
{{- else if and (include "helm_lib_ha_enabled" .) (eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage") }}
121+
{{- else if and (include "helm_lib_ha_enabled" .) (eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage") }}
122122
replicas: 2
123123
strategy:
124124
type: RollingUpdate
125125
rollingUpdate:
126126
maxSurge: 0
127127
maxUnavailable: 1
128-
{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage" }}
128+
{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage" }}
129129
replicas: 1
130130
strategy:
131131
type: RollingUpdate
132-
{{- else if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
132+
{{- else if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
133133
replicas: 1
134134
strategy:
135135
type: Recreate
@@ -140,7 +140,7 @@ strategy:
140140
{{- $context := index . 0 -}}
141141
{{- $yes := index . 1 -}}
142142
{{- $no := index . 2 -}}
143-
{{- if and (include "helm_lib_ha_enabled" $context) (eq $context.Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage") }}
143+
{{- if and (include "helm_lib_ha_enabled" $context) (eq ($context.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage") }}
144144
{{- $yes -}}
145145
{{- else }}
146146
{{- $no -}}

templates/dvcr/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ spec:
3434
maxAllowed:
3535
cpu: 100m
3636
memory: 250Mi
37+
{{- if eq (include "dvcr.isGarbageCollection" . ) "true" }}
3738
- containerName: dvcr-garbage-collection
3839
minAllowed:
3940
{{- include "dvcr.resources.garbageCollection" . | nindent 8 }}
4041
maxAllowed:
4142
cpu: 100m
4243
memory: 250Mi
44+
{{- end }}
4345
{{- end }}
4446
---
4547
apiVersion: policy/v1

templates/dvcr/pvc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if eq (include "dvcr.isEnabled" . ) "true"}}
2-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "PersistentVolumeClaim" }}
2+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "PersistentVolumeClaim" }}
33
{{- $storageClassName := dig "storageClassName" "" .Values.virtualization.internal.moduleConfig.dvcr.storage.persistentVolumeClaim }}
44
kind: PersistentVolumeClaim
55
apiVersion: v1

templates/dvcr/secret.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ type: kubernetes.io/dockerconfigjson
4040
data:
4141
{{- include "dvcr.generate_dockercfg" (list . $registry "admin" .Values.virtualization.internal.dvcr.passwordRW) | nindent 2 }}
4242

43-
{{- if eq .Values.virtualization.internal.moduleConfig.dvcr.storage.type "ObjectStorage"}}
43+
{{- if eq (.Values.virtualization.internal.moduleConfig | dig "dvcr" "storage" "type" "") "ObjectStorage"}}
44+
4445
---
4546
apiVersion: v1
4647
kind: Secret

0 commit comments

Comments
 (0)