forked from different-ai/openwork
-
Notifications
You must be signed in to change notification settings - Fork 0
DEVOPS-3406 - helm: declared secretsMode with ESO ExternalSecret support #2
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
Open
raul-gherman-modaoperandi
wants to merge
10
commits into
dev
Choose a base branch
from
DEVOPS-3406
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7ecd83d
DEVOPS-3406 - helm: declared secretsMode with ESO ExternalSecret support
raul-gherman-modaoperandi 7046be8
DEVOPS-3406 - add legacy shim for secretsMode handling and validation
raul-gherman-modaoperandi 8d3c3f6
DEVOPS-3406 - update secretsMode handling and validation for inline mode
raul-gherman-modaoperandi f0cb746
DEVOPS-3406 - add validation and legacy shim for migration Job secret…
raul-gherman-modaoperandi d439353
DEVOPS-3406 - add createNamespace option and template for Namespace r…
raul-gherman-modaoperandi 5a5e775
DEVOPS-3406 - add createNamespace option and template for Namespace r…
raul-gherman-modaoperandi 6a7e2e7
DEVOPS-3406 - enhance migration Job and ExternalSecret handling with …
raul-gherman-modaoperandi e0e6e15
DEVOPS-3406 - address Copilot review comments (valid)
raul-gherman-modaoperandi 42813d6
DEVOPS-3406 - address Copilot review comments (valid) [1]
raul-gherman-modaoperandi 1110614
DEVOPS-3406 - address Copilot review comments (valid) [2]
raul-gherman-modaoperandi 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| {{- include "openwork-ee.secretsMode.validate" . }} | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
|
|
||
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,43 @@ | ||
| {{- include "openwork-ee.secretsMode.validate" . }} | ||
| {{- if eq .Values.secret.secretsMode "externalSecrets" }} | ||
| {{- include "openwork-ee.externalSecrets.validate" . }} | ||
| apiVersion: {{ include "openwork-ee.externalSecrets.apiVersion" . }} | ||
| kind: ExternalSecret | ||
| metadata: | ||
| name: {{ include "openwork-ee.secretName" . }} | ||
| namespace: {{ include "openwork-ee.namespace" . }} | ||
| labels: | ||
| {{- include "openwork-ee.labels" . | nindent 4 }} | ||
| {{- /* | ||
| When the migration Job runs as a pre-install/pre-upgrade hook, the | ||
| ExternalSecret must apply first so ESO can start materializing the Secret | ||
| the Job consumes. Weight -10 precedes the Job's -5. ArgoCD maps these to | ||
| PreSync the same way, so GitOps installs get the same ordering. | ||
| */}} | ||
| {{- if .Values.migrations.hook }} | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade | ||
| "helm.sh/hook-weight": "-10" | ||
| "helm.sh/hook-delete-policy": before-hook-creation | ||
| {{- end }} | ||
| spec: | ||
| refreshInterval: {{ .Values.externalSecrets.refreshInterval | quote }} | ||
| secretStoreRef: | ||
| name: {{ .Values.externalSecrets.secretStoreRef.name | toString | trim | quote }} | ||
| kind: {{ .Values.externalSecrets.secretStoreRef.kind }} | ||
| target: | ||
| name: {{ include "openwork-ee.secretName" . }} | ||
| creationPolicy: {{ .Values.externalSecrets.target.creationPolicy | default "Owner" }} | ||
| deletionPolicy: {{ .Values.externalSecrets.target.deletionPolicy | default "Retain" }} | ||
| data: | ||
| {{- $prefix := .Values.externalSecrets.pathPrefix | toString | trim | trimSuffix "/" }} | ||
| {{- range $name := keys .Values.secret.keys | sortAlpha }} | ||
| {{- $envKey := index $.Values.secret.keys $name }} | ||
| - secretKey: {{ $envKey }} | ||
| remoteRef: | ||
| key: {{ printf "%s/%s" $prefix $envKey | quote }} | ||
| conversionStrategy: {{ $.Values.externalSecrets.conversionStrategy }} | ||
| decodingStrategy: {{ $.Values.externalSecrets.decodingStrategy }} | ||
| metadataPolicy: {{ $.Values.externalSecrets.metadataPolicy }} | ||
| {{- 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
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,64 @@ | ||
| {{- /* | ||
| RBAC for the migration Job's wait-for-secret init container: the Job polls | ||
| for an asynchronously materialized Secret (ESO / out-of-band creation) | ||
| instead of failing on the env secretKeyRef. Rendered only outside inline | ||
| mode. In hook mode these must be hooks with an earlier weight than the Job | ||
| (-6 precedes the Job's -5) so they exist before it starts. | ||
| */}} | ||
| {{- if and .Values.migrations.enabled (ne .Values.secret.secretsMode "inline") }} | ||
| {{- $asHook := .Values.migrations.hook }} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ include "openwork-ee.fullname" . }}-migrate | ||
| namespace: {{ include "openwork-ee.namespace" . }} | ||
| labels: | ||
| {{- include "openwork-ee.componentLabels" (dict "root" . "component" "migration") | nindent 4 }} | ||
| {{- if $asHook }} | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade | ||
| "helm.sh/hook-weight": "-6" | ||
| "helm.sh/hook-delete-policy": before-hook-creation | ||
| {{- end }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ include "openwork-ee.fullname" . }}-migrate | ||
| namespace: {{ include "openwork-ee.namespace" . }} | ||
| labels: | ||
| {{- include "openwork-ee.componentLabels" (dict "root" . "component" "migration") | nindent 4 }} | ||
| {{- if $asHook }} | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade | ||
| "helm.sh/hook-weight": "-6" | ||
| "helm.sh/hook-delete-policy": before-hook-creation | ||
| {{- end }} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| resourceNames: [{{ include "openwork-ee.secretName" . | quote }}] | ||
| verbs: ["get"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ include "openwork-ee.fullname" . }}-migrate | ||
| namespace: {{ include "openwork-ee.namespace" . }} | ||
| labels: | ||
| {{- include "openwork-ee.componentLabels" (dict "root" . "component" "migration") | nindent 4 }} | ||
| {{- if $asHook }} | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade | ||
| "helm.sh/hook-weight": "-6" | ||
| "helm.sh/hook-delete-policy": before-hook-creation | ||
| {{- end }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ include "openwork-ee.fullname" . }}-migrate | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ include "openwork-ee.fullname" . }}-migrate | ||
| namespace: {{ include "openwork-ee.namespace" . }} | ||
| {{- 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,16 @@ | ||
| {{- /* | ||
| lookup returns empty under helm template / ArgoCD repo-server rendering, so | ||
| GitOps flows still get the Namespace manifest; a live helm install/upgrade | ||
| skips it when the namespace already exists, avoiding AlreadyExists failures | ||
| against pre-provisioned namespaces. | ||
| */ -}} | ||
| {{- $namespaceName := include "openwork-ee.namespace" . | trimAll "\"" -}} | ||
| {{- $existing := lookup "v1" "Namespace" "" $namespaceName -}} | ||
| {{- if and .Values.createNamespace (not $existing) }} | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: {{ include "openwork-ee.namespace" . }} | ||
| labels: | ||
| {{- include "openwork-ee.labels" . | nindent 4 }} | ||
|
Comment on lines
+12
to
+15
|
||
| {{- 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
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.