Skip to content

Commit 8b0f136

Browse files
authored
Merge pull request #2753 from camilamacedo86/update-samples
🌱 ( testdata samples / ci ) ensure that project-v3 and project-v3-with-kustomize does the same scaffold
2 parents dcc5bb4 + 9a814b5 commit 8b0f136

File tree

13 files changed

+27
-26
lines changed

13 files changed

+27
-26
lines changed

test/testdata/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function scaffold_test_project {
5050
$kb create api --group crew --version v1 --kind Captain --controller=true --resource=true --make=false
5151
$kb create api --group crew --version v1 --kind Captain --controller=true --resource=true --make=false --force
5252
$kb create webhook --group crew --version v1 --kind Captain --defaulting --programmatic-validation
53-
if [ $project == "project-v3" ]; then
53+
if [ $project == "project-v3" ] || [ $project == "project-v3-with-kustomize-v2" ]; then
5454
$kb create webhook --group crew --version v1 --kind Captain --defaulting --programmatic-validation --force
5555
fi
5656

@@ -61,7 +61,7 @@ function scaffold_test_project {
6161
fi
6262
$kb create webhook --group crew --version v1 --kind FirstMate --conversion
6363

64-
if [ $project == "project-v3" ]; then
64+
if [ $project == "project-v3" ] || [ $project == "project-v3-with-kustomize-v2" ]; then
6565
$kb create api --group crew --version v1 --kind Admiral --plural=admirales --controller=true --resource=true --namespaced=false --make=false
6666
$kb create webhook --group crew --version v1 --kind Admiral --plural=admirales --defaulting
6767
else

testdata/project-v3-with-kustomize-v2/PROJECT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ resources:
3737
group: crew
3838
kind: Admiral
3939
path: sigs.k8s.io/kubebuilder/testdata/project-v3-with-kustomize-v2/api/v1
40+
plural: admirales
4041
version: v1
4142
webhooks:
4243
defaulting: true

testdata/project-v3-with-kustomize-v2/api/v1/admiral_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ type AdmiralStatus struct {
4040

4141
//+kubebuilder:object:root=true
4242
//+kubebuilder:subresource:status
43-
//+kubebuilder:resource:scope=Cluster
43+
//+kubebuilder:resource:path=admirales,scope=Cluster
4444

45-
// Admiral is the Schema for the admirals API
45+
// Admiral is the Schema for the admirales API
4646
type Admiral struct {
4747
metav1.TypeMeta `json:",inline"`
4848
metav1.ObjectMeta `json:"metadata,omitempty"`

testdata/project-v3-with-kustomize-v2/api/v1/admiral_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (r *Admiral) SetupWebhookWithManager(mgr ctrl.Manager) error {
3333

3434
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3535

36-
//+kubebuilder:webhook:path=/mutate-crew-testproject-org-v1-admiral,mutating=true,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=admirals,verbs=create;update,versions=v1,name=madmiral.kb.io,admissionReviewVersions=v1
36+
//+kubebuilder:webhook:path=/mutate-crew-testproject-org-v1-admiral,mutating=true,failurePolicy=fail,sideEffects=None,groups=crew.testproject.org,resources=admirales,verbs=create;update,versions=v1,name=madmiral.kb.io,admissionReviewVersions=v1
3737

3838
var _ webhook.Defaulter = &Admiral{}
3939

testdata/project-v3-with-kustomize-v2/config/crd/bases/crew.testproject.org_admirals.yaml renamed to testdata/project-v3-with-kustomize-v2/config/crd/bases/crew.testproject.org_admirales.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.9.0
77
creationTimestamp: null
8-
name: admirals.crew.testproject.org
8+
name: admirales.crew.testproject.org
99
spec:
1010
group: crew.testproject.org
1111
names:
1212
kind: Admiral
1313
listKind: AdmiralList
14-
plural: admirals
14+
plural: admirales
1515
singular: admiral
1616
scope: Cluster
1717
versions:
1818
- name: v1
1919
schema:
2020
openAPIV3Schema:
21-
description: Admiral is the Schema for the admirals API
21+
description: Admiral is the Schema for the admirales API
2222
properties:
2323
apiVersion:
2424
description: 'APIVersion defines the versioned schema of this representation

testdata/project-v3-with-kustomize-v2/config/crd/kustomization.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
resources:
55
- bases/crew.testproject.org_captains.yaml
66
- bases/crew.testproject.org_firstmates.yaml
7-
- bases/crew.testproject.org_admirals.yaml
7+
- bases/crew.testproject.org_admirales.yaml
88
#+kubebuilder:scaffold:crdkustomizeresource
99

1010
patchesStrategicMerge:
1111
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1212
# patches here are for enabling the conversion webhook for each CRD
1313
#- patches/webhook_in_captains.yaml
1414
#- patches/webhook_in_firstmates.yaml
15-
#- patches/webhook_in_admirals.yaml
15+
#- patches/webhook_in_admirales.yaml
1616
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1717

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

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

testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirals.yaml renamed to testdata/project-v3-with-kustomize-v2/config/crd/patches/cainjection_in_admirales.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
7-
name: admirals.crew.testproject.org
7+
name: admirales.crew.testproject.org

testdata/project-v3-with-kustomize-v2/config/crd/patches/webhook_in_admirals.yaml renamed to testdata/project-v3-with-kustomize-v2/config/crd/patches/webhook_in_admirales.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
5-
name: admirals.crew.testproject.org
5+
name: admirales.crew.testproject.org
66
spec:
77
conversion:
88
strategy: Webhook

testdata/project-v3-with-kustomize-v2/config/rbac/admiral_editor_role.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# permissions for end users to edit admirals.
1+
# permissions for end users to edit admirales.
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
@@ -7,7 +7,7 @@ rules:
77
- apiGroups:
88
- crew.testproject.org
99
resources:
10-
- admirals
10+
- admirales
1111
verbs:
1212
- create
1313
- delete
@@ -19,6 +19,6 @@ rules:
1919
- apiGroups:
2020
- crew.testproject.org
2121
resources:
22-
- admirals/status
22+
- admirales/status
2323
verbs:
2424
- get
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# permissions for end users to view admirals.
1+
# permissions for end users to view admirales.
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
@@ -7,14 +7,14 @@ rules:
77
- apiGroups:
88
- crew.testproject.org
99
resources:
10-
- admirals
10+
- admirales
1111
verbs:
1212
- get
1313
- list
1414
- watch
1515
- apiGroups:
1616
- crew.testproject.org
1717
resources:
18-
- admirals/status
18+
- admirales/status
1919
verbs:
2020
- get

0 commit comments

Comments
 (0)