-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Kubecost aggregator (#2623)
* Initial Waterfowl config based on QSR Signed-off-by: Michael Dresser <[email protected]> * Tune waterfowl PVs and bucket configs * Move waterfowl values out of kubecostDeployment * Add fullImageName override to waterfowl * Fix waterfowl ports to 9004 * Fix secret mode, env vars, unset DB_ envs * support asset endpoints * add assets graph endpoint to proxy * Add /savings/requestSizingV2 proxy to Waterfowl * Add request sizing V2 topline to waterfowl proxy (#2541) Signed-off-by: Michael Dresser <[email protected]> * Add proxy rules for Cloud Cost api * Cloud Cost pod templates Signed-off-by: Sean Holcomb <[email protected]> * setup waterfowl savings proxy on cfrontend config map Signed-off-by: Alan Rodrigues <[email protected]> * add /savings/abandonedWorkloads proxy for waterfowl (#2599) * Added /model/reports proxy to Waterfowl. * Added KUBECOST_NAMESPACE env to waterfowl-deployment.yaml. * Added WATERFOWL_ENABLED to cost analyzer deployment. * provide reasonable default * Added /model/budget(s) proxies to Waterfowl. * Fixed Waterfowl /reports proxies. * rename all external naming/config to query handler * rename to 'kubecost aggregator' * fix missed rename targets * rename files * fix naming * remove initContainer / add securityContexts (#2628) * code review comments * remove obsolete role/rolebinding * statefulset * first batch of code review fixes * toss out role, update svc * template rendering passing * strip SA token, formatting fix * punctuation, missing vals * selector app name consistency * Revert "toss out role, update svc" This reverts commit bf2d082. * re add svc template * rm svc acct token unmount * resolve outstanding code review items * additional code review fixes --------- Signed-off-by: Michael Dresser <[email protected]> Signed-off-by: Sean Holcomb <[email protected]> Signed-off-by: Alan Rodrigues <[email protected]> Co-authored-by: Michael Dresser <[email protected]> Co-authored-by: Sean Holcomb <[email protected]> Co-authored-by: Alan Rodrigues <[email protected]> Co-authored-by: Nik Willwerth <[email protected]> Co-authored-by: nik-kc <[email protected]> Co-authored-by: Jesse Goodier <[email protected]>
- Loading branch information
1 parent
b4418c6
commit dba3f28
Showing
12 changed files
with
916 additions
and
25 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
140 changes: 140 additions & 0 deletions
140
cost-analyzer/templates/aggregator-cloud-cost-deployment.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,140 @@ | ||
{{- if .Values.kubecostAggregator.cloudCost.enabled }} | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "cloudCost.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "cloudCost.commonLabels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
{{ include "cloudCost.selectorLabels" . | nindent 6 }} | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: cloud-cost | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app: cloud-cost | ||
spec: | ||
restartPolicy: Always | ||
serviceAccountName: {{ template "cloudCost.serviceAccountName" . }} | ||
volumes: | ||
{{- if .Values.kubecostModel.etlBucketConfigSecret }} | ||
- name: etl-bucket-config | ||
secret: | ||
defaultMode: 420 | ||
secretName: {{ .Values.kubecostModel.etlBucketConfigSecret }} | ||
{{- end }} | ||
{{- if .Values.kubecostModel.federatedStorageConfigSecret }} | ||
- name: federated-storage-config | ||
secret: | ||
defaultMode: 420 | ||
secretName: {{ .Values.kubecostModel.federatedStorageConfigSecret }} | ||
{{- end }} | ||
{{- if .Values.kubecostProductConfigs.cloudIntegrationSecret }} | ||
- name: cloud-integration | ||
secret: | ||
secretName: {{ .Values.kubecostProductConfigs.cloudIntegrationSecret }} | ||
items: | ||
- key: cloud-integration.json | ||
path: cloud-integration.json | ||
{{- else }} | ||
{{- fail "Cloud Cost requires configuration secret" }} | ||
{{- end }} | ||
containers: | ||
- name: cloud-cost | ||
{{- if .Values.kubecostModel }} | ||
{{- if .Values.kubecostModel.openSourceOnly }} | ||
{{- fail "Kubecost Aggregator cannot be used with open source only" }} | ||
{{- else if .Values.kubecostAggregator.fullImageName }} | ||
image: {{ .Values.kubecostAggregator.fullImageName }} | ||
{{- else if .Values.kubecostModel.fullImageName }} | ||
image: {{ .Values.kubecostModel.fullImageName }} | ||
{{- else if .Values.imageVersion }} | ||
image: {{ .Values.kubecostModel.image }}:{{ .Values.imageVersion }} | ||
{{- else }} | ||
image: {{ .Values.kubecostModel.image }}:prod-{{ $.Chart.AppVersion }} | ||
{{ end }} | ||
{{- else }} | ||
image: gcr.io/kubecost1/cost-model:prod-{{ $.Chart.AppVersion }} | ||
{{ end }} | ||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 9005 | ||
initialDelaySeconds: 10 | ||
periodSeconds: 5 | ||
failureThreshold: 200 | ||
imagePullPolicy: Always | ||
args: ["cloud-cost"] | ||
ports: | ||
- name: tcp-api | ||
containerPort: 9005 | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.kubecostAggregator.cloudCost.resources | nindent 12 }} | ||
volumeMounts: | ||
{{- if .Values.kubecostModel.federatedStorageConfigSecret }} | ||
- name: federated-storage-config | ||
mountPath: /var/configs/etl/federated | ||
readOnly: true | ||
{{- end }} | ||
{{- if .Values.kubecostModel.etlBucketConfigSecret }} | ||
- name: etl-bucket-config | ||
mountPath: /var/configs/etl | ||
readOnly: true | ||
{{- end }} | ||
{{- if .Values.kubecostProductConfigs.cloudIntegrationSecret }} | ||
- name: cloud-integration | ||
mountPath: /var/configs/cloud-integration | ||
{{- end }} | ||
env: | ||
- name: CONFIG_PATH | ||
value: /var/configs/ | ||
{{- if .Values.kubecostModel.etlBucketConfigSecret }} | ||
- name: ETL_BUCKET_CONFIG | ||
value: "/var/configs/etl/object-store.yaml" | ||
{{- end}} | ||
{{- if .Values.kubecostModel.federatedStorageConfigSecret }} | ||
- name: FEDERATED_STORE_CONFIG | ||
value: "/var/configs/etl/federated/federated-store.yaml" | ||
- name: FEDERATED_CLUSTER | ||
value: "true" | ||
{{- end}} | ||
{{- range $key, $value := .Values.kubecostAggregator.cloudCost.env }} | ||
- name: {{ $key | quote }} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
|
||
|
||
{{- if .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{ toYaml .Values.imagePullSecrets | indent 2 }} | ||
{{- end }} | ||
{{- if .Values.kubecostAggregator.priority }} | ||
{{- if .Values.kubecostAggregator.priority.enabled }} | ||
{{- if .Values.kubecostAggregator.priority.name }} | ||
priorityClassName: {{ .Values.kubecostAggregator.priority.name }} | ||
{{- else }} | ||
priorityClassName: {{ template "cost-analyzer.fullname" . }}-aggregator-priority | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.kubecostAggregator.cloudCost.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.kubecostAggregator.cloudCost.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.kubecostAggregator.cloudCost.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
16 changes: 16 additions & 0 deletions
16
cost-analyzer/templates/aggregator-cloud-cost-service-account.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,16 @@ | ||
{{- if .Values.kubecostAggregator.cloudCost.enabled }} | ||
|
||
{{- if .Values.serviceAccount.create }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "cloudCost.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "cloudCost.commonLabels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
18 changes: 18 additions & 0 deletions
18
cost-analyzer/templates/aggregator-cloud-cost-service.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 @@ | ||
{{- if .Values.kubecostAggregator.cloudCost.enabled }} | ||
|
||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ template "cloudCost.serviceName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "cloudCost.commonLabels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
{{ include "cloudCost.selectorLabels" . | nindent 4 }} | ||
type: "ClusterIP" | ||
ports: | ||
- name: tcp-api | ||
port: 9005 | ||
targetPort: 9005 | ||
{{- end }} |
Oops, something went wrong.