Skip to content

Commit

Permalink
add systemProxy env vars (#2687)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegoodier committed Oct 27, 2023
1 parent f443a62 commit 0786ecd
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
47 changes: 46 additions & 1 deletion cost-analyzer/templates/cost-analyzer-deployment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,21 @@ spec:
args:
- "--web.listen-address=:{{ .Values.global.gmp.gmpProxy.port }}"
- "--query.project-id={{ .Values.global.gmp.gmpProxy.projectId }}"
{{- if .Values.systemProxy.enabled }}
env:
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
ports:
- name: web
containerPort: {{ .Values.global.gmp.gmpProxy.port | int }}
Expand Down Expand Up @@ -375,15 +390,45 @@ spec:
ports:
- name: aws-sigv4-proxy
containerPort: {{ .Values.sigV4Proxy.port | int }}
{{- if .Values.sigV4Proxy.extraEnv }}
env:
- name: AGENT_LOCAL_PORT
value: "{{ .Values.sigV4Proxy.port | int }}"
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
{{- if .Values.sigV4Proxy.extraEnv }}
{{- toYaml .Values.sigV4Proxy.extraEnv | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.global.gcpstore.enabled }}
- name: ubbagent
image: gcr.io/kubecost1/gcp-mp/ent/cost-model/ubbagent:1.0
env:
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
- name: AGENT_CONFIG_FILE
value: "/etc/ubbagent/config.yaml"
- name: AGENT_LOCAL_PORT
Expand Down
14 changes: 14 additions & 0 deletions cost-analyzer/templates/federator-deployment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ spec:
{{- if .Values.federatedETL.federator.extraEnv }}
{{- toYaml .Values.federatedETL.federator.extraEnv | nindent 12 }}
{{- end }}
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
restartPolicy: Always
serviceAccountName: {{ template "cost-analyzer.serviceAccountName" . }}
volumes:
Expand Down
7 changes: 5 additions & 2 deletions cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,11 @@ oidc:
# claimValues:
# - "editor"

# Adds an httpProxy as an environment variable. systemProxy.enabled must be `true`to have any effect.
# Ref: https://www.oreilly.com/library/view/security-with-go/9781788627917/5ea6a02b-3d96-44b1-ad3c-6ab60fcbbe4f.xhtml
## Adds the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables to all
## containers. Typically used in environments that have firewall rules which
## prevent kubecost from accessing cloud provider resources.
## Ref: https://www.oreilly.com/library/view/security-with-go/9781788627917/5ea6a02b-3d96-44b1-ad3c-6ab60fcbbe4f.xhtml
##
systemProxy:
enabled: false
httpProxyUrl: ""
Expand Down

0 comments on commit 0786ecd

Please sign in to comment.