Skip to content

Commit

Permalink
drop all capabilities when CAP is not assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
mershad-manesh committed Oct 12, 2023
1 parent 756e68b commit fd6c051
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
17 changes: 13 additions & 4 deletions horizon/templates/opennms-core.statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ spec:
seccompProfile:
type: RuntimeDefault
{{- if eq (include "onOpenShift" .) "true" }}
{{- if has "CAP_NET_RAW" ((.Values.dependencies.securitycontext).allowedCapabilities) }}
capabilities:
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
add:
- CAP_NET_RAW
{{- end }}
{{- else }}
drop:
- ALL
{{- end }}
{{- end }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.core.terminationGracePeriodSeconds | default 120 }}
Expand Down Expand Up @@ -98,10 +101,13 @@ spec:
seccompProfile:
type: RuntimeDefault
{{- if eq (include "onOpenShift" .) "true" }}
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
capabilities:
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
add:
- CAP_NET_RAW
{{- else }}
drop:
- ALL
{{- end }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -139,10 +145,13 @@ spec:
seccompProfile:
type: RuntimeDefault
{{- if eq (include "onOpenShift" .) "true" }}
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
capabilities:
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
add:
- CAP_NET_RAW
{{- else }}
drop:
- ALL
{{- end }}
{{- end }}
{{- end }}
Expand Down
9 changes: 8 additions & 1 deletion horizon/templates/opennms-sentinel.statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ spec:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
{{- if eq (include "onOpenShift" .) "true" }}
capabilities:
{{- if has "CAP_NET_RAW" (.Values.dependencies.securitycontext).allowedCapabilities }}
add:
- NET_RAW
- CAP_NET_RAW
{{- else }}
drop:
- ALL
{{- end }}
{{- end }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.sentinel.terminationGracePeriodSeconds | default 60 }}
{{- if .Values.imagePullSecrets }}
Expand Down
3 changes: 3 additions & 0 deletions minion/templates/minion-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spec:
capabilities:
add:
- CAP_NET_RAW
{{- else }}
drop:
- ALL
{{- end }}
{{- end }}
{{- end }}
Expand Down

0 comments on commit fd6c051

Please sign in to comment.