@@ -69,76 +69,3 @@ Render env var value based on type
6969 {{- . | toJson | quote -}}
7070{{- end -}}
7171{{- end -}}
72-
73- {{/*
74- Generate authorization environment variables
75- */ }}
76- {{- define " stac-auth-proxy.authorizationEnv" -}}
77- {{- $routeMode := .Values.authorization.route.mode | default " default" -}}
78- {{- $recordMode := .Values.authorization.record.mode | default " disabled" -}}
79-
80- {{- /* Route-level authorization */ -}}
81- {{- if eq $routeMode " default" -}}
82- {{- if not (hasKey .Values.env " DEFAULT_PUBLIC" ) }}
83- - name: DEFAULT_PUBLIC
84- value: " true"
85- {{- end }}
86- {{- else if eq $routeMode " custom" -}}
87- {{- if not (hasKey .Values.env " DEFAULT_PUBLIC" ) }}
88- - name: DEFAULT_PUBLIC
89- value: " false"
90- {{- end }}
91- {{- if and .Values.authorization.route.publicEndpoints (gt (len .Values.authorization.route.publicEndpoints ) 0) (not (hasKey .Values.env " PUBLIC_ENDPOINTS" )) }}
92- - name: PUBLIC_ENDPOINTS
93- value: {{ .Values.authorization.route.publicEndpoints | toJson | quote }}
94- {{- end }}
95- {{- if and .Values.authorization.route.privateEndpoints (gt (len .Values.authorization.route.privateEndpoints ) 0) (not (hasKey .Values.env " PRIVATE_ENDPOINTS" )) }}
96- - name: PRIVATE_ENDPOINTS
97- value: {{ .Values.authorization.route.privateEndpoints | toJson | quote }}
98- {{- end }}
99- {{- end }}
100-
101- {{- /* Record-level authorization */ -}}
102- {{- if eq $recordMode " custom" -}}
103- {{- if not (hasKey .Values.env " COLLECTIONS_FILTER_CLS" ) }}
104- - name: COLLECTIONS_FILTER_CLS
105- value: " stac_auth_proxy.custom_filters:CollectionsFilter"
106- {{- end }}
107- {{- if not (hasKey .Values.env " ITEMS_FILTER_CLS" ) }}
108- - name: ITEMS_FILTER_CLS
109- value: " stac_auth_proxy.custom_filters:ItemsFilter"
110- {{- end }}
111- {{- else if eq $recordMode " opa" -}}
112- {{- if not (hasKey .Values.env " ITEMS_FILTER_CLS" ) }}
113- - name: ITEMS_FILTER_CLS
114- value: " stac_auth_proxy.filters:opa.Opa"
115- {{- end }}
116- {{- if and (not (hasKey .Values.env " ITEMS_FILTER_ARGS" )) .Values.authorization.record.opa }}
117- - name: ITEMS_FILTER_ARGS
118- value: {{ list .Values.authorization.record.opa.url .Values.authorization.record.opa.policy | toJson | quote }}
119- {{- end }}
120- {{- end }}
121- {{- end -}}
122-
123- {{/*
124- Generate authorization volumes
125- */ }}
126- {{- define " stac-auth-proxy.authorizationVolumes" -}}
127- {{- if and (eq (.Values.authorization.record.mode | default " disabled" ) " custom" ) .Values.authorization.record.custom.filtersFile }}
128- - name: custom-filters
129- configMap:
130- name: {{ include " stac-auth-proxy.fullname" . }}-filters
131- {{- end }}
132- {{- end -}}
133-
134- {{/*
135- Generate authorization volume mounts
136- */ }}
137- {{- define " stac-auth-proxy.authorizationVolumeMounts" -}}
138- {{- if and (eq (.Values.authorization.record.mode | default " disabled" ) " custom" ) .Values.authorization.record.custom.filtersFile }}
139- - name: custom-filters
140- mountPath: /app/src/stac_auth_proxy/custom_filters.py
141- subPath: custom_filters.py
142- readOnly: true
143- {{- end }}
144- {{- end -}}
0 commit comments