Skip to content

Commit

Permalink
Add PV for kubecost-cost-analyzer-db
Browse files Browse the repository at this point in the history
  • Loading branch information
nikovacevic committed Sep 30, 2020
1 parent 752b584 commit eb1e735
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Parameter | Description | Default
`prometheus.pushgateway.persistentVolume.enabled` | If true, Prometheus Pushgateway will create a Persistent Volume Claim. | `true`
`persistentVolume.enabled` | If true, Kubecost will create a Persistent Volume Claim for product config data. | `true`
`persistentVolume.size` | Define PVC size for cost-analyzer | `0.2Gi`
`persistentVolume.dbSize` | Define PVC size for cost-analyzer's flat file database | `32.0Gi`
`ingress.enabled` | If true, Ingress will be created | `false`
`ingress.annotations` | Ingress annotations | `{}`
`ingress.paths` | Ingress paths | `["/"]`
Expand Down
36 changes: 36 additions & 0 deletions cost-analyzer/templates/cost-analyzer-deployment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ spec:
{{- else }}
persistentVolumeClaim:
claimName: {{ template "cost-analyzer.fullname" . }}
{{- end }}
- name: persistent-db
{{- if .Values.persistentVolume }}
{{- if .Values.persistentVolume.enabled }}
persistentVolumeClaim:
{{- if .Values.persistentVolume.existingClaim }}
claimName: {{ .Values.persistentVolume.existingClaim }}
{{- else }}
claimName: {{ template "cost-analyzer.fullname" . }}-db
{{- end -}}
{{- else }}
emptyDir: {}
{{- end -}}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "cost-analyzer.fullname" . }}-db
{{- end }}
initContainers:
{{- if .Values.supportNFS }}
Expand All @@ -162,6 +178,22 @@ spec:
mountPath: /var/configs
securityContext:
runAsUser: 0
{{ end }}
{{- if .Values.supportNFS }}
- name: db-perms-fix
{{- if .Values.initChownDataImage }}
image: {{ .Values.initChownDataImage }}
{{- else }}
image: busybox
{{- end }}
resources:
{{ toYaml .Values.initChownData.resources | indent 12 }}
command: ["/bin/chmod", "-R", "777", "/var/db"]
volumeMounts:
- name: persistent-db
mountPath: /var/db
securityContext:
runAsUser: 0
{{ end }}
containers:
{{- if .Values.kubecostModel }}
Expand Down Expand Up @@ -191,6 +223,8 @@ spec:
volumeMounts:
- name: persistent-configs
mountPath: /var/configs
- name: persistent-db
mountPath: /var/db
{{- if .Values.kubecostProductConfigs }}
{{- if .Values.kubecostProductConfigs.gcpSecretName }}
- name: gcp-key-secret
Expand Down Expand Up @@ -241,6 +275,8 @@ spec:
value: /var/configs/key.json
- name: CONFIG_PATH
value: /var/configs/
- name: DB_PATH
value: /var/db/
- name: CLUSTER_PROFILE
{{- if .Values.kubecostProductConfigs }}
value: {{ .Values.kubecostProductConfigs.clusterProfile | default "production" }}
Expand Down
1 change: 1 addition & 0 deletions cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ podSecurityPolicy:
# Define persistence volume for cost-analyzer
persistentVolume:
size: 0.2Gi
dbSize: 32.0Gi
enabled: true # Note that setting this to false means configurations will be wiped out on pod restart.
# storageClass: "-" #
# existingClaim: kubecost-cost-analyzer # a claim in the same namespace as kubecost
Expand Down

0 comments on commit eb1e735

Please sign in to comment.