-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add authservice to uds-core #153
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
13 commits
Select commit
Hold shift + click to select a range
bc85f17
wip: authservice burning boats
mjnagel 4f719a9
wip: doug
mjnagel b4e683b
fix: all my terrible mistakes
mjnagel 0cb9aca
fix: netpol, config conditional
mjnagel 993165a
fix: add to package
mjnagel 4faeea7
Merge branch 'main' into authservice-add
TristanHoladay 7005494
fix: approach for isZarfEnv
mjnagel 791a95d
chore: rebase, cleanup
mjnagel 3427351
chore: more cleaning
mjnagel 669911a
chore: assume keycloak
mjnagel b24ea80
fix: helm is so much fun
mjnagel b4130e9
chore: more cleaning
mjnagel 9bd64e8
Merge branch 'main' into authservice-add
mjnagel 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| apiVersion: v2 | ||
| name: authservice | ||
| description: A Helm chart for Istio Authservice | ||
|
|
||
| # A chart can be either an 'application' or a 'library' chart. | ||
| # | ||
| # Application charts are a collection of templates that can be packaged into versioned archives | ||
| # to be deployed. | ||
| # | ||
| # Library charts provide useful utilities or functions for the chart developer. They're included as | ||
| # a dependency of application charts to inject those utilities and functions into the rendering | ||
| # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
| type: application | ||
|
|
||
| # This is the chart version. This version number should be incremented each time you make changes | ||
| # to the chart and its templates, including the app version. | ||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
| version: 0.5.3 | ||
|
|
||
| # This is the version number of the application being deployed. This version number should be | ||
| # incremented each time you make changes to the application. Versions are not expected to | ||
| # follow Semantic Versioning. They should reflect the version the application is using. | ||
| appVersion: 0.5.3 |
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,58 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "authservice.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
| If release name contains chart name it will be used as a full name. | ||
| */}} | ||
| {{- define "authservice.fullname" -}} | ||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||
| {{- if contains $name .Release.Name }} | ||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "authservice.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "authservice.labels" -}} | ||
| helm.sh/chart: {{ include "authservice.chart" . }} | ||
| {{ include "authservice.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "authservice.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "authservice.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use | ||
| */}} | ||
| {{- define "authservice.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "authservice.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
| {{- 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 @@ | ||
| # Authservice is non-functional without Istio/RequestAuthentication but we wrap this in a conditional to handle standalone testing | ||
| {{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1" }} | ||
| apiVersion: security.istio.io/v1beta1 | ||
| kind: RequestAuthentication | ||
| metadata: | ||
| name: jwt-authn | ||
| namespace: istio-system | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| {{ .Values.selector.key }}: {{ .Values.selector.value | quote }} | ||
| jwtRules: | ||
| - issuer: https://{{ .Values.global.oidc.host }}/auth/realms/{{ .Values.global.oidc.realm }} | ||
| {{- if .Values.global.jwks }} | ||
| jwks: {{ .Values.global.jwks | quote }} | ||
| {{- else }} | ||
| jwksUri: https://{{ .Values.global.oidc.host }}/auth/realms/{{ .Values.global.oidc.realm }}/protocol/openid-connect/certs | ||
| {{- end }} | ||
| forwardOriginalToken: true | ||
| {{- 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,41 @@ | ||
| # Authservice is non-functional without Istio/AuthorizationPolicy but we wrap this in a conditional to handle standalone testing | ||
| {{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1" }} | ||
| apiVersion: security.istio.io/v1beta1 | ||
| kind: AuthorizationPolicy | ||
| metadata: | ||
| name: authservice | ||
| namespace: istio-system | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| {{ .Values.selector.key }}: {{ .Values.selector.value | quote }} | ||
| action: CUSTOM | ||
| provider: | ||
| name: authservice | ||
| rules: | ||
| {{- if .Values.allow_unmatched_requests }} | ||
| - {} | ||
| {{- else if .Values.custom_authpolicy_rules }} | ||
| {{ .Values.custom_authpolicy_rules | toYaml | indent 2 }} | ||
| {{- else }} | ||
| - to: | ||
| - operation: | ||
| hosts: | ||
| - "*.{{ .Values.domain }}" | ||
| {{- end }} | ||
| --- | ||
| apiVersion: security.istio.io/v1beta1 | ||
| kind: AuthorizationPolicy | ||
| metadata: | ||
| name: jwt-authz | ||
| namespace: istio-system | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| {{ .Values.selector.key }}: {{ .Values.selector.value | quote }} | ||
| rules: | ||
| - from: | ||
| - source: | ||
| requestPrincipals: | ||
| - "https://{{ .Values.global.oidc.host }}/auth/realms/{{ .Values.global.oidc.realm }}/*" | ||
| {{- 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,99 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "authservice.fullname" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "authservice.labels" . | nindent 4 }} | ||
| spec: | ||
| {{- if not .Values.autoscaling.enabled }} | ||
| replicas: {{ .Values.replicaCount }} | ||
| {{- end }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "authservice.selectorLabels" . | nindent 6 }} | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} | ||
| {{- with .Values.podAnnotations }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "authservice.selectorLabels" . | nindent 8 }} | ||
| spec: | ||
| securityContext: | ||
| {{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
| containers: | ||
| - name: {{ .Chart.Name }} | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 12 }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| {{- if .Values.global.certificate_authority }} | ||
| env: | ||
| - name: SSL_CERT_FILE | ||
| value: /mnt/ca-bundle/ca-bundle.crt | ||
| {{- end}} | ||
| ports: | ||
| - name: http | ||
| containerPort: 10003 | ||
| protocol: TCP | ||
| livenessProbe: | ||
| tcpSocket: | ||
| port: 10003 | ||
| readinessProbe: | ||
| tcpSocket: | ||
| port: 10003 | ||
| resources: | ||
| {{- toYaml .Values.resources | nindent 12 }} | ||
| volumeMounts: | ||
| - name: {{ include "authservice.name" . }} | ||
| mountPath: /etc/authservice | ||
| {{- if .Values.global.certificate_authority }} | ||
| - name: ca-bundle | ||
| mountPath: /mnt/ca-bundle | ||
| {{- end }} | ||
| {{- if .Values.global.certificate_authority }} | ||
| initContainers: | ||
| - name: update-ca-bundle | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 12 }} | ||
| command: | ||
| - sh | ||
| - -c | ||
| - | | ||
| cat /etc/pki/tls/certs/* > /mnt/ca-bundle/ca-bundle.crt | ||
| volumeMounts: | ||
| - name: sso-tls-ca | ||
| mountPath: /etc/pki/tls/certs/oidc-ca.crt | ||
| subPath: oidc-ca.crt | ||
| readOnly: true | ||
| - name: ca-bundle | ||
| mountPath: /mnt/ca-bundle | ||
| {{- end }} | ||
| {{- with .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| volumes: | ||
| - name: {{ include "authservice.name" . }} | ||
| secret: | ||
| secretName: {{ include "authservice.fullname" . }} | ||
| {{- if .Values.global.certificate_authority }} | ||
| - name: sso-tls-ca | ||
| secret: | ||
| secretName: {{ include "authservice.fullname" . }}-sso-tls-ca | ||
| - name: ca-bundle | ||
| emptyDir: | ||
| sizeLimit: 5Mi | ||
| {{- 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,33 @@ | ||
| {{- if .Values.autoscaling.enabled }} | ||
| apiVersion: autoscaling/v2 | ||
| kind: HorizontalPodAutoscaler | ||
| metadata: | ||
| name: {{ include "authservice.fullname" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "authservice.labels" . | nindent 4 }} | ||
| spec: | ||
| scaleTargetRef: | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| name: {{ include "authservice.fullname" . }} | ||
| minReplicas: {{ .Values.autoscaling.minReplicas }} | ||
| maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||
| metrics: | ||
| {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
| - type: Resource | ||
| resource: | ||
| name: cpu | ||
| target: | ||
| type: Utilization | ||
| averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
| {{- end }} | ||
| {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
| - type: Resource | ||
| resource: | ||
| name: memory | ||
| target: | ||
| type: Utilization | ||
| averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
| {{- 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,11 @@ | ||
| {{- if .Values.global.certificate_authority }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ include "authservice.fullname" . }}-sso-tls-ca | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "authservice.labels" . | nindent 4 }} | ||
| stringData: | ||
| oidc-ca.crt: {{ .Values.global.certificate_authority | quote }} | ||
| {{- end }} |
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.
Uh oh!
There was an error while loading. Please reload this page.