Skip to content

Commit 1f774a5

Browse files
authored
Merge pull request #4894 from camilamacedo86/full-fix-conditions
✨ (deploy-image/v1alpha1) : Improve clarity and human readability of conditions field documentation in CRDs.
2 parents f292f90 + d2918c9 commit 1f774a5

File tree

18 files changed

+267
-63
lines changed

18 files changed

+267
-63
lines changed

docs/book/src/getting-started/testdata/project/api/v1alpha1/memcached_types.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,20 @@ type MemcachedSpec struct {
4242

4343
// MemcachedStatus defines the observed state of Memcached.
4444
type MemcachedStatus struct {
45-
// Represents the observations of a Memcached's current state.
46-
// Memcached.status.conditions.type are: "Available", "Progressing", and "Degraded"
47-
// Memcached.status.conditions.status are one of True, False, Unknown.
48-
// Memcached.status.conditions.reason the value should be a CamelCase string and producers of specific
49-
// condition types may define expected values and meanings for this field, and whether the values
50-
// are considered a guaranteed API.
51-
// Memcached.status.conditions.Message is a human readable message indicating details about the transition.
52-
// For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
53-
45+
// For Kubernetes API conventions, see:
46+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
47+
48+
// conditions represent the current state of the Memcached resource.
49+
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
50+
//
51+
// Standard condition types include:
52+
// - "Available": the resource is fully functional.
53+
// - "Progressing": the resource is being created or updated.
54+
// - "Degraded": the resource failed to reach or maintain its desired state.
55+
//
56+
// The status of each condition is one of True, False, or Unknown.
57+
// +listType=map
58+
// +listMapKey=type
5459
Conditions []metav1.Condition `json:"conditions,omitempty"`
5560
}
5661

docs/book/src/getting-started/testdata/project/config/crd/bases/cache.example.com_memcacheds.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ spec:
5353
description: MemcachedStatus defines the observed state of Memcached.
5454
properties:
5555
conditions:
56+
description: |-
57+
conditions represent the current state of the Memcached resource.
58+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
59+
60+
Standard condition types include:
61+
- "Available": the resource is fully functional.
62+
- "Progressing": the resource is being created or updated.
63+
- "Degraded": the resource failed to reach or maintain its desired state.
64+
65+
The status of each condition is one of True, False, or Unknown.
5666
items:
5767
description: Condition contains details for one aspect of the current
5868
state of this API Resource.
@@ -108,6 +118,9 @@ spec:
108118
- type
109119
type: object
110120
type: array
121+
x-kubernetes-list-map-keys:
122+
- type
123+
x-kubernetes-list-type: map
111124
type: object
112125
type: object
113126
served: true

docs/book/src/getting-started/testdata/project/dist/chart/templates/crd/cache.example.com_memcacheds.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ spec:
5959
description: MemcachedStatus defines the observed state of Memcached.
6060
properties:
6161
conditions:
62+
description: |-
63+
conditions represent the current state of the Memcached resource.
64+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
65+
66+
Standard condition types include:
67+
- "Available": the resource is fully functional.
68+
- "Progressing": the resource is being created or updated.
69+
- "Degraded": the resource failed to reach or maintain its desired state.
70+
71+
The status of each condition is one of True, False, or Unknown.
6272
items:
6373
description: Condition contains details for one aspect of the current
6474
state of this API Resource.
@@ -114,6 +124,9 @@ spec:
114124
- type
115125
type: object
116126
type: array
127+
x-kubernetes-list-map-keys:
128+
- type
129+
x-kubernetes-list-type: map
117130
type: object
118131
type: object
119132
served: true

docs/book/src/getting-started/testdata/project/dist/install.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ spec:
6161
description: MemcachedStatus defines the observed state of Memcached.
6262
properties:
6363
conditions:
64+
description: |-
65+
conditions represent the current state of the Memcached resource.
66+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
67+
68+
Standard condition types include:
69+
- "Available": the resource is fully functional.
70+
- "Progressing": the resource is being created or updated.
71+
- "Degraded": the resource failed to reach or maintain its desired state.
72+
73+
The status of each condition is one of True, False, or Unknown.
6474
items:
6575
description: Condition contains details for one aspect of the current
6676
state of this API Resource.
@@ -116,6 +126,9 @@ spec:
116126
- type
117127
type: object
118128
type: array
129+
x-kubernetes-list-map-keys:
130+
- type
131+
x-kubernetes-list-type: map
119132
type: object
120133
type: object
121134
served: true

hack/docs/internal/getting-started/generate_getting_started.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,20 @@ const (
256256
const oldStatusAPI = `// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
257257
// Important: Run "make" to regenerate code after modifying this file`
258258

259-
const newStatusAPI = `// Represents the observations of a Memcached's current state.
260-
// Memcached.status.conditions.type are: "Available", "Progressing", and "Degraded"
261-
// Memcached.status.conditions.status are one of True, False, Unknown.
262-
// Memcached.status.conditions.reason the value should be a CamelCase string and producers of specific
263-
// condition types may define expected values and meanings for this field, and whether the values
264-
// are considered a guaranteed API.
265-
// Memcached.status.conditions.Message is a human readable message indicating details about the transition.
266-
// For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
267-
259+
const newStatusAPI = `// For Kubernetes API conventions, see:
260+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
261+
262+
// conditions represent the current state of the Memcached resource.
263+
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
264+
//
265+
// Standard condition types include:
266+
// - "Available": the resource is fully functional.
267+
// - "Progressing": the resource is being created or updated.
268+
// - "Degraded": the resource failed to reach or maintain its desired state.
269+
//
270+
// The status of each condition is one of True, False, or Unknown.
271+
// +listType=map
272+
// +listMapKey=type
268273
Conditions []metav1.Condition ` + "`json:\"conditions,omitempty\"`"
269274

270275
const sampleSizeFragment = `# TODO(user): edit the following value to ensure the number

pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/api/types.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,20 @@ type {{ .Resource.Kind }}Spec struct {
9292
9393
// {{ .Resource.Kind }}Status defines the observed state of {{ .Resource.Kind }}
9494
type {{ .Resource.Kind }}Status struct {
95-
// Represents the observations of a {{ .Resource.Kind }}'s current state.
96-
// {{ .Resource.Kind }}.status.conditions.type are: "Available", "Progressing", and "Degraded"
97-
// {{ .Resource.Kind }}.status.conditions.status are one of True, False, Unknown.
98-
// {{ .Resource.Kind }}.status.conditions.reason the value should be a CamelCase string and producers of specific
99-
// condition types may define expected values and meanings for this field, and whether the values
100-
// are considered a guaranteed API.
101-
// {{ .Resource.Kind }}.status.conditions.Message is a human readable message indicating details about the transition.
102-
// For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
103-
95+
// For Kubernetes API conventions, see:
96+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
97+
98+
// conditions represent the current state of the {{ .Resource.Kind }} resource.
99+
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
100+
//
101+
// Standard condition types include:
102+
// - "Available": the resource is fully functional.
103+
// - "Progressing": the resource is being created or updated.
104+
// - "Degraded": the resource failed to reach or maintain its desired state.
105+
//
106+
// The status of each condition is one of True, False, or Unknown.
107+
// +listType=map
108+
// +listMapKey=type
104109
Conditions []metav1.Condition ` + "`" + `json:"conditions,omitempty"` + "`" + `
105110
}
106111

testdata/project-v4-multigroup/api/example.com/v1alpha1/busybox_types.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,20 @@ type BusyboxSpec struct {
3939

4040
// BusyboxStatus defines the observed state of Busybox
4141
type BusyboxStatus struct {
42-
// Represents the observations of a Busybox's current state.
43-
// Busybox.status.conditions.type are: "Available", "Progressing", and "Degraded"
44-
// Busybox.status.conditions.status are one of True, False, Unknown.
45-
// Busybox.status.conditions.reason the value should be a CamelCase string and producers of specific
46-
// condition types may define expected values and meanings for this field, and whether the values
47-
// are considered a guaranteed API.
48-
// Busybox.status.conditions.Message is a human readable message indicating details about the transition.
49-
// For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
50-
42+
// For Kubernetes API conventions, see:
43+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
44+
45+
// conditions represent the current state of the Busybox resource.
46+
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
47+
//
48+
// Standard condition types include:
49+
// - "Available": the resource is fully functional.
50+
// - "Progressing": the resource is being created or updated.
51+
// - "Degraded": the resource failed to reach or maintain its desired state.
52+
//
53+
// The status of each condition is one of True, False, or Unknown.
54+
// +listType=map
55+
// +listMapKey=type
5156
Conditions []metav1.Condition `json:"conditions,omitempty"`
5257
}
5358

testdata/project-v4-multigroup/api/example.com/v1alpha1/memcached_types.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,20 @@ type MemcachedSpec struct {
4242

4343
// MemcachedStatus defines the observed state of Memcached
4444
type MemcachedStatus struct {
45-
// Represents the observations of a Memcached's current state.
46-
// Memcached.status.conditions.type are: "Available", "Progressing", and "Degraded"
47-
// Memcached.status.conditions.status are one of True, False, Unknown.
48-
// Memcached.status.conditions.reason the value should be a CamelCase string and producers of specific
49-
// condition types may define expected values and meanings for this field, and whether the values
50-
// are considered a guaranteed API.
51-
// Memcached.status.conditions.Message is a human readable message indicating details about the transition.
52-
// For further information see: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
53-
45+
// For Kubernetes API conventions, see:
46+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
47+
48+
// conditions represent the current state of the Memcached resource.
49+
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
50+
//
51+
// Standard condition types include:
52+
// - "Available": the resource is fully functional.
53+
// - "Progressing": the resource is being created or updated.
54+
// - "Degraded": the resource failed to reach or maintain its desired state.
55+
//
56+
// The status of each condition is one of True, False, or Unknown.
57+
// +listType=map
58+
// +listMapKey=type
5459
Conditions []metav1.Condition `json:"conditions,omitempty"`
5560
}
5661

testdata/project-v4-multigroup/config/crd/bases/example.com.testproject.org_busyboxes.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ spec:
5353
description: BusyboxStatus defines the observed state of Busybox
5454
properties:
5555
conditions:
56+
description: |-
57+
conditions represent the current state of the Busybox resource.
58+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
59+
60+
Standard condition types include:
61+
- "Available": the resource is fully functional.
62+
- "Progressing": the resource is being created or updated.
63+
- "Degraded": the resource failed to reach or maintain its desired state.
64+
65+
The status of each condition is one of True, False, or Unknown.
5666
items:
5767
description: Condition contains details for one aspect of the current
5868
state of this API Resource.
@@ -108,6 +118,9 @@ spec:
108118
- type
109119
type: object
110120
type: array
121+
x-kubernetes-list-map-keys:
122+
- type
123+
x-kubernetes-list-type: map
111124
type: object
112125
type: object
113126
served: true

testdata/project-v4-multigroup/config/crd/bases/example.com.testproject.org_memcacheds.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ spec:
5858
description: MemcachedStatus defines the observed state of Memcached
5959
properties:
6060
conditions:
61+
description: |-
62+
conditions represent the current state of the Memcached resource.
63+
Each condition has a unique type and reflects the status of a specific aspect of the resource.
64+
65+
Standard condition types include:
66+
- "Available": the resource is fully functional.
67+
- "Progressing": the resource is being created or updated.
68+
- "Degraded": the resource failed to reach or maintain its desired state.
69+
70+
The status of each condition is one of True, False, or Unknown.
6171
items:
6272
description: Condition contains details for one aspect of the current
6373
state of this API Resource.
@@ -113,6 +123,9 @@ spec:
113123
- type
114124
type: object
115125
type: array
126+
x-kubernetes-list-map-keys:
127+
- type
128+
x-kubernetes-list-type: map
116129
type: object
117130
type: object
118131
served: true

0 commit comments

Comments
 (0)