Skip to content

Commit

Permalink
Merge pull request #733 from kubecost/AjayTripathy-default-run-nonroot
Browse files Browse the repository at this point in the history
default run as nonroot
  • Loading branch information
AjayTripathy authored Jan 22, 2021
2 parents 2588c8e + d4d9791 commit bef22da
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
14 changes: 7 additions & 7 deletions cost-analyzer/charts/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ alertmanager:
## Security context to be added to alertmanager pods
##
securityContext:
runAsUser: 65534
runAsUser: 1001
runAsNonRoot: true
runAsGroup: 65534
fsGroup: 65534
runAsGroup: 1001
fsGroup: 1001

service:
annotations: {}
Expand Down Expand Up @@ -856,10 +856,10 @@ server:
## Security context to be added to server pods
##
securityContext:
runAsUser: 65534
runAsUser: 1001
runAsNonRoot: true
runAsGroup: 65534
fsGroup: 65534
runAsGroup: 1001
fsGroup: 1001

service:
annotations: {}
Expand Down Expand Up @@ -1016,7 +1016,7 @@ pushgateway:
## Security context to be added to push-gateway pods
##
securityContext:
runAsUser: 65534
runAsUser: 1001
runAsNonRoot: true

service:
Expand Down
30 changes: 25 additions & 5 deletions cost-analyzer/charts/thanos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ store:
# hosts:
# - chart-example.local
# Optional securityContext
securityContext: {}
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 1001

resources: {}
# limits:
# cpu: 2000m
Expand Down Expand Up @@ -265,7 +269,11 @@ queryFrontend:
labels: {}

# Optional securityContext
securityContext: {}
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 1001

resources: {}
# limits:
# cpu: 2000m
Expand Down Expand Up @@ -424,7 +432,11 @@ query:
labels: {}

# Optional securityContext
securityContext: {}
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 1001

resources: {}
# limits:
# cpu: 2000m
Expand Down Expand Up @@ -547,7 +559,11 @@ compact:
serviceAccount: ""

# Optional securityContext
securityContext: {}
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 1001

resources: {}
# limits:
# cpu: 2000m
Expand Down Expand Up @@ -646,7 +662,11 @@ bucket:
# maxUnavailable: 50%

# Optional securityContext
securityContext: {}
securityContext:
fsGroup: 1001
runAsNonRoot: true
runAsUser: 1001

resources: {}
# limits:
# cpu: 2000m
Expand Down
3 changes: 3 additions & 0 deletions cost-analyzer/templates/cost-analyzer-checks-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@ spec:
{{ toYaml .Values.imagePullSecrets | indent 2 }}
{{- end }}
restartPolicy: OnFailure
securityContext:
runAsNonRoot: true
runAsUser: 1001
{{- end -}}
{{- end -}}
6 changes: 1 addition & 5 deletions cost-analyzer/templates/cost-analyzer-psp.template.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{{- if .Values.podSecurityPolicy }}
{{- if .Values.podSecurityPolicy.enabled }}
apiVersion: {{ include "cost-analyzer.podSecurityPolicy.apiVersion" . }}
kind: PodSecurityPolicy
metadata:
name: kubecost-cost-analyzer-psp
spec:
privileged: true
privileged: false
seLinux:
rule: RunAsAny
supplementalGroups:
Expand All @@ -16,5 +14,3 @@ spec:
rule: RunAsAny
volumes:
- '*'
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions cost-analyzer/values-thanos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ prometheus:
storage.tsdb.min-block-duration: 2h
storage.tsdb.max-block-duration: 2h
storage.tsdb.retention: 2w
securityContext:
runAsNonRoot: true
runAsUser: 1001
extraVolumes:
- name: object-store-volume
secret:
Expand All @@ -26,6 +29,9 @@ prometheus:
sidecarContainers:
- name: thanos-sidecar
image: thanosio/thanos:v0.15.0
securityContext:
runAsNonRoot: true
runAsUser: 1001
args:
- sidecar
- --log.level=debug
Expand Down
2 changes: 1 addition & 1 deletion cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ prometheusRule:
enabled: false
additionalLabels: {}

supportNFS: true
supportNFS: false
# initChownDataImage ensures all Kubecost filepath permissions on PV or local storage are set up correctly.
initChownDataImage: "busybox" # Supports a fully qualified Docker image, e.g. registry.hub.docker.com/library/busybox:latest
initChownData:
Expand Down

0 comments on commit bef22da

Please sign in to comment.