Skip to content

Commit

Permalink
[stable/insights-agent] Google Cloud Credentials bug fix (#1381)
Browse files Browse the repository at this point in the history
* Fixing service name

* Google cloud crendentials bug fix

* Fixing issues

* Fixing issues

* Fixing issues

* Fixed issues

* Fixed issues

* Fixed log

* Bug fix

* Some fixes

* Fixed directories

* Fixed issue
  • Loading branch information
jdesouza authored Nov 29, 2023
1 parent de6a33a commit f81f164
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
3 changes: 3 additions & 0 deletions stable/insights-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2.25.2
* Cloud costs - google credentials bug fix

## 2.25.1
* Cloud costs plugin bug fix

Expand Down
2 changes: 1 addition & 1 deletion stable/insights-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart to run the Fairwinds Insights agent
name: insights-agent
version: 2.25.1
version: 2.25.2
appVersion: 9.2.1
kubeVersion: ">= 1.22.0-0"
icon: https://raw.githubusercontent.com/FairwindsOps/charts/master/stable/insights-agent/icon.png
Expand Down
28 changes: 22 additions & 6 deletions stable/insights-agent/templates/cloud-costs/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ spec:
{{ include "job-spec-metadata" . | nindent 8 | trim }}
spec:
{{ include "job-template-spec" . | indent 10 | trim }}
{{- if eq .Values.cloudcosts.provider "gcp" }}
- name: cloudcosts-secret-volume
secret:
secretName: {{ .Values.cloudcosts.secretName }}
- name: gcpconfig
emptyDir: {}
- name: gcplogs
emptyDir: {}
{{- end }}
{{- if eq .Values.cloudcosts.provider "aws" }}
- name: creds
emptyDir: {}
{{- end }}
containers:
{{- if .Values.cloudcosts.secretName }}
- {{ include "container-spec" . | indent 12 | trim }}
{{- if eq .Values.cloudcosts.provider "aws" }}
- name: creds
mountPath: /.aws
env:
{{- if eq .Values.cloudcosts.provider "aws" }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
Expand All @@ -35,6 +46,8 @@ spec:
{{ include "proxy-env-spec" . | indent 12 | trim }}
command: ["./cloud-costs.sh"]
args:
- --provider
- aws
- --database
- {{ required "You must set cloudcosts.aws.database, please see https://insights.docs.fairwinds.com/technical-details/reports/aws-costs/#agent-configuration" .Values.cloudcosts.aws.database }}
- --table
Expand All @@ -51,14 +64,17 @@ spec:
{{ include "uploaderContainer" . | indent 10 | trim }}
{{- end }}
{{- if eq .Values.cloudcosts.provider "gcp" }}
- name: GOOGLE_APPLICATION_CREDENTIALS
valueFrom:
secretKeyRef:
name: {{ .Values.cloudcosts.secretName }}
key: GOOGLE_APPLICATION_CREDENTIALS
{{ include "proxy-env-spec" . | indent 12 | trim }}
- name: cloudcosts-secret-volume
mountPath: "/.config"
- name: gcpconfig
mountPath: /.config/gcloud/credentials
- name: gcplogs
mountPath: /.config/gcloud
command: ["./cloud-costs.sh"]
args:
- --provider
- gcp
{{- if .Values.cloudcosts.tagkey }}
- --tagkey
- {{ .Values.cloudcosts.tagkey }}
Expand Down
2 changes: 1 addition & 1 deletion stable/insights-agent/templates/cloud-costs/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "insights-agent.fullname" . }}-cloud-costs
name: {{ include "insights-agent.fullname" . }}-cloudcosts
labels:
app: insights-agent
{{- with .Values.cloudcosts.serviceAccount.annotations }}
Expand Down
3 changes: 2 additions & 1 deletion stable/insights-agent/templates/cloud-costs/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ metadata:
name: {{ .Values.cloudcosts.secretName }}
type: Opaque
data:
GOOGLE_APPLICATION_CREDENTIALS: {{ .Values.cloudcosts.gcp.applicationCredentials | b64enc}}
gcp-key.json: |
{{ .Values.cloudcosts.gcp.applicationCredentials | b64enc}}
{{ end }}
{{- end -}}

0 comments on commit f81f164

Please sign in to comment.