Skip to content

Commit c119ec1

Browse files
committed
fix: Add Markers and Move Comments for API Docs
Update our code comment markers and copyright notice placement so that the elastic/crd-ref-docs tool can generate API reference docs: - Add `kubebuilder:object:root=true` marker for root CRD types. The crd-ref-docs tool looks for these to identify new `Kind` APIs. - Move copyright comments so they are not mistaken for package-level docs. Note - this only applies to the `v1beta1` API. Signed-off-by: Adam Kaplan <[email protected]>
1 parent 6ddd5ec commit c119ec1

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

pkg/apis/build/v1beta1/build_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ type BuildStatus struct {
317317

318318
// +genclient
319319
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
320-
321-
// Build is the Schema representing a Build definition
320+
// +kubebuilder:object:root=true
322321
// +kubebuilder:subresource:status
323322
// +kubebuilder:storageversion
324323
// +kubebuilder:resource:path=builds,scope=Namespaced
@@ -327,6 +326,8 @@ type BuildStatus struct {
327326
// +kubebuilder:printcolumn:name="BuildStrategyKind",type="string",JSONPath=".spec.strategy.kind",description="The BuildStrategy type which is used for this Build"
328327
// +kubebuilder:printcolumn:name="BuildStrategyName",type="string",JSONPath=".spec.strategy.name",description="The BuildStrategy name which is used for this Build"
329328
// +kubebuilder:printcolumn:name="CreationTime",type="date",JSONPath=".metadata.creationTimestamp",description="The create time of this Build"
329+
330+
// Build is the Schema representing a Build definition
330331
type Build struct {
331332
metav1.TypeMeta `json:",inline"`
332333
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -336,6 +337,7 @@ type Build struct {
336337
}
337338

338339
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
340+
// +kubebuilder:object:root=true
339341

340342
// BuildList contains a list of Build
341343
type BuildList struct {

pkg/apis/build/v1beta1/buildrun_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,16 @@ type FailureDetails struct {
268268

269269
// +genclient
270270
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
271-
272-
// BuildRun is the Schema representing an instance of build execution
271+
// +kubebuilder:object:root=true
273272
// +kubebuilder:subresource:status
274273
// +kubebuilder:storageversion
275274
// +kubebuilder:resource:path=buildruns,scope=Namespaced,shortName=br;brs
276275
// +kubebuilder:printcolumn:name="Succeeded",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].status",description="The Succeeded status of the BuildRun"
277276
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].reason",description="The Succeeded reason of the BuildRun"
278277
// +kubebuilder:printcolumn:name="StartTime",type="date",JSONPath=".status.startTime",description="The start time of this BuildRun"
279278
// +kubebuilder:printcolumn:name="CompletionTime",type="date",JSONPath=".status.completionTime",description="The completion time of this BuildRun"
279+
280+
// BuildRun is the Schema representing an instance of build execution
280281
type BuildRun struct {
281282
metav1.TypeMeta `json:",inline"`
282283
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -286,6 +287,7 @@ type BuildRun struct {
286287
}
287288

288289
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
290+
// +kubebuilder:object:root=true
289291

290292
// BuildRunList contains a list of BuildRun
291293
type BuildRunList struct {

pkg/apis/build/v1beta1/buildstrategy_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ const (
2323

2424
// +genclient
2525
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
26-
27-
// BuildStrategy is the Schema representing a strategy in the namespace scope to build images from source code.
26+
// +kubebuilder:object:root=true
2827
// +kubebuilder:subresource:status
2928
// +kubebuilder:storageversion
3029
// +kubebuilder:resource:path=buildstrategies,scope=Namespaced,shortName=bs;bss
30+
31+
// BuildStrategy is the Schema representing a strategy in the namespace scope to build images from source code.
3132
type BuildStrategy struct {
3233
metav1.TypeMeta `json:",inline"`
3334
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -37,6 +38,7 @@ type BuildStrategy struct {
3738
}
3839

3940
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
41+
// +kubebuilder:object:root=true
4042

4143
// BuildStrategyList contains a list of BuildStrategy
4244
type BuildStrategyList struct {

pkg/apis/build/v1beta1/clusterbuildstrategy_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ const (
2424
// +genclient
2525
// +genclient:nonNamespaced
2626
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
27-
28-
// ClusterBuildStrategy is the Schema representing a strategy in the cluster scope to build images from source code.
27+
// +kubebuilder:object:root=true
2928
// +kubebuilder:subresource:status
3029
// +kubebuilder:storageversion
3130
// +kubebuilder:resource:path=clusterbuildstrategies,scope=Cluster,shortName=cbs;cbss
31+
32+
// ClusterBuildStrategy is the Schema representing a strategy in the cluster scope to build images from source code.
3233
type ClusterBuildStrategy struct {
3334
metav1.TypeMeta `json:",inline"`
3435
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -38,6 +39,7 @@ type ClusterBuildStrategy struct {
3839
}
3940

4041
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
42+
// +kubebuilder:object:root=true
4143

4244
// ClusterBuildStrategyList contains a list of ClusterBuildStrategy
4345
type ClusterBuildStrategyList struct {

pkg/apis/build/v1beta1/register.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
// NOTE: Boilerplate only. Ignore this file.
66

7-
// Package v1beta1 contains API Schema definitions for the build v1beta1 API group
8-
// +k8s:deepcopy-gen=package,register
9-
// +groupName=shipwright.io
107
package v1beta1
118

129
import (

pkg/apis/build/v1beta1/trigger.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright The Shipwright Contributors
22
//
33
// SPDX-License-Identifier: Apache-2.0
4+
45
package v1beta1
56

67
// Trigger represents the webhook trigger configuration for a Build.

pkg/apis/build/v1beta1/trigger_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright The Shipwright Contributors
22
//
33
// SPDX-License-Identifier: Apache-2.0
4+
45
package v1beta1
56

67
// TriggerType set of TriggerWhen valid names.

pkg/apis/build/v1beta1/trigger_when.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright The Shipwright Contributors
22
//
33
// SPDX-License-Identifier: Apache-2.0
4+
45
package v1beta1
56

67
// TriggerWhen a given scenario where the webhook trigger is applicable.

0 commit comments

Comments
 (0)