Skip to content

Commit

Permalink
feat: give ci workloads their own namespace
Browse files Browse the repository at this point in the history
There is no reason for the development application to run
in a namespace with the extra secrets needed by the ci.

This split provides better segregation of information and
makes the development namespace identical to the other
deployment namespaces in term of configuration.

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
Roming22 committed Feb 14, 2025
1 parent f6dbed1 commit dfb5a19
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions installer/charts/rhtap-app-namespaces/hooks/post-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ patch_serviceaccount() {
app_namespaces() {
NAMESPACE="$INSTALLER__QUAY__SECRET__NAMESPACE"

for env in "development" "prod" "stage"; do
for SA in "default" "pipeline"; do
patch_serviceaccount "$NAMESPACE-app-$env" "$SA"
done
patch_serviceaccount "$NAMESPACE-app-ci" "pipeline"
for env in "ci" "development" "prod" "stage"; do
patch_serviceaccount "$NAMESPACE-app-$env" "default"
done
}

Expand Down
2 changes: 1 addition & 1 deletion installer/charts/rhtap-app-namespaces/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $namespace := .Release.Namespace -}}
OpenShift Projects:
{{- range tuple "development" "prod" "stage" }}
{{- range tuple "ci" "development" "prod" "stage" }}
- "{{ $namespace }}-app-{{ . }}"
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $namespace := .Release.Namespace }}
{{ $argoCD := .Values.appNamespaces.argoCD.name }}
{{- range tuple "development" "prod" "stage" }}
{{- range tuple "ci" "development" "prod" "stage" }}
---
apiVersion: v1
kind: Namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $secretObj := (lookup "v1" "Secret" .Release.Namespace "rhtap-artifactory-integration") | default dict -}}
{{- $secretData := (get $secretObj "data") | default dict -}}
{{- if $secretData }}
{{- range tuple "development" "prod" "stage" }}
{{- range tuple "ci" "development" "prod" "stage" }}
---
kind: Secret
type: kubernetes.io/dockerconfigjson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: kubernetes.io/basic-auth
apiVersion: v1
metadata:
name: bitbucket-auth-secret
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
password: {{ $secretData.appPassword }}
username: {{ $secretData.username }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: Opaque
apiVersion: v1
metadata:
name: cosign-pub
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
cosign.pub: {{ index $secretData "cosign.pub" }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: kubernetes.io/basic-auth
apiVersion: v1
metadata:
name: gitops-auth-secret
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
password: {{ $secretData.token }}
username: {{ "oauth2" | b64enc }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: kubernetes.io/basic-auth
apiVersion: v1
metadata:
name: gitlab-auth-secret
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
password: {{ $secretData.token }}
username: {{ "oauth2" | b64enc }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $secretObj := (lookup "v1" "Secret" .Release.Namespace "rhtap-nexus-integration") | default dict -}}
{{- $secretData := (get $secretObj "data") | default dict -}}
{{- if $secretData }}
{{- range tuple "development" "prod" "stage" }}
{{- range tuple "ci" "development" "prod" "stage" }}
---
kind: Secret
type: kubernetes.io/dockerconfigjson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type: Opaque
apiVersion: v1
metadata:
name: pipelines-secret
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
webhook.secret: {{ $secretData.WebhookSecret }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $secretObj := (lookup "v1" "Secret" .Release.Namespace "rhtap-quay-integration") | default dict -}}
{{- $secretData := (get $secretObj "data") | default dict -}}
{{- if $secretData }}
{{- range tuple "development" "prod" "stage" }}
{{- range tuple "ci" "development" "prod" "stage" }}
---
kind: Secret
type: kubernetes.io/dockerconfigjson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: Opaque
apiVersion: v1
metadata:
name: rox-api-token
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
rox-api-endpoint: {{ $secretData.endpoint }}
rox-api-token: {{ $secretData.token }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: Opaque
apiVersion: v1
metadata:
name: tpa-secret
namespace: {{ $namespace }}-app-development
namespace: {{ $namespace }}-app-ci
data:
bombastic_api_url: {{ $secretData.bombastic_api_url }}
oidc_client_id: {{ $secretData.oidc_client_id }}
Expand Down

0 comments on commit dfb5a19

Please sign in to comment.