Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
56 changes: 56 additions & 0 deletions charts/core/templates/crd-role-least.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,60 @@ userNames:
- system:serviceaccount:{{ .Release.Namespace }}:controller
{{- end }}

---

# ClusterRole for NeuVector to manage fed configurations
{{- if $oc3 }}
apiVersion: authorization.openshift.io/v1
{{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: rbac.authorization.k8s.io/v1
{{- else }}
apiVersion: v1
{{- end }}
kind: ClusterRole
metadata:
name: neuvector-binding-nvconfigsecurityrules
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
rules:
- apiGroups:
- neuvector.com
resources:
- nvconfigsecurityrules
verbs:
- get
- list
- delete

---

# ClusterRoleBinding for NeuVector to manage fed configurations
{{- if $oc3 }}
apiVersion: authorization.openshift.io/v1
{{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: rbac.authorization.k8s.io/v1
{{- else }}
apiVersion: v1
{{- end }}
kind: ClusterRoleBinding
metadata:
name: neuvector-binding-nvconfigsecurityrules
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
roleRef:
{{- if not $oc3 }}
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
{{- end }}
name: neuvector-binding-nvconfigsecurityrules
subjects:
- kind: ServiceAccount
name: controller
namespace: {{ .Release.Namespace }}
{{- if $oc3 }}
userNames:
- system:serviceaccount:{{ .Release.Namespace }}:controller
{{- end }}
{{- end }}
57 changes: 57 additions & 0 deletions charts/core/templates/crd-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,61 @@ subjects:
userNames:
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Values.serviceAccount }}
{{- end }}

---

# ClusterRole for NeuVector to manage fed configurations
{{- if $oc3 }}
apiVersion: authorization.openshift.io/v1
{{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: rbac.authorization.k8s.io/v1
{{- else }}
apiVersion: v1
{{- end }}
kind: ClusterRole
metadata:
name: neuvector-binding-nvconfigsecurityrules
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
rules:
- apiGroups:
- neuvector.com
resources:
- nvconfigsecurityrules
verbs:
- get
- list
- delete

---

# Clusterrolebinding for Neuvector to manage fed configurations
{{- if $oc3 }}
apiVersion: authorization.openshift.io/v1
{{- else if (semverCompare ">=1.8-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: rbac.authorization.k8s.io/v1
{{- else }}
apiVersion: v1
{{- end }}
kind: ClusterRoleBinding
metadata:
name: neuvector-binding-nvconfigsecurityrules
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
roleRef:
{{- if not $oc3 }}
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
{{- end }}
name: neuvector-binding-nvconfigsecurityrules
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount }}
namespace: {{ .Release.Namespace }}
{{- if $oc3 }}
userNames:
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Values.serviceAccount }}
{{- end }}
{{- end }}
55 changes: 55 additions & 0 deletions charts/core/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,4 +1234,59 @@ spec:
type: object
type: object
{{- end }}
---
{{- if (semverCompare ">=1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: apiextensions.k8s.io/v1
{{- else }}
apiVersion: apiextensions.k8s.io/v1beta1
{{- end }}
kind: CustomResourceDefinition
metadata:
name: nvconfigsecurityrules.neuvector.com
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
spec:
group: neuvector.com
names:
kind: NvConfigSecurityRule
listKind: NvConfigSecurityRuleList
plural: nvconfigsecurityrules
singular: nvsystemconfiguration
scope: Cluster
{{- if (semverCompare "<1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
version: v1
{{- end }}
versions:
- name: v1
served: true
storage: true
{{- if (semverCompare ">=1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
schema:
openAPIV3Schema:
properties:
spec:
properties:
webhooks:
items:
properties:
enable:
type: boolean
name:
type: string
type:
type: string
url:
type: string
format: uri
use_proxy:
type: boolean
required:
- name
- url
type: object
type: array
type: object
type: object
{{- end }}
{{- end }}
56 changes: 56 additions & 0 deletions charts/crd/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1242,3 +1242,59 @@ spec:
type: object
type: object
{{- end }}
---
{{- if (semverCompare ">=1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
apiVersion: apiextensions.k8s.io/v1
{{- else }}
apiVersion: apiextensions.k8s.io/v1beta1
{{- end }}
kind: CustomResourceDefinition
metadata:
name: nvconfigsecurityrules.neuvector.com
labels:
chart: {{ template "neuvector.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: neuvector.com
names:
kind: NvConfigSecurityRule
listKind: NvConfigSecurityRuleList
plural: nvconfigsecurityrules
singular: nvsystemconfiguration
scope: Cluster
{{- if (semverCompare "<1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
version: v1
{{- end }}
versions:
- name: v1
served: true
storage: true
{{- if (semverCompare ">=1.19-0" (substr 1 -1 .Capabilities.KubeVersion.GitVersion)) }}
schema:
openAPIV3Schema:
properties:
spec:
properties:
webhooks:
items:
properties:
enable:
type: boolean
name:
type: string
type:
type: string
url:
type: string
format: uri
use_proxy:
type: boolean
required:
- name
- url
type: object
type: array
type: object
type: object
{{- end }}
4 changes: 2 additions & 2 deletions test/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestCRD(t *testing.T) {
out := helm.RenderTemplate(t, options, helmChartPath, nvRel, []string{"templates/crd.yaml"})
outs := splitYaml(out)

if len(outs) != 9 {
if len(outs) != 10 {
t.Errorf("Resource count is wrong. count=%v\n", len(outs))
}
}
Expand All @@ -33,7 +33,7 @@ func TestCoreCRD(t *testing.T) {
out := helm.RenderTemplate(t, options, helmChartPath, nvRel, []string{"templates/crd.yaml"})
outs := splitYaml(out)

if len(outs) != 9 {
if len(outs) != 10 {
t.Errorf("Resource count is wrong. count=%v\n", len(outs))
}
}
Expand Down
Loading