Skip to content

Commit

Permalink
Fix kustomize syntax during conversion to patches
Browse files Browse the repository at this point in the history
This commit fixes the syntax error introduced in #3374 where
pathcesStrategicMerge was replaced with patches, which now requires that
every patch additionally have a "path" key when multiple patches are
specified in a file.

Signed-off-by: Michael Shen <mishen@umich.edu>
  • Loading branch information
mjlshen committed Jun 14, 2023
1 parent d9c14df commit 2ca1179
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_projectconfigs.yaml
#- path: patches/webhook_in_projectconfigs.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_projectconfigs.yaml
#- path: patches/cainjection_in_projectconfigs.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
- patches/webhook_in_cronjobs.yaml
- path: patches/webhook_in_cronjobs.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
- patches/cainjection_in_cronjobs.yaml
- path: patches/cainjection_in_cronjobs.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.20
require (
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
github.com/robfig/cron v1.2.0
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
Expand Down Expand Up @@ -45,7 +46,6 @@ require (
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions hack/docs/internal/cronjob-tutorial/generate_cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ func updateKustomization(sp *Sample) {
// uncomment crd/kustomization
err = pluginutil.UncommentCode(
filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"),
`#- patches/webhook_in_cronjobs.yaml`, `#`)
`#- path: patches/webhook_in_cronjobs.yaml`, `#`)
CheckError("fixing crd/kustomization", err)

err = pluginutil.UncommentCode(
filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"),
`#- patches/cainjection_in_cronjobs.yaml`, `#`)
`#- path: patches/cainjection_in_cronjobs.yaml`, `#`)
CheckError("fixing crd/kustomization", err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ func (f *Kustomization) GetMarkers() []machinery.Marker {
const (
resourceCodeFragment = `- bases/%s_%s.yaml
`
webhookPatchCodeFragment = `#- patches/webhook_in_%s.yaml
webhookPatchCodeFragment = `#- path: patches/webhook_in_%s.yaml
`
caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml
caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s.yaml
`
)

Expand Down
12 changes: 6 additions & 6 deletions testdata/project-v4-declarative-v1/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_captains.yaml
#- patches/webhook_in_firstmates.yaml
#- patches/webhook_in_admirals.yaml
#- path: patches/webhook_in_captains.yaml
#- path: patches/webhook_in_firstmates.yaml
#- path: patches/webhook_in_admirals.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_captains.yaml
#- patches/cainjection_in_firstmates.yaml
#- patches/cainjection_in_admirals.yaml
#- path: patches/cainjection_in_captains.yaml
#- path: patches/cainjection_in_firstmates.yaml
#- path: patches/cainjection_in_admirals.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
36 changes: 18 additions & 18 deletions testdata/project-v4-multigroup/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_captains.yaml
#- patches/webhook_in_frigates.yaml
#- patches/webhook_in_destroyers.yaml
#- patches/webhook_in_cruisers.yaml
#- patches/webhook_in_krakens.yaml
#- patches/webhook_in_leviathans.yaml
#- patches/webhook_in_healthcheckpolicies.yaml
#- patches/webhook_in_bars.yaml
#- patches/webhook_in_lakers.yaml
#- path: patches/webhook_in_captains.yaml
#- path: patches/webhook_in_frigates.yaml
#- path: patches/webhook_in_destroyers.yaml
#- path: patches/webhook_in_cruisers.yaml
#- path: patches/webhook_in_krakens.yaml
#- path: patches/webhook_in_leviathans.yaml
#- path: patches/webhook_in_healthcheckpolicies.yaml
#- path: patches/webhook_in_bars.yaml
#- path: patches/webhook_in_lakers.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_captains.yaml
#- patches/cainjection_in_frigates.yaml
#- patches/cainjection_in_destroyers.yaml
#- patches/cainjection_in_cruisers.yaml
#- patches/cainjection_in_krakens.yaml
#- patches/cainjection_in_leviathans.yaml
#- patches/cainjection_in_healthcheckpolicies.yaml
#- patches/cainjection_in_bars.yaml
#- patches/cainjection_in_lakers.yaml
#- path: patches/cainjection_in_captains.yaml
#- path: patches/cainjection_in_frigates.yaml
#- path: patches/cainjection_in_destroyers.yaml
#- path: patches/cainjection_in_cruisers.yaml
#- path: patches/cainjection_in_krakens.yaml
#- path: patches/cainjection_in_leviathans.yaml
#- path: patches/cainjection_in_healthcheckpolicies.yaml
#- path: patches/cainjection_in_bars.yaml
#- path: patches/cainjection_in_lakers.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_memcacheds.yaml
#- patches/webhook_in_busyboxes.yaml
#- path: patches/webhook_in_memcacheds.yaml
#- path: patches/webhook_in_busyboxes.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_memcacheds.yaml
#- patches/cainjection_in_busyboxes.yaml
#- path: patches/cainjection_in_memcacheds.yaml
#- path: patches/cainjection_in_busyboxes.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
12 changes: 6 additions & 6 deletions testdata/project-v4/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ resources:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_captains.yaml
#- patches/webhook_in_firstmates.yaml
#- patches/webhook_in_admirales.yaml
#- path: patches/webhook_in_captains.yaml
#- path: patches/webhook_in_firstmates.yaml
#- path: patches/webhook_in_admirales.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_captains.yaml
#- patches/cainjection_in_firstmates.yaml
#- patches/cainjection_in_admirales.yaml
#- path: patches/cainjection_in_captains.yaml
#- path: patches/cainjection_in_firstmates.yaml
#- path: patches/cainjection_in_admirales.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down

0 comments on commit 2ca1179

Please sign in to comment.