Skip to content

Commit 3d3bfc1

Browse files
authored
Merge pull request #409 from hypnoglow/fix-singular
🐛Fix singular argument for resource marker
2 parents 075d9a8 + 866d706 commit 3d3bfc1

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

pkg/crd/markers/crd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ func (s Resource) ApplyToCRD(crd *apiext.CustomResourceDefinitionSpec, version s
277277
if s.Path != "" {
278278
crd.Names.Plural = s.Path
279279
}
280+
if s.Singular != "" {
281+
crd.Names.Singular = s.Singular
282+
}
280283
crd.Names.ShortNames = s.ShortName
281284
crd.Names.Categories = s.Categories
282285

pkg/crd/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (p *Parser) NeedCRDFor(groupKind schema.GroupKind, maxDescLen *int) {
120120
}
121121
}
122122

123-
// fix the name if the plural was changed (this is the form the name *has* to take, so no harm in chaning it).
123+
// fix the name if the plural was changed (this is the form the name *has* to take, so no harm in changing it).
124124
crd.Name = crd.Spec.Names.Plural + "." + groupKind.Group
125125

126126
// nothing to actually write

pkg/crd/testdata/cronjob_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ type CronJobStatus struct {
227227

228228
// +kubebuilder:object:root=true
229229
// +kubebuilder:subresource:status
230-
// +kubebuilder:resource
230+
// +kubebuilder:resource:singular=mycronjob
231231

232232
// CronJob is the Schema for the cronjobs API
233233
type CronJob struct {

pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
kind: CronJob
1414
listKind: CronJobList
1515
plural: cronjobs
16-
singular: cronjob
16+
singular: mycronjob
1717
scope: Namespaced
1818
versions:
1919
- name: v1

0 commit comments

Comments
 (0)