-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathoutbound-proxy.yaml
35 lines (34 loc) · 1.54 KB
/
outbound-proxy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "container.security.name" . }}-outbound-proxy
labels:
{{- include "container.security.labels" . | nindent 4 }}
data:
httpProxy: {{ quote (default "" .Values.proxy.httpProxy) }}
httpsProxy: {{ quote (default "" .Values.proxy.httpsProxy) }}
noProxy: {{ quote (printf ".cluster.local,%s" .Values.proxy.noProxy) }}
---
{{ if not (and .Values.useExistingSecrets (eq true .Values.useExistingSecrets.outboundProxy)) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "container.security.name" . }}-outbound-proxy-credentials
labels:
{{- include "container.security.labels" . | nindent 4 }}
type: Opaque
data:
username: {{ default "" .Values.proxy.username | toString | b64enc | quote }}
password: {{ default "" .Values.proxy.password | toString | b64enc | quote }}
{{if .Values.proxy.username}}
{{if .Values.proxy.httpsProxy | hasPrefix "socks5://"}}
allProxy: {{printf "socks5://%s:%s@%s" .Values.proxy.username .Values.proxy.password (.Values.proxy.httpsProxy | trimPrefix "socks5://") | b64enc | quote}}
{{else if .Values.proxy.httpsProxy | hasPrefix "http://"}}
allProxy: {{printf "http://%s:%s@%s" .Values.proxy.username .Values.proxy.password (.Values.proxy.httpsProxy | trimPrefix "http://") | b64enc | quote}}
{{else}}
allProxy: {{printf "http://%s:%s@%s" .Values.proxy.username .Values.proxy.password .Values.proxy.httpsProxy | b64enc | quote}}
{{ end }}
{{else}}
allProxy: {{ default "" .Values.proxy.httpsProxy | toString | b64enc | quote }}
{{ end }}
{{ end }}