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

pull secret for console #1373

Merged
merged 1 commit into from
Dec 17, 2022
Merged
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
25 changes: 17 additions & 8 deletions kubectl-minio/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func (o *operatorInitCmd) run(writer io.Writer) error {
}

var operatorDepPatches []interface{}

var consoleDepPatches []interface{}

// create patches for the supplied arguments
if o.operatorOpts.Image != "" {
operatorDepPatches = append(operatorDepPatches, opStr{
Expand Down Expand Up @@ -205,6 +208,11 @@ func (o *operatorInitCmd) run(writer io.Writer) error {
Path: "/spec/template/spec/imagePullSecrets",
Value: []corev1.LocalObjectReference{{Name: o.operatorOpts.ImagePullSecret}},
})
consoleDepPatches = append(consoleDepPatches, opInterface{
Op: "add",
Path: "/spec/template/spec/imagePullSecrets",
Value: []corev1.LocalObjectReference{{Name: o.operatorOpts.ImagePullSecret}},
})
}
if o.operatorOpts.PrometheusNamespace != "" {
operatorDepPatches = append(operatorDepPatches, opInterface{
Expand All @@ -226,6 +234,13 @@ func (o *operatorInitCmd) run(writer io.Writer) error {
},
})
}
if o.operatorOpts.ConsoleImage != "" {
consoleDepPatches = append(consoleDepPatches, opStr{
Op: "replace",
Path: "/spec/template/spec/containers/0/image",
Value: o.operatorOpts.ConsoleImage,
})
}
// attach the patches to the kustomization file
if len(operatorDepPatches) > 0 {
kustomizationYaml.PatchesJson6902 = append(kustomizationYaml.PatchesJson6902, types.Patch{
Expand All @@ -243,15 +258,9 @@ func (o *operatorInitCmd) run(writer io.Writer) error {
})
}

if o.operatorOpts.ConsoleImage != "" {
if len(consoleDepPatches) > 0 {
kustomizationYaml.PatchesJson6902 = append(kustomizationYaml.PatchesJson6902, types.Patch{
Patch: o.serializeJSONPatchOps([]interface{}{
opStr{
Op: "replace",
Path: "/spec/template/spec/containers/0/image",
Value: o.operatorOpts.ConsoleImage,
},
}),
Patch: o.serializeJSONPatchOps(consoleDepPatches),
Target: &types.Selector{
ResId: resid.ResId{
Gvk: resid.Gvk{
Expand Down