Skip to content

Commit

Permalink
Merge pull request #3483 from kubernetes-sigs/master
Browse files Browse the repository at this point in the history
馃悰 Sync with master to address 2 bug fixes
  • Loading branch information
k8s-ci-robot committed Jul 3, 2023
2 parents 3a3d1d9 + 4f7751a commit 1dc8ed9
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
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
1 change: 1 addition & 0 deletions docs/book/src/cronjob-tutorial/testdata/project/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
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
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
3 changes: 1 addition & 2 deletions pkg/plugins/golang/declarative/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ import (
"errors"
"fmt"

goPluginV3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"

"sigs.k8s.io/kubebuilder/v3/pkg/config"
"sigs.k8s.io/kubebuilder/v3/pkg/machinery"
"sigs.k8s.io/kubebuilder/v3/pkg/model/resource"
"sigs.k8s.io/kubebuilder/v3/pkg/plugin"
"sigs.k8s.io/kubebuilder/v3/pkg/plugin/util"
"sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/declarative/v1/scaffolds"
goPluginV2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2"
goPluginV3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ bin
# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Dockerfile.cross
# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Dockerfile.cross
# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/v4/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ Count int `+"`"+`json:"count,omitempty"`+"`"+`
ExpectWithOffset(1, err).NotTo(HaveOccurred())

By("uncomment kustomization.yaml to enable webhook and ca injection")
ExpectWithOffset(1, pluginutil.UncommentCode(
filepath.Join(kbc.Dir, "config", "crd", "kustomization.yaml"),
fmt.Sprintf("#- path: patches/webhook_in_%s.yaml", kbc.Resources), "#")).To(Succeed())
ExpectWithOffset(1, pluginutil.UncommentCode(
filepath.Join(kbc.Dir, "config", "crd", "kustomization.yaml"),
fmt.Sprintf("#- path: patches/cainjection_in_%s.yaml", kbc.Resources), "#")).To(Succeed())
ExpectWithOffset(1, pluginutil.UncommentCode(
filepath.Join(kbc.Dir, "config", "default", "kustomization.yaml"),
"#- ../webhook", "#")).To(Succeed())
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bin

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
1 change: 1 addition & 0 deletions testdata/project-v3/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
1 change: 1 addition & 0 deletions testdata/project-v4-declarative-v1/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
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
1 change: 1 addition & 0 deletions testdata/project-v4-with-deploy-image/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
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
1 change: 1 addition & 0 deletions testdata/project-v4-with-grafana/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dockerfile.cross

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
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 1dc8ed9

Please sign in to comment.