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

Allow Deployment, SA, and Service to be applied to custom Operator namespace #445

Merged
merged 10 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions changelog/v0.30.1/custom-operator-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- type: NEW_FEATURE
issueLink: https://github.com/solo-io/gloo-mesh-enterprise/issues/9491
resolvesIssue: false
description: >
Allows setting a optional operator namespace on the operator that will be used when applying the
deployment, service account, and service for said operator.
3 changes: 3 additions & 0 deletions codegen/model/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ type JsonSchema struct {
type Operator struct {
Name string

// (Optional) If set, the operator deployment, service, and service account will use this namespace
Namespace string

// (Optional) To change the name referenced in the values file. If not specified a camelcase version of name is used
ValuesFileNameOverride string

Expand Down
17 changes: 15 additions & 2 deletions codegen/templates/chart/operator-deployment.yamltmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Expressions evaluating SKv2 Config use "[[" and "]]"
[[- $customDeploymentAnnotations := $operator.Deployment.CustomDeploymentAnnotations -]]
[[- $customServiceLabels := $operator.Service.CustomLabels -]]
[[- $customServiceAnnotations := $operator.Service.CustomAnnotations ]]
[[- $customNamespace := $operator.Namespace ]]

{{- $[[ $operatorVar ]] := [[ (opVar $operator) ]]}}
---
Expand Down Expand Up @@ -49,7 +50,11 @@ metadata:
[[ $key ]]: [[ $value ]]
[[- end ]]
name: [[ $operator.Name ]]
[[- if $customNamespace ]]
namespace: [[ $customNamespace ]]
[[- else ]]
namespace: {{ .Release.Namespace }}
[[- end ]]
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -177,7 +182,11 @@ metadata:
{{- end }}
{{- end}}
name: [[ $operator.Name ]]
namespace: {{ $.Release.Namespace }}
[[- if $customNamespace ]]
namespace: [[ $customNamespace ]]
[[- else ]]
namespace: {{ .Release.Namespace }}
[[- end ]]
{{- end }}


Expand All @@ -200,7 +209,11 @@ metadata:
[[ $key ]]: [[ $value ]]
[[- end ]]
name: [[ $operator.Name ]]
namespace: {{ $.Release.Namespace }}
[[- if $customNamespace ]]
namespace: [[ $customNamespace ]]
[[- else ]]
namespace: {{ .Release.Namespace }}
[[- end ]]
spec:
selector:
app: [[ $operator.Name ]]
Expand Down
2 changes: 1 addition & 1 deletion codegen/test/chart-envvars/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ metadata:
{{- end }}
{{- end}}
name: painter
namespace: {{ $.Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}


Expand Down
2 changes: 1 addition & 1 deletion codegen/test/chart-no-desc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ metadata:
{{- end }}
{{- end}}
name: painter
namespace: {{ $.Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}


Expand Down
2 changes: 1 addition & 1 deletion codegen/test/chart-sidecar/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ metadata:
{{- end }}
{{- end}}
name: painter
namespace: {{ $.Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}


Expand Down
2 changes: 1 addition & 1 deletion codegen/test/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ metadata:
{{- end }}
{{- end}}
name: painter
namespace: {{ $.Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}


Expand Down
2 changes: 1 addition & 1 deletion codegen/test/name_override_chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ metadata:
{{- end }}
{{- end}}
name: painter-original-name
namespace: {{ $.Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}


Expand Down