-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add stac-auth-proxy. #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d42c3a4
Added stac-auth-proxy.
pantierra 30cceac
Added integration tests for stac-auth-proxy.
pantierra 3839128
Temporarily patch stac-auth-proxy chart until PR comes in.
pantierra 41a2bd6
Actually use mock-oidc-server.
pantierra 5da9e46
Removed stac-auth-proxy charts patch.
pantierra 12c3352
Fixed tests.
pantierra 8b319ab
Let's be a bit more patient.
pantierra fae1619
Check that stac-auth-proxy only makes sens with stac enabled.
pantierra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| {{/* | ||
| This template validates the PostgreSQL configuration. | ||
| This template validates various configurations. | ||
| It doesn't create any resources but ensures configuration consistency. | ||
| */}} | ||
| {{- include "eoapi.validatePostgresql" . }} | ||
| {{- include "eoapi.validateStacAuthProxy" . }} |
This file contains hidden or 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,84 @@ | ||
| {{- if .Values.mockOidcServer.enabled }} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "eoapi.fullname" . }}-mock-oidc-server | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "eoapi.labels" . | nindent 4 }} | ||
| app.kubernetes.io/component: mock-oidc-server | ||
| spec: | ||
| replicas: {{ .Values.mockOidcServer.replicaCount | default 1 }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "eoapi.selectorLabels" . | nindent 6 }} | ||
| app.kubernetes.io/component: mock-oidc-server | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "eoapi.selectorLabels" . | nindent 8 }} | ||
| app.kubernetes.io/component: mock-oidc-server | ||
| spec: | ||
| {{- if .Values.mockOidcServer.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml .Values.mockOidcServer.imagePullSecrets | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - name: mock-oidc | ||
| image: "{{ if .Values.mockOidcServer.image }}{{ .Values.mockOidcServer.image.repository | default "ghcr.io/alukach/mock-oidc-server" }}:{{ .Values.mockOidcServer.image.tag | default "latest" }}{{ else }}ghcr.io/alukach/mock-oidc-server:latest{{ end }}" | ||
| imagePullPolicy: {{ if .Values.mockOidcServer.image }}{{ .Values.mockOidcServer.image.pullPolicy | default "IfNotPresent" }}{{ else }}IfNotPresent{{ end }} | ||
| env: | ||
| - name: MOCK_OIDC_PORT | ||
| value: "{{ .Values.mockOidcServer.port | default 8888 }}" | ||
| - name: MOCK_OIDC_CLIENT_ID | ||
| value: "{{ .Values.mockOidcServer.clientId | default "test-client" }}" | ||
| - name: MOCK_OIDC_CLIENT_SECRET | ||
| value: "{{ .Values.mockOidcServer.clientSecret | default "test-secret" }}" | ||
| {{- if .Values.mockOidcServer.extraEnv }} | ||
| {{- toYaml .Values.mockOidcServer.extraEnv | nindent 8 }} | ||
| {{- end }} | ||
| ports: | ||
| - name: http | ||
| containerPort: {{ .Values.mockOidcServer.port | default 8888 }} | ||
| protocol: TCP | ||
| startupProbe: | ||
| httpGet: | ||
| path: /.well-known/openid-configuration | ||
| port: http | ||
| initialDelaySeconds: 10 | ||
| periodSeconds: 5 | ||
| failureThreshold: 12 | ||
| timeoutSeconds: 3 | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /.well-known/openid-configuration | ||
| port: http | ||
| initialDelaySeconds: 30 | ||
| periodSeconds: 10 | ||
| failureThreshold: 3 | ||
| timeoutSeconds: 3 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /.well-known/openid-configuration | ||
| port: http | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 5 | ||
| failureThreshold: 3 | ||
| timeoutSeconds: 3 | ||
| {{- if .Values.mockOidcServer.resources }} | ||
| resources: | ||
| {{- toYaml .Values.mockOidcServer.resources | nindent 10 }} | ||
| {{- end }} | ||
| {{- if .Values.mockOidcServer.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml .Values.mockOidcServer.nodeSelector | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.mockOidcServer.affinity }} | ||
| affinity: | ||
| {{- toYaml .Values.mockOidcServer.affinity | nindent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.mockOidcServer.tolerations }} | ||
| tolerations: | ||
| {{- toYaml .Values.mockOidcServer.tolerations | nindent 8 }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or 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,20 @@ | ||
| {{- if .Values.mockOidcServer.enabled }} | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "eoapi.fullname" . }}-mock-oidc-server | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "eoapi.labels" . | nindent 4 }} | ||
| app.kubernetes.io/component: mock-oidc-server | ||
| spec: | ||
| type: {{ if .Values.mockOidcServer.service }}{{ .Values.mockOidcServer.service.type | default "ClusterIP" }}{{ else }}ClusterIP{{ end }} | ||
| ports: | ||
| - port: {{ if .Values.mockOidcServer.service }}{{ .Values.mockOidcServer.service.port | default 8080 }}{{ else }}8080{{ end }} | ||
| targetPort: http | ||
| protocol: TCP | ||
| name: http | ||
| selector: | ||
| {{- include "eoapi.selectorLabels" . | nindent 4 }} | ||
| app.kubernetes.io/component: mock-oidc-server | ||
| {{- end }} |
This file contains hidden or 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 hidden or 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 hidden or 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,79 @@ | ||
| suite: test stac-auth-proxy ingress routing | ||
| templates: | ||
| - networking/ingress.yaml | ||
|
|
||
| tests: | ||
| - it: should route ingress to stac-auth-proxy when enabled | ||
| set: | ||
| ingress.enabled: true | ||
| ingress.className: nginx | ||
| stac.enabled: true | ||
| stac.ingress.enabled: true | ||
| stac.ingress.path: "/stac" | ||
| stac-auth-proxy.enabled: true | ||
| service.port: 8080 | ||
| asserts: | ||
| - contains: | ||
| path: spec.rules[0].http.paths | ||
| content: | ||
| pathType: ImplementationSpecific | ||
| path: /stac(/|$)(.*) | ||
| backend: | ||
| service: | ||
| name: RELEASE-NAME-stac-auth-proxy | ||
| port: | ||
| number: 8080 | ||
| template: networking/ingress.yaml | ||
|
|
||
| - it: should route ingress directly to stac when auth-proxy is disabled | ||
| set: | ||
| ingress.enabled: true | ||
| ingress.className: nginx | ||
| stac.enabled: true | ||
| stac.ingress.enabled: true | ||
| stac.ingress.path: "/stac" | ||
| stac-auth-proxy.enabled: false | ||
| service.port: 8080 | ||
| asserts: | ||
| - contains: | ||
| path: spec.rules[0].http.paths | ||
| content: | ||
| pathType: ImplementationSpecific | ||
| path: /stac(/|$)(.*) | ||
| backend: | ||
| service: | ||
| name: RELEASE-NAME-stac | ||
| port: | ||
| number: 8080 | ||
| template: networking/ingress.yaml | ||
|
|
||
| - it: should not create stac routes when stac is disabled | ||
| set: | ||
| ingress.enabled: true | ||
| stac.enabled: false | ||
| stac-auth-proxy.enabled: true | ||
| asserts: | ||
| - notContains: | ||
| path: spec.rules[0].http.paths | ||
| any: true | ||
| content: | ||
| path: /stac(/|$)(.*) | ||
| template: networking/ingress.yaml | ||
|
|
||
| - it: should route correctly with experimental profile | ||
| values: | ||
| - ../profiles/experimental.yaml | ||
| set: | ||
| ingress.enabled: true | ||
| asserts: | ||
| - contains: | ||
| path: spec.rules[0].http.paths | ||
| content: | ||
| pathType: ImplementationSpecific | ||
| path: /stac(/|$)(.*) | ||
| backend: | ||
| service: | ||
| name: RELEASE-NAME-stac-auth-proxy | ||
| port: | ||
| number: 8080 | ||
| template: networking/ingress.yaml | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ever valid to have
stacdisabled butstac-auth-proxyenabled? Should that rather be a validation check thatstac-auth-proxycannot be enabled isstac.enabledis set tofalse?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed stac-auth-proxy without stac doesn't make sense. Will adjust in a bit.
On a side note: does anybody deploy eoAPI without the stac service at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I know of. But it seems like it makes sense to leave the option in there for consistency? I think it can sometimes be convenient if one wants to temporarily remove a service or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a simple test to the helpers.