Skip to content

Commit

Permalink
fix kustomization comments about patches file names
Browse files Browse the repository at this point in the history
  • Loading branch information
lowang-bh committed Sep 3, 2023
1 parent c399f0c commit b4cfeec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
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 @@ -584,12 +584,12 @@ func updateKustomization(sp *Sample) {
// uncomment crd/kustomization
err = pluginutil.UncommentCode(
filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"),
`#- path: patches/webhook_in_cronjobs.yaml`, `#`)
`#- path: patches/webhook_in_batch_cronjobs.yaml`, `#`)
CheckError("fixing crd/kustomization", err)

err = pluginutil.UncommentCode(
filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"),
`#- path: patches/cainjection_in_cronjobs.yaml`, `#`)
`#- path: patches/cainjection_in_batch_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 = `#- patches/webhook_in_%s_%s.yaml
`
caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml
caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s_%s.yaml
`
)

Expand All @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap {

// Generate resource code fragments
webhookPatch := make([]string, 0)
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural))
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Generate resource code fragments
caInjectionPatch := make([]string, 0)
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural))
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Only store code fragments in the map if the slices are non-empty
if len(res) != 0 {
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 = `#- path: patches/webhook_in_%s.yaml
webhookPatchCodeFragment = `#- path: patches/webhook_in_%s_%s.yaml
`
caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s.yaml
caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s_%s.yaml
`
)

Expand All @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap {

// Generate resource code fragments
webhookPatch := make([]string, 0)
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural))
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Generate resource code fragments
caInjectionPatch := make([]string, 0)
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural))
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Only store code fragments in the map if the slices are non-empty
if len(res) != 0 {
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 = `#- patches/webhook_in_%s_%s.yaml
`
caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml
caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s_%s.yaml
`
)

Expand All @@ -84,11 +84,11 @@ func (f *Kustomization) GetCodeFragments() machinery.CodeFragmentsMap {

// Generate resource code fragments
webhookPatch := make([]string, 0)
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Plural))
webhookPatch = append(webhookPatch, fmt.Sprintf(webhookPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Generate resource code fragments
caInjectionPatch := make([]string, 0)
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Plural))
caInjectionPatch = append(caInjectionPatch, fmt.Sprintf(caInjectionPatchCodeFragment, f.Resource.Group, f.Resource.Plural))

// Only store code fragments in the map if the slices are non-empty
if len(res) != 0 {
Expand Down

0 comments on commit b4cfeec

Please sign in to comment.