Skip to content

Commit

Permalink
Merge pull request #95 from becitsthere/master
Browse files Browse the repository at this point in the history
Support neuvector images on registry.neuvector.com
  • Loading branch information
becitsthere authored May 26, 2021
2 parents ad6146c + 24193b8 commit 62d40a3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/core/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ spec:
serviceAccount: {{ .Values.serviceAccount }}
containers:
- name: neuvector-controller-pod
{{ if eq .Values.registry "registry.neuvector.com" }}
image: "{{ .Values.registry }}/controller:{{ .Values.tag }}"
{{- else }}
image: "{{ .Values.registry }}/{{ .Values.controller.image.repository }}:{{ .Values.tag }}"
{{- end }}
securityContext:
privileged: true
resources:
Expand Down
4 changes: 4 additions & 0 deletions charts/core/templates/enforcer-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ spec:
serviceAccount: {{ .Values.serviceAccount }}
containers:
- name: neuvector-enforcer-pod
{{ if eq .Values.registry "registry.neuvector.com" }}
image: "{{ .Values.registry }}/enforcer:{{ .Values.tag }}"
{{- else }}
image: "{{ .Values.registry }}/{{ .Values.enforcer.image.repository }}:{{ .Values.tag }}"
{{- end }}
securityContext:
privileged: true
resources:
Expand Down
4 changes: 4 additions & 0 deletions charts/core/templates/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ spec:
serviceAccount: {{ .Values.serviceAccount }}
containers:
- name: neuvector-manager-pod
{{ if eq .Values.registry "registry.neuvector.com" }}
image: "{{ .Values.registry }}/manager:{{ .Values.tag }}"
{{- else }}
image: "{{ .Values.registry }}/{{ .Values.manager.image.repository }}:{{ .Values.tag }}"
{{- end }}
env:
- name: CTRL_SERVER_IP
value: neuvector-svc-controller.{{ .Release.Namespace }}
Expand Down
4 changes: 4 additions & 0 deletions charts/core/templates/scanner-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ spec:
serviceAccount: {{ .Values.serviceAccount }}
containers:
- name: neuvector-scanner-pod
{{ if eq .Values.registry "registry.neuvector.com" }}
image: "{{ .Values.registry }}/scanner:{{ .Values.tag }}"
{{- else }}
image: "{{ .Values.registry }}/{{ .Values.cve.scanner.image.repository }}:{{ .Values.cve.scanner.image.tag }}"
{{- end }}
imagePullPolicy: Always
env:
- name: CLUSTER_JOIN_ADDR
Expand Down
4 changes: 4 additions & 0 deletions charts/core/templates/updater-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ spec:
serviceAccount: {{ .Values.serviceAccount }}
containers:
- name: neuvector-updater-pod
{{ if eq .Values.registry "registry.neuvector.com" }}
image: "{{ .Values.registry }}/updater:{{ .Values.tag }}"
{{- else }}
image: "{{ .Values.registry }}/{{ .Values.cve.updater.image.repository }}:{{ .Values.cve.updater.image.tag }}"
{{- end }}
imagePullPolicy: Always
{{- if .Values.cve.scanner.enabled }}
lifecycle:
Expand Down
24 changes: 24 additions & 0 deletions test/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ func TestControllerDeployment(t *testing.T) {
}
}

func TestControllerDeploymentRegistry(t *testing.T) {
helmChartPath := "../charts/core"

options := &helm.Options{
SetValues: map[string]string{
"registry": "registry.neuvector.com",
},
}

// Test ingress
out := helm.RenderTemplate(t, options, helmChartPath, []string{"templates/controller-deployment.yaml"})
outs := splitYaml(out)

if len(outs) != 1 {
t.Errorf("Resource count is wrong. count=%v\n", len(outs))
}

var dep appsv1.Deployment
helm.UnmarshalK8SYaml(t, outs[0], &dep)
if dep.Spec.Template.Spec.Containers[0].Image != "registry.neuvector.com/controller:latest" {
t.Errorf("Image location is wrong, %v\n", dep.Spec.Template.Spec.Containers[0].Image)
}
}

func TestControllerDeploymentCert(t *testing.T) {
helmChartPath := "../charts/core"

Expand Down

0 comments on commit 62d40a3

Please sign in to comment.