Skip to content
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

feat: integrate with keycloak #63

Merged
merged 23 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions chart/templates/sonarqube-sso-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This secret will be used if sso is disabled, instead of the templated one in uds-package.yaml.
# Sonarqube needs to mount the secret and creating it this way avoids creating an unnecessary
# client in the keycloak realm and unnecessary secret data in the cluster.
{{- if not .Values.sso.enabled }}

apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.sso.secretName }}
namespace: {{ .Release.Namespace }}
type: "Opaque"
stringData:
secret.properties: |
sonar.auth.saml.enabled: {{ .Values.sso.enabled }}

{{- end }}
4 changes: 3 additions & 1 deletion chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: sonarqube
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.sso.enabled }}
sso:
- name: SonarQube Login
clientId: uds-swf-sonarqube
Expand All @@ -18,7 +19,7 @@ spec:
attributes:
saml.client.signature: "false"

secretName: sonarqube-sso
secretName: {{ .Values.sso.secretName }}
# This secret template configures the sonarqube saml support documented here: https://docs.sonarsource.com/sonarqube/latest/instance-administration/authentication/saml/overview/
secretTemplate:
secret.properties: |
Expand All @@ -32,6 +33,7 @@ spec:
sonar.auth.saml.user.name: name
sonar.auth.saml.user.email: email
sonar.auth.saml.certificate.secured: clientField(samlIdpCertificate)
{{- end }}
network:
expose:
- service: sonarqube-sonarqube
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
domain: "###ZARF_VAR_DOMAIN###"
sso:
enabled: true
secretName: "###ZARF_VAR_SONARQUBE_SSO_SECRET_NAME###"
saml:
providerName: Keycloak # This is displayed on the SonarQube landing screen ("Log in with <providerName>")
2 changes: 1 addition & 1 deletion values/common-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition: "community"

# Name of the secret from which to load additional properties: https://community.sonarsource.com/t/additional-sonar-properties-to-load-from-a-secret/73748
# This secret will be created by the uds operator based on the sso spec defined in chart/templates/uds-package.yaml
sonarSecretProperties: sonarqube-sso
sonarSecretProperties: "###ZARF_VAR_SONARQUBE_SSO_SECRET_NAME###"
Racer159 marked this conversation as resolved.
Show resolved Hide resolved

monitoring:
enabled: true
Expand Down
2 changes: 2 additions & 0 deletions zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ variables:
default: "sonarqube"
- name: SONARQUBE_DB_ENDPOINT
default: "postgres"
- name: SONARQUBE_SSO_SECRET_NAME
default: "sonarqube-sso"

components:
- name: sonarqube
Expand Down