Skip to content

Commit

Permalink
Merge pull request #1484 from camilamacedo86/set-status-subresource
Browse files Browse the repository at this point in the history
feat: scaffolded by default the subresource status
  • Loading branch information
k8s-ci-robot committed May 12, 2020
2 parents 45ade82 + 10e28db commit 1eccd8f
Show file tree
Hide file tree
Showing 56 changed files with 82 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/emptyapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ interface that all types representing Kinds must implement.
*/

// +kubebuilder:object:root=true

// +kubebuilder:subresource:status
// CronJob is the Schema for the cronjobs API
type CronJob struct {
metav1.TypeMeta `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/migration/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Our API types should look like the following:

```go
// +kubebuilder:object:root=true

// +kubebuilder:subresource:status
// CronJob is the Schema for the cronjobs API
type CronJob struct {...}

Expand Down
1 change: 1 addition & 0 deletions pkg/scaffold/internal/templates/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type {{ .Resource.Kind }}Status struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
{{ if not .Resource.Namespaced }} // +kubebuilder:resource:scope=Cluster {{ end }}
// {{ .Resource.Kind }} is the Schema for the {{ .Resource.Plural }} API
Expand Down
1 change: 1 addition & 0 deletions plugins/addon/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type {{.Resource.Kind}}Status struct {
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
{{ if not .Resource.Namespaced }} // +kubebuilder:resource:scope=Cluster {{ end }}
// {{.Resource.Kind}} is the Schema for the {{ .Resource.Plural }} API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/admiral_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type AdmiralStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Admiral is the Schema for the admirals API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/captain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type CaptainStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Captain is the Schema for the captains API
type Captain struct {
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/firstmate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type FirstMateStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// FirstMate is the Schema for the firstmates API
type FirstMate struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: admirals
singular: admiral
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Admiral is the Schema for the admirals API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: captains
singular: captain
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Captain is the Schema for the captains API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: firstmates
singular: firstmate
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: FirstMate is the Schema for the firstmates API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CaptainStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Captain is the Schema for the captains API
type Captain struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type HealthCheckPolicyStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// HealthCheckPolicy is the Schema for the healthcheckpolicies API
type HealthCheckPolicy struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type KrakenStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Kraken is the Schema for the krakens API
type Kraken struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type LeviathanStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Leviathan is the Schema for the leviathans API
type Leviathan struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DestroyerStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Destroyer is the Schema for the destroyers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type FrigateStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Frigate is the Schema for the frigates API
type Frigate struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CruiserStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Cruiser is the Schema for the cruisers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: captains
singular: captain
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Captain is the Schema for the captains API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: healthcheckpolicies
singular: healthcheckpolicy
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: HealthCheckPolicy is the Schema for the healthcheckpolicies API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: krakens
singular: kraken
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Kraken is the Schema for the krakens API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: leviathans
singular: leviathan
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Leviathan is the Schema for the leviathans API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: cruisers
singular: cruiser
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Cruiser is the Schema for the cruisers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: destroyers
singular: destroyer
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Destroyer is the Schema for the destroyers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: frigates
singular: frigate
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Frigate is the Schema for the frigates API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2/api/v1/admiral_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type AdmiralStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Admiral is the Schema for the admirals API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2/api/v1/captain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CaptainStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Captain is the Schema for the captains API
type Captain struct {
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2/api/v1/firstmate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type FirstMateStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// FirstMate is the Schema for the firstmates API
type FirstMate struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: admirals
singular: admiral
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Admiral is the Schema for the admirals API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: captains
singular: captain
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Captain is the Schema for the captains API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: firstmates
singular: firstmate
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: FirstMate is the Schema for the firstmates API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3-addon/api/v1/admiral_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type AdmiralStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Admiral is the Schema for the admirals API
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3-addon/api/v1/captain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type CaptainStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Captain is the Schema for the captains API
type Captain struct {
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3-addon/api/v1/firstmate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type FirstMateStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// FirstMate is the Schema for the firstmates API
type FirstMate struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: admirals
singular: admiral
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Admiral is the Schema for the admirals API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: captains
singular: captain
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Captain is the Schema for the captains API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: firstmates
singular: firstmate
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: FirstMate is the Schema for the firstmates API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CaptainStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Captain is the Schema for the captains API
type Captain struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type HealthCheckPolicyStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// HealthCheckPolicy is the Schema for the healthcheckpolicies API
type HealthCheckPolicy struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type KrakenStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Kraken is the Schema for the krakens API
type Kraken struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type LeviathanStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Leviathan is the Schema for the leviathans API
type Leviathan struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DestroyerStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Destroyer is the Schema for the destroyers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type FrigateStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Frigate is the Schema for the frigates API
type Frigate struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type CruiserStatus struct {
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Cruiser is the Schema for the cruisers API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: captains
singular: captain
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Captain is the Schema for the captains API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: healthcheckpolicies
singular: healthcheckpolicy
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: HealthCheckPolicy is the Schema for the healthcheckpolicies API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: krakens
singular: kraken
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Kraken is the Schema for the krakens API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
plural: leviathans
singular: leviathan
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Leviathan is the Schema for the leviathans API
Expand Down
Loading

0 comments on commit 1eccd8f

Please sign in to comment.