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

🐛 fix operator-sdk generate kustomize manifests to respect changes made by users in the config/manifests #5960

Merged
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
8 changes: 8 additions & 0 deletions changelog/fragments/fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: >
Fix operator-sdk generate kustomize manifests to respect changes made by users in the config/manifests
kind: "bugfix"
breaking: false

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ func (f *Kustomization) SetTemplateDefaults() error {
f.Path = filepath.Join("config", "manifests", "kustomization.yaml")
}

// We cannot overwiting the file after it be created because
// it might contain user changes (i.e to work with Kustomize 4.x
// the target /spec/template/spec/containers/1/volumeMounts/0
// needs to be replaced with /spec/template/spec/containers/0/volumeMounts/0
f.IfExistsAction = machinery.SkipFile

f.TemplateBody = kustomizationTemplate

return nil
Expand Down
14 changes: 14 additions & 0 deletions website/content/en/docs/faqs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,19 @@ Here are a couple workarounds to try to resolve the issue:

If neither of those solutions work for you, please [open an issue][open-issue]

## After updating my project to use a Kustomize 4.x version, 'make bundle' does not work

**Valid only for Golang/Hybrid projects using webhooks**

> `Error: remove operation does not apply:doc is missing path: "/spec/template/spec/containers/1/volumeMounts/0": missing value`

The error occurs due to a change in the Kustomize 4.x versions where the containers used in the Deployment spec of your CSV
are no longer added at the same order. To sort it out you can update replace the target `/spec/template/spec/containers/1/volumeMounts/0`
everettraven marked this conversation as resolved.
Show resolved Hide resolved
with `/spec/template/spec/containers/0/volumeMounts/0` in `config/manifest/kustomization.yaml`.

**NOTE** You MUST use SDK CLI versions > 1.22. Previous versions have a bug
where the command `operator-sdk generate kustomize manifests` is not respecting the changes
made on this manifest.

[cgo-docs]: https://pkg.go.dev/cmd/cgo
[open-issue]: https://github.com/operator-framework/operator-sdk/issues/new/choose