-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
helm
authored and
helm
committed
Apr 4, 2024
1 parent
478e4db
commit 9e18257
Showing
13 changed files
with
368 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
checkpoint/cloudguard/templates/imagescan/armon/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{- define "imagescan.armon.config" -}} | ||
{{- $config := (include "get.root" .) | fromYaml -}} | ||
{{- $_ := set $config "featureName" "imagescan" -}} | ||
{{- $_ := set $config "agentName" "armon" -}} | ||
{{- $_ := set $config "featureConfig" $config.Values.addons.imageScan -}} | ||
{{- /* special Case for fileaccess daemonSet name to be different than daemon*/ -}} | ||
{{- $_ := set $config "daemonConfigName" "armon" -}} | ||
{{- $_ := set $config "agentConfig" $config.Values.addons.imageScan.armon -}} | ||
{{- $config | toYaml -}} | ||
{{- end -}} |
22 changes: 22 additions & 0 deletions
22
checkpoint/cloudguard/templates/imagescan/armon/clusterrole.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: [ "pods", "nodes"] | ||
verbs: [ "list", "get" ] | ||
|
||
- apiGroups: ["apps"] | ||
resources: [ "daemonsets", "deployments", "replicasets", "statefulsets"] | ||
verbs: [ "list", "get" ] | ||
|
||
- apiGroups: [ "batch" ] | ||
resources: [ "jobs", "cronjobs" ] | ||
verbs: [ "list", "get" ] | ||
{{- end -}} |
18 changes: 18 additions & 0 deletions
18
checkpoint/cloudguard/templates/imagescan/armon/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ template "agent.resource.name" $config }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "agent.service.account.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
96 changes: 96 additions & 0 deletions
96
checkpoint/cloudguard/templates/imagescan/armon/daemonset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- /* Make ".Files" of the chart accessible and properly formatted when accessed via $config' */ -}} | ||
{{- $_ := set $config "Files" $.Files -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ include "daemonset.daemon.resource.name" $config }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{ include "common.labels" $config | indent 6 }} | ||
{{ include "daemonset.updateStrategy" $config | indent 2}} | ||
template: | ||
metadata: | ||
annotations: | ||
{{ include "common.pod.annotations" $config | indent 8 }} | ||
labels: | ||
{{ include "common.labels" $config | indent 8 }} | ||
spec: | ||
{{ include "common.pod.properties" $config | indent 6 }} | ||
containers: | ||
- name: {{ $config.agentName }} | ||
image: {{ template "agent.main.image" $config }} | ||
imagePullPolicy: {{ $config.Values.imagePullPolicy }} | ||
securityContext: | ||
{{- if contains "openshift" $config.platform }} | ||
seLinuxOptions: | ||
type: spc_t | ||
{{- end }} | ||
runAsUser: 0 | ||
capabilities: | ||
add: | ||
- SYS_RESOURCE # setrlimit | ||
- SYS_ADMIN # bpf | ||
- IPC_LOCK # lock memory for bpf kernel >= 5.11 | ||
volumeMounts: | ||
- name: secret-volume | ||
mountPath: /etc/secret-volume | ||
{{- if eq $config.containerRuntime "docker" }} | ||
- mountPath: /var/run/docker.sock | ||
name: docker-sock | ||
readOnly: true | ||
{{- else if eq $config.containerRuntime "containerd" }} | ||
- mountPath: /run/containerd/containerd.sock | ||
name: containerd-sock | ||
readOnly: true | ||
{{- else if eq $config.containerRuntime "cri-o" }} | ||
- mountPath: /var/run/crio/crio.sock | ||
name: crio-sock | ||
readOnly: true | ||
{{- end }} | ||
{{- if $config.agentConfig.resources }} | ||
resources: | ||
{{ toYaml $config.agentConfig.resources | indent 10 }} | ||
{{- end }} | ||
env: | ||
- name: REPORT_USE_DOME9_AGENT_CFG | ||
value: "1" | ||
- name: "REPORT_POST_ENDPOINT" | ||
value: "/imageaccessruntimemonitor" | ||
- name: "TELEMETRY_URL" | ||
value: "https://eptelemetry.epmgmt.checkpoint.com/gwstats/services/antimalware/1_0_0/log" | ||
- name: "CONTAINERS_RUNTIME" | ||
value: {{ $config.containerRuntime }} | ||
|
||
{{ include "common.env" $config | indent 8 }} | ||
volumes: | ||
- name: secret-volume | ||
secret: | ||
secretName: {{ template "cg.creds.secret.name" $config }} | ||
{{- if eq $config.containerRuntime "docker" }} | ||
- name: docker-sock | ||
hostPath: | ||
{{- if eq $config.platform "tanzu" }} | ||
path: /var/vcap/sys/run/docker/docker.sock | ||
{{- else }} | ||
path: /var/run/docker.sock | ||
{{- end }} | ||
type: Socket | ||
{{- else if eq $config.containerRuntime "containerd" }} | ||
- name: containerd-sock | ||
hostPath: | ||
path: {{ include "containerd.sock.path" $config }} | ||
type: Socket | ||
{{- else if eq $config.containerRuntime "cri-o" }} | ||
- name: crio-sock | ||
hostPath: | ||
path: /run/crio/crio.sock | ||
type: Socket | ||
{{- end }} | ||
--- | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
{{- if (contains "openshift" $config.platform) -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- security.openshift.io | ||
resourceNames: | ||
- {{ template "agent.resource.name" $config }} | ||
resources: | ||
- securitycontextconstraints | ||
verbs: | ||
- use | ||
{{- end -}} | ||
{{- end -}} |
20 changes: 20 additions & 0 deletions
20
checkpoint/cloudguard/templates/imagescan/armon/rolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
{{- if (contains "openshift" $config.platform) -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ template "agent.resource.name" $config }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "agent.service.account.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} | ||
{{- end -}} |
31 changes: 31 additions & 0 deletions
31
checkpoint/cloudguard/templates/imagescan/armon/securitycontextconstraints.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled -}} | ||
{{- if (contains "openshift" $config.platform) -}} | ||
apiVersion: security.openshift.io/v1 | ||
kind: SecurityContextConstraints | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
allowPrivilegedContainer: false | ||
allowHostDirVolumePlugin: true | ||
runAsUser: | ||
type: RunAsAny | ||
seLinuxContext: | ||
type: RunAsAny | ||
fsGroup: | ||
type: RunAsAny | ||
supplementalGroups: | ||
type: RunAsAny | ||
users: | ||
- system:serviceaccount | ||
allowedCapabilities: | ||
- SYS_RESOURCE | ||
- SYS_ADMIN | ||
- IPC_LOCK | ||
volumes: | ||
- hostPath | ||
- secret | ||
{{- end -}} | ||
{{- end -}} |
10 changes: 10 additions & 0 deletions
10
checkpoint/cloudguard/templates/imagescan/armon/serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{- $config := fromYaml (include "imagescan.armon.config" .) -}} | ||
{{- if and $config.featureConfig.enabled $config.agentConfig.enabled (not $config.agentConfig.serviceAccountName) -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "agent.resource.name" $config }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "common.labels.with.chart" $config | indent 4 }} | ||
{{- end -}} |
Binary file not shown.
Oops, something went wrong.