-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
344 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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,6 @@ | ||
changelog: | ||
- type: FIX | ||
issueLink: https://github.com/solo-io/skv2/issues/574 | ||
description: > | ||
Add support for multiple ImagePullSecret references | ||
skipCI: "false" |
This file contains 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 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 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,8 @@ | ||
# Code generated by skv2. DO NOT EDIT. | ||
|
||
apiVersion: v1 | ||
home: https://docs.solo.io/skv2/latest | ||
name: Painting Operator | ||
sources: | ||
- https://github.com/solo-io/skv2 | ||
version: v0.0.1 |
54 changes: 54 additions & 0 deletions
54
codegen/test/chart/image-pull-secrets/templates/_helpers.tpl
This file contains 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,54 @@ | ||
# Code generated by skv2. DO NOT EDIT. | ||
|
||
|
||
|
||
{{/* Below are library functions provided by skv2 */}} | ||
|
||
{{- /* | ||
"skv2.utils.merge" takes an array of three values: | ||
- the top context | ||
- the yaml block that will be merged in (override) | ||
- the name of the base template (source) | ||
note: the source must be a named template (helm partial). This is necessary for the merging logic. | ||
The behaviour is as follows, to align with already existing helm behaviour: | ||
- If no source is found (template is empty), the merged output will be empty | ||
- If no overrides are specified, the source is rendered as is | ||
- If overrides are specified and source is not empty, overrides will be merged in to the source. | ||
Overrides can replace / add to deeply nested dictionaries, but will completely replace lists. | ||
Examples: | ||
┌─────────────────────┬───────────────────────┬────────────────────────┐ | ||
│ Source (template) │ Overrides │ Result │ | ||
├─────────────────────┼───────────────────────┼────────────────────────┤ | ||
│ metadata: │ metadata: │ metadata: │ | ||
│ labels: │ labels: │ labels: │ | ||
│ app: gloo │ app: gloo1 │ app: gloo1 │ | ||
│ cluster: useast │ author: infra-team │ author: infra-team │ | ||
│ │ │ cluster: useast │ | ||
├─────────────────────┼───────────────────────┼────────────────────────┤ | ||
│ lists: │ lists: │ lists: │ | ||
│ groceries: │ groceries: │ groceries: │ | ||
│ - apple │ - grapes │ - grapes │ | ||
│ - banana │ │ │ | ||
└─────────────────────┴───────────────────────┴────────────────────────┘ | ||
skv2.utils.merge is a fork of a helm library chart function (https://github.com/helm/charts/blob/master/incubator/common/templates/_util.tpl). | ||
This includes some optimizations to speed up chart rendering time, and merges in a value (overrides) with a named template, unlike the upstream | ||
version, which merges two named templates. | ||
*/ -}} | ||
{{- define "skv2.utils.merge" -}} | ||
{{- $top := first . -}} | ||
{{- $overrides := (index . 1) -}} | ||
{{- $tpl := fromYaml (include (index . 2) $top) -}} | ||
{{- if or (empty $overrides) (empty $tpl) -}} | ||
{{ include (index . 2) $top }} {{/* render source as is */}} | ||
{{- else -}} | ||
{{- $merged := merge $overrides $tpl -}} | ||
{{- toYaml $merged -}} {{/* render source with overrides as YAML */}} | ||
{{- end -}} | ||
{{- end -}} |
138 changes: 138 additions & 0 deletions
138
codegen/test/chart/image-pull-secrets/templates/deployment.yaml
This file contains 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,138 @@ | ||
# Code generated by skv2. DO NOT EDIT. | ||
|
||
|
||
|
||
{{- $painter := $.Values.painter }} | ||
--- | ||
|
||
{{- define "painter.deploymentSpec" }} | ||
# Deployment manifest for painter | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: painter | ||
annotations: | ||
app.kubernetes.io/name: painter | ||
name: painter | ||
namespace: {{ default .Release.Namespace $.Values.painter.namespace }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: painter | ||
template: | ||
metadata: | ||
labels: | ||
app: painter | ||
annotations: | ||
app.kubernetes.io/name: painter | ||
spec: | ||
serviceAccountName: painter | ||
{{- /* Override the default podSecurityContext config if it is set. */}} | ||
{{- if or ($.Values.painter.podSecurityContext) (eq "map[]" (printf "%v" $.Values.painter.podSecurityContext)) }} | ||
securityContext: | ||
{{ toYaml $.Values.painter.podSecurityContext | indent 8 }} | ||
{{- end }} | ||
containers: | ||
{{- $painter := $.Values.painter }} | ||
{{- $painterImage := $painter.image }} | ||
- name: painter | ||
image: {{ $painterImage.registry }}/{{ $painterImage.repository }}:{{ $painterImage.tag }} | ||
imagePullPolicy: {{ $painterImage.pullPolicy }} | ||
{{- if or $painter.env $painter.extraEnvs }} | ||
env: | ||
{{- end }} | ||
{{- if $painter.env }} | ||
{{- toYaml $painter.env | nindent 10 }} | ||
{{- end }} | ||
{{- range $name, $item := $painter.extraEnvs }} | ||
- name: {{ $name }} | ||
{{- $item | toYaml | nindent 12 }} | ||
{{- end }} | ||
resources: | ||
{{- if $painter.resources }} | ||
{{ toYaml $painter.resources | indent 10}} | ||
{{- else}} | ||
requests: | ||
cpu: 500m | ||
memory: 256Mi | ||
{{- end }} | ||
{{- /* | ||
Render securityContext configs if it is set. | ||
If securityContext is not set, render the default securityContext. | ||
If securityContext is set to 'false', render an empty map. | ||
*/}} | ||
securityContext: | ||
{{- if or ($painter.securityContext) (eq "map[]" (printf "%v" $painter.securityContext)) }} | ||
{{ toYaml $painter.securityContext | indent 10}} | ||
{{/* Because securityContext is nil by default we can only perform following conversion if it is a boolean. Skip conditional otherwise. */}} | ||
{{- else if eq (ternary $painter.securityContext true (eq "bool" (printf "%T" $painter.securityContext))) false }} | ||
{} | ||
{{- else}} | ||
runAsNonRoot: true | ||
{{- if not $painter.floatingUserId }} | ||
runAsUser: {{ printf "%.0f" (float64 $painter.runAsUser) }} | ||
{{- end }} | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
{{- end }} | ||
{{- $pullSecrets := $painter.imagePullSecrets }} | ||
{{- if $painterImage.pullSecret }} | ||
{{- $pullSecrets = append $pullSecrets (dict "name" $painterImage.pullSecret) }} | ||
{{- end }} | ||
{{- if $pullSecrets }} | ||
imagePullSecrets: | ||
{{- end }} | ||
{{- range $secret := $pullSecrets }} | ||
- {{ toYaml $secret }} | ||
{{- end }} | ||
{{- end }} {{- /* define "painter.deploymentSpec" */ -}} | ||
|
||
{{- /* Render painter deployment template with overrides from values */ -}} | ||
{{ if $painter.enabled }} | ||
{{- $painterDeploymentOverrides := dict }} | ||
{{- if $painter.deploymentOverrides }} | ||
{{- $painterDeploymentOverrides = $painter.deploymentOverrides }} | ||
{{- end }} | ||
--- | ||
{{- include "skv2.utils.merge" (list . $painterDeploymentOverrides "painter.deploymentSpec") -}} | ||
{{- end }} | ||
--- | ||
{{ if $painter.enabled }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
labels: | ||
app: painter | ||
{{- if $painter.serviceAccount}} | ||
{{- if $painter.serviceAccount.extraAnnotations }} | ||
annotations: | ||
{{- range $key, $value := $painter.serviceAccount.extraAnnotations }} | ||
{{ $key }}: {{ $value }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end}} | ||
name: painter | ||
namespace: {{ default .Release.Namespace $.Values.painter.namespace }} | ||
{{- end }} | ||
|
||
|
||
{{- define "painter.serviceSpec"}} | ||
|
||
{{- end }} {{/* define "painter.serviceSpec" */}} | ||
{{ if $painter.enabled }} | ||
{{/* Render painter service template with overrides from values*/}} | ||
{{- $painterServiceOverrides := dict }} | ||
{{- if $painter.serviceOverrides }} | ||
{{- $painterServiceOverrides = $painter.serviceOverrides }} | ||
{{- end }} | ||
|
||
--- | ||
|
||
{{ include "skv2.utils.merge" (list . $painterServiceOverrides "painter.serviceSpec") }} | ||
{{- end }} | ||
|
This file contains 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,2 @@ | ||
# Code generated by skv2. DO NOT EDIT. | ||
|
Oops, something went wrong.