-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2208 from kubecost/v1.103-patch/ev-59-query-servi…
…ce-replicas Cherry pick EV-59 for v1.103
- Loading branch information
Showing
8 changed files
with
348 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
cost-analyzer/templates/query-service-cluster-role-binding-template.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,34 @@ | ||
{{- if and (not .Values.agent) (not .Values.cloudAgent) (.Values.kubecostDeployment) (.Values.kubecostDeployment.queryServiceReplicas) }} | ||
{{- if gt .Values.kubecostDeployment.queryServiceReplicas 0 }} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} | ||
{{- end }} |
109 changes: 109 additions & 0 deletions
109
cost-analyzer/templates/query-service-cluster-role-template.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,109 @@ | ||
{{- if and (not .Values.agent) (not .Values.cloudAgent) (.Values.kubecostDeployment) (.Values.kubecostDeployment.queryServiceReplicas) }} | ||
{{- if gt .Values.kubecostDeployment.queryServiceReplicas 0 }} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
namespace: {{ .Release.Namespace }} | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- "pods/log" | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- configmaps | ||
- deployments | ||
- nodes | ||
- pods | ||
- events | ||
- services | ||
- resourcequotas | ||
- replicationcontrollers | ||
- limitranges | ||
- persistentvolumeclaims | ||
- persistentvolumes | ||
- namespaces | ||
- endpoints | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- extensions | ||
resources: | ||
- daemonsets | ||
- deployments | ||
- replicasets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- statefulsets | ||
- deployments | ||
- daemonsets | ||
- replicasets | ||
verbs: | ||
- list | ||
- watch | ||
- apiGroups: | ||
- batch | ||
resources: | ||
- cronjobs | ||
- jobs | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- autoscaling | ||
resources: | ||
- horizontalpodautoscalers | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- policy | ||
resources: | ||
- poddisruptionbudgets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- storage.k8s.io | ||
resources: | ||
- storageclasses | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- events.k8s.io | ||
resources: | ||
- events | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
{{- end }} | ||
{{- end }} |
107 changes: 107 additions & 0 deletions
107
cost-analyzer/templates/query-service-deployment-template.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,107 @@ | ||
{{- if and (not .Values.agent) (not .Values.cloudAgent) (.Values.kubecostDeployment) (.Values.kubecostDeployment.queryServiceReplicas) }} | ||
{{- if gt .Values.kubecostDeployment.queryServiceReplicas 0 }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "query-service.fullname" . }} | ||
namespace: {{ .Release.Name }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.kubecostDeployment.queryServiceReplicas }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: query-service | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app: query-service | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: query-service | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app: query-service | ||
spec: | ||
restartPolicy: Always | ||
serviceAccountName: {{ template "query-service.serviceAccountName" . }} | ||
volumes: | ||
- name: persistent-configs | ||
emptyDir: {} | ||
- name: persistent-db | ||
emptyDir: {} | ||
{{- $etlBackupBucketSecret := "" }} | ||
{{- if .Values.kubecostModel.etlBucketConfigSecret }} | ||
{{- $etlBackupBucketSecret = .Values.kubecostModel.etlBucketConfigSecret }} | ||
{{- else if and .Values.global.thanos.enabled (ne (typeOf .Values.kubecostModel.etlBucketConfigSecret) "string") }} | ||
{{- $etlBackupBucketSecret = .Values.thanos.storeSecretName }} | ||
{{- end }} | ||
{{- if $etlBackupBucketSecret }} | ||
- name: etl-bucket-config | ||
secret: | ||
defaultMode: 420 | ||
secretName: {{ $etlBackupBucketSecret }} | ||
{{- end }} | ||
initContainers: | ||
- name: config-db-perms-fix | ||
image: busybox | ||
command: ["sh", "-c", "/bin/chmod -R 777 /var/configs && /bin/chmod -R 777 /var/db"] | ||
volumeMounts: | ||
- name: persistent-configs | ||
mountPath: /var/configs | ||
- name: persistent-db | ||
mountPath: /var/db | ||
securityContext: | ||
runAsUser: 0 | ||
containers: | ||
- name: query-service | ||
{{- if .Values.kubecostModel }} | ||
{{- if .Values.kubecostModel.openSourceOnly }} | ||
image: quay.io/kubecost1/kubecost-cost-model:{{ .Values.imageVersion }} | ||
{{- 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: 9003 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 | ||
failureThreshold: 200 | ||
imagePullPolicy: Always | ||
args: ["query-service"] | ||
ports: | ||
- name: tcp-model | ||
containerPort: 9003 | ||
protocol: TCP | ||
volumeMounts: | ||
- name: persistent-configs | ||
mountPath: /var/configs | ||
- name: etl-bucket-config | ||
mountPath: /var/configs/etl | ||
- name: persistent-db | ||
mountPath: /var/db | ||
env: | ||
- name: CONFIG_PATH | ||
value: /var/configs/ | ||
- name: DB_PATH | ||
value: /var/db/ | ||
- name: ETL_FILE_STORE_ENABLED | ||
value: "true" | ||
{{- if $etlBackupBucketSecret }} | ||
- name: ETL_BUCKET_CONFIG | ||
value: "/var/configs/etl/object-store.yaml" | ||
{{- end }} | ||
- name: ETL_TO_DISK_ENABLED | ||
value: "true" | ||
- name: ETL_PATH_PREFIX | ||
value: "/var/db" | ||
- name: CLOUD_PROVIDER_API_KEY | ||
value: "AIzaSyDXQPG_MHUEy9neR7stolq6l0ujXmjJlvk" # The GCP Pricing API key.This GCP api key is expected to be here and is limited to accessing google's billing API.' | ||
{{- end }} | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
cost-analyzer/templates/query-service-service-account-template.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,17 @@ | ||
{{- if and (not .Values.agent) (not .Values.cloudAgent) (.Values.kubecostDeployment) (.Values.kubecostDeployment.queryServiceReplicas) }} | ||
{{- if gt .Values.kubecostDeployment.queryServiceReplicas 0 }} | ||
{{- if .Values.serviceAccount.create }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "query-service.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "query-service.commonLabels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.