From a0b06e45b6291c2c88468257cebc552b27193a6e Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 11 May 2021 19:43:49 -0500 Subject: [PATCH] support customized pull secret Signed-off-by: Marco --- api/v1alpha1/observatorium_types.go | 3 +++ jsonnet/obs-operator.jsonnet | 12 ++++++++++++ .../crds/core.observatorium.io_observatoria.yaml | 3 +++ 3 files changed, 18 insertions(+) diff --git a/api/v1alpha1/observatorium_types.go b/api/v1alpha1/observatorium_types.go index 4af739a1..f4193861 100644 --- a/api/v1alpha1/observatorium_types.go +++ b/api/v1alpha1/observatorium_types.go @@ -47,6 +47,9 @@ type ObservatoriumSpec struct { // Security options the pod should run with. // +optional SecurityContext *v1.SecurityContext `json:"securityContext,omitempty"` + // Pull secret used to pull the images. + // +optional + PullSecret string `json:"pullSecret,omitempty"` } type ThanosSpec struct { diff --git a/jsonnet/obs-operator.jsonnet b/jsonnet/obs-operator.jsonnet index 78630ff0..fefebcee 100644 --- a/jsonnet/obs-operator.jsonnet +++ b/jsonnet/obs-operator.jsonnet @@ -238,6 +238,18 @@ local operatorObs = obs { }, }, } else {} + ) + ( + if (std.objectHas(cr.spec, 'pullSecret') && (v.kind == 'StatefulSet' || v.kind == 'Deployment')) then { + template+: { + spec+:{ + imagePullSecrets: [ + { + name: cr.spec.pullSecret, + }, + ], + }, + }, + } else {} ), }, operatorObs.manifests), } diff --git a/manifests/crds/core.observatorium.io_observatoria.yaml b/manifests/crds/core.observatorium.io_observatoria.yaml index 9f6b680b..b2364e4f 100644 --- a/manifests/crds/core.observatorium.io_observatoria.yaml +++ b/manifests/crds/core.observatorium.io_observatoria.yaml @@ -733,6 +733,9 @@ spec: required: - thanos type: object + pullSecret: + description: Pull secret used to pull the images. + type: string securityContext: description: Security options the pod should run with. properties: