Skip to content

Commit efdc4f0

Browse files
🐛 (deploy-image/v1-alpha) : remove the namespaced option
1 parent 1502ede commit efdc4f0

File tree

17 files changed

+16
-16
lines changed

17 files changed

+16
-16
lines changed

pkg/plugins/golang/deploy-image/v1alpha1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func (p *createAPISubcommand) BindFlags(fs *pflag.FlagSet) {
135135
"version of CustomResourceDefinition to scaffold. Options: [v1, v1beta1]")
136136

137137
fs.StringVar(&p.options.Plural, "plural", "", "resource irregular plural form")
138-
fs.BoolVar(&p.options.Namespaced, "namespaced", true, "resource is namespaced")
139138

140139
// (not required raise an error in this case)
141140
// nolint:errcheck,gosec
@@ -152,6 +151,7 @@ func (p *createAPISubcommand) InjectResource(res *resource.Resource) error {
152151
p.resource = res
153152
p.options.DoAPI = true
154153
p.options.DoController = true
154+
p.options.Namespaced = true
155155
p.options.UpdateResource(p.resource, p.config)
156156

157157
if err := p.resource.Validate(); err != nil {

pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller-test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ var _ = Describe("{{ .Resource.Kind }} controller", func() {
8080
// Define utility constants for object names and testing timeouts/durations and intervals.
8181
const (
8282
{{ .Resource.Kind }}Name = "test-{{ lower .Resource.Kind }}"
83-
{{ .Resource.Kind }}Namespace = "test-{{ lower .Resource.Kind }}"
83+
{{ .Resource.Kind }}Namespace = "default"
8484
)
8585
8686
Context("{{ .Resource.Kind }} controller test", func() {

test/testdata/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ function scaffold_test_project {
109109
$kb create api --group crew --version v1 --kind Admiral --controller=true --resource=true --namespaced=false --make=false
110110
elif [[ $project =~ deploy-image ]]; then
111111
header_text 'Creating Memcached API with deploy-image plugin ...'
112-
$kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.4.36-alpine --image-container-command="memcached,-m=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false --namespaced=false
113-
$kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.28 --plugins="deploy-image/v1-alpha" --make=false --namespaced=false
112+
$kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.4.36-alpine --image-container-command="memcached,-m=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false
113+
$kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.28 --plugins="deploy-image/v1-alpha" --make=false
114114
header_text 'Creating Memcached webhook ...'
115115
$kb create webhook --group example.com --version v1alpha1 --kind Memcached --programmatic-validation
116116
elif [[ $project == "project-v3" || $project == "project-v4" ]]; then

testdata/project-v3-with-deploy-image/PROJECT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ repo: sigs.k8s.io/kubebuilder/testdata/project-v3-with-deploy-image
2424
resources:
2525
- api:
2626
crdVersion: v1
27+
namespaced: true
2728
controller: true
2829
domain: testproject.org
2930
group: example.com
@@ -35,6 +36,7 @@ resources:
3536
webhookVersion: v1
3637
- api:
3738
crdVersion: v1
39+
namespaced: true
3840
controller: true
3941
domain: testproject.org
4042
group: example.com

testdata/project-v3-with-deploy-image/api/v1alpha1/busybox_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type BusyboxStatus struct {
4040

4141
//+kubebuilder:object:root=true
4242
//+kubebuilder:subresource:status
43-
//+kubebuilder:resource:scope=Cluster
4443

4544
// Busybox is the Schema for the busyboxes API
4645
type Busybox struct {

testdata/project-v3-with-deploy-image/api/v1alpha1/memcached_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type MemcachedStatus struct {
4343

4444
//+kubebuilder:object:root=true
4545
//+kubebuilder:subresource:status
46-
//+kubebuilder:resource:scope=Cluster
4746

4847
// Memcached is the Schema for the memcacheds API
4948
type Memcached struct {

testdata/project-v3-with-deploy-image/config/crd/bases/example.com.testproject.org_busyboxes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
listKind: BusyboxList
1414
plural: busyboxes
1515
singular: busybox
16-
scope: Cluster
16+
scope: Namespaced
1717
versions:
1818
- name: v1alpha1
1919
schema:

testdata/project-v3-with-deploy-image/config/crd/bases/example.com.testproject.org_memcacheds.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
listKind: MemcachedList
1414
plural: memcacheds
1515
singular: memcached
16-
scope: Cluster
16+
scope: Namespaced
1717
versions:
1818
- name: v1alpha1
1919
schema:

testdata/project-v3-with-deploy-image/controllers/busybox_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Busybox controller", func() {
3737
// Define utility constants for object names and testing timeouts/durations and intervals.
3838
const (
3939
BusyboxName = "test-busybox"
40-
BusyboxNamespace = "test-busybox"
40+
BusyboxNamespace = "default"
4141
)
4242

4343
Context("Busybox controller test", func() {

testdata/project-v3-with-deploy-image/controllers/memcached_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Memcached controller", func() {
3737
// Define utility constants for object names and testing timeouts/durations and intervals.
3838
const (
3939
MemcachedName = "test-memcached"
40-
MemcachedNamespace = "test-memcached"
40+
MemcachedNamespace = "default"
4141
)
4242

4343
Context("Memcached controller test", func() {

0 commit comments

Comments
 (0)