Skip to content

Commit f6da107

Browse files
authored
Add Annotations to Component; editing pass on CRD comments (#103)
1 parent a0ae14f commit f6da107

File tree

4 files changed

+142
-54
lines changed

4 files changed

+142
-54
lines changed

api/v1beta2/appwrapper_types.go

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,57 +22,88 @@ import (
2222
runtime "k8s.io/apimachinery/pkg/runtime"
2323
)
2424

25-
// AppWrapperSpec defines the desired state of the appwrapper
25+
// AppWrapperSpec defines the desired state of the AppWrapper
2626
type AppWrapperSpec struct {
27-
// Components lists the components in the job
27+
// Components lists the components contained in the AppWrapper
2828
Components []AppWrapperComponent `json:"components"`
2929

30-
// Suspend suspends the job when set to true
30+
// Suspend suspends the AppWrapper when set to true
31+
//+optional
3132
Suspend bool `json:"suspend,omitempty"`
3233
}
3334

34-
// AppWrapperComponent describes a wrapped resource
35+
// AppWrapperComponent describes a single wrapped Kubernetes resource
3536
type AppWrapperComponent struct {
36-
// PodSets contained in the component
37+
// Annotations is an unstructured key value map that may be used to store and retrieve
38+
// arbitrary metadata about the Component to customize its treatment by the AppWrapper controller.
39+
//+optional
40+
Annotations map[string]string `json:"annotations,omitempty"`
41+
42+
// PodSets contained in the Component
43+
//+optional
3744
PodSets []AppWrapperPodSet `json:"podSets,omitempty"`
3845

39-
// PodSetInfos assigned to the Component by Kueue
46+
// PodSetInfos assigned to the Component's PodSets by Kueue
47+
//+optional
4048
PodSetInfos []AppWrapperPodSetInfo `json:"podSetInfos,omitempty"`
4149

4250
// +kubebuilder:pruning:PreserveUnknownFields
4351
// +kubebuilder:validation:EmbeddedResource
44-
// Template for the component
52+
// Template defines the Kubernetes resource for the Component
4553
Template runtime.RawExtension `json:"template"`
4654
}
4755

4856
// AppWrapperPodSet describes an homogeneous set of pods
4957
type AppWrapperPodSet struct {
50-
// Replicas is the number of pods in the set
58+
// Replicas is the number of pods in this PodSet
59+
//+optional
5160
Replicas *int32 `json:"replicas,omitempty"`
5261

53-
// ReplicaPath is the path to the replica count for the set
62+
// ReplicaPath is the path within Component.Template to the replica count for this PodSet
63+
//+optional
5464
ReplicaPath string `json:"replicaPath,omitempty"`
5565

56-
// PodPath is the path to the PodTemplateSpec
66+
// PodPath is the path Component.Template to the PodTemplateSpec for this PodSet
5767
PodPath string `json:"podPath"`
5868
}
5969

70+
// AppWrapperPodSetInfo contains the data that Kueue wants to inject into an admitted PodSpecTemplate
6071
type AppWrapperPodSetInfo struct {
61-
Annotations map[string]string `json:"annotations,omitempty"`
62-
Labels map[string]string `json:"labels,omitempty"`
63-
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
64-
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
72+
// Annotations to be added to the PodSpecTemplate
73+
//+optional
74+
Annotations map[string]string `json:"annotations,omitempty"`
75+
// Labels to be added to the PodSepcTemplate
76+
//+optional
77+
Labels map[string]string `json:"labels,omitempty"`
78+
// NodeSelectors to be added to the PodSpecTemplate
79+
//+optional
80+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
81+
// Tolerations to be added to the PodSpecTemplate
82+
//+optional
83+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
6584
}
6685

6786
// AppWrapperStatus defines the observed state of the appwrapper
6887
type AppWrapperStatus struct {
6988
// Phase of the AppWrapper object
89+
//+optional
7090
Phase AppWrapperPhase `json:"phase,omitempty"`
7191

7292
// Retries counts the number of times the AppWrapper has entered the Resetting Phase
93+
//+optional
7394
Retries int32 `json:"resettingCount,omitempty"`
7495

75-
// Conditions
96+
// Conditions hold the latest available observations of the AppWrapper current state.
97+
//
98+
// The type of the condition could be:
99+
//
100+
// - QuotaReserved: The AppWrapper was admitted by Kueue and has quota allocated to it
101+
// - ResourcesDeployed: The contained resources are deployed (or being deployed) on the cluster
102+
// - PodsReady: All pods of the contained resources are in the Ready or Succeeded state
103+
// - Unhealthy: One or more of the contained resources is unhealthy
104+
// - DeletingResources: The contained resources are in the process of being deleted from the cluster
105+
//
106+
//+optional
76107
Conditions []metav1.Condition `json:"conditions,omitempty"`
77108
}
78109

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/workload.codeflare.dev_appwrappers.yaml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,45 @@ spec:
5050
metadata:
5151
type: object
5252
spec:
53-
description: AppWrapperSpec defines the desired state of the appwrapper
53+
description: AppWrapperSpec defines the desired state of the AppWrapper
5454
properties:
5555
components:
56-
description: Components lists the components in the job
56+
description: Components lists the components contained in the AppWrapper
5757
items:
58-
description: AppWrapperComponent describes a wrapped resource
58+
description: AppWrapperComponent describes a single wrapped Kubernetes
59+
resource
5960
properties:
61+
annotations:
62+
additionalProperties:
63+
type: string
64+
description: |-
65+
Annotations is an unstructured key value map that may be used to store and retrieve
66+
arbitrary metadata about the Component to customize its treatment by the AppWrapper controller.
67+
type: object
6068
podSetInfos:
61-
description: PodSetInfos assigned to the Component by Kueue
69+
description: PodSetInfos assigned to the Component's PodSets
70+
by Kueue
6271
items:
72+
description: AppWrapperPodSetInfo contains the data that Kueue
73+
wants to inject into an admitted PodSpecTemplate
6374
properties:
6475
annotations:
6576
additionalProperties:
6677
type: string
78+
description: Annotations to be added to the PodSpecTemplate
6779
type: object
6880
labels:
6981
additionalProperties:
7082
type: string
83+
description: Labels to be added to the PodSepcTemplate
7184
type: object
7285
nodeSelector:
7386
additionalProperties:
7487
type: string
88+
description: NodeSelectors to be added to the PodSpecTemplate
7589
type: object
7690
tolerations:
91+
description: Tolerations to be added to the PodSpecTemplate
7792
items:
7893
description: |-
7994
The pod this Toleration is attached to tolerates any taint that matches
@@ -114,28 +129,30 @@ spec:
114129
type: object
115130
type: array
116131
podSets:
117-
description: PodSets contained in the component
132+
description: PodSets contained in the Component
118133
items:
119134
description: AppWrapperPodSet describes an homogeneous set
120135
of pods
121136
properties:
122137
podPath:
123-
description: PodPath is the path to the PodTemplateSpec
138+
description: PodPath is the path Component.Template to
139+
the PodTemplateSpec for this PodSet
124140
type: string
125141
replicaPath:
126-
description: ReplicaPath is the path to the replica count
127-
for the set
142+
description: ReplicaPath is the path within Component.Template
143+
to the replica count for this PodSet
128144
type: string
129145
replicas:
130-
description: Replicas is the number of pods in the set
146+
description: Replicas is the number of pods in this PodSet
131147
format: int32
132148
type: integer
133149
required:
134150
- podPath
135151
type: object
136152
type: array
137153
template:
138-
description: Template for the component
154+
description: Template defines the Kubernetes resource for the
155+
Component
139156
type: object
140157
x-kubernetes-embedded-resource: true
141158
x-kubernetes-preserve-unknown-fields: true
@@ -144,7 +161,7 @@ spec:
144161
type: object
145162
type: array
146163
suspend:
147-
description: Suspend suspends the job when set to true
164+
description: Suspend suspends the AppWrapper when set to true
148165
type: boolean
149166
required:
150167
- components
@@ -153,7 +170,18 @@ spec:
153170
description: AppWrapperStatus defines the observed state of the appwrapper
154171
properties:
155172
conditions:
156-
description: Conditions
173+
description: |-
174+
Conditions hold the latest available observations of the AppWrapper current state.
175+
176+
177+
The type of the condition could be:
178+
179+
180+
- QuotaReserved: The AppWrapper was admitted by Kueue and has quota allocated to it
181+
- ResourcesDeployed: The contained resources are deployed (or being deployed) on the cluster
182+
- PodsReady: All pods of the contained resources are in the Ready or Succeeded state
183+
- Unhealthy: One or more of the contained resources is unhealthy
184+
- DeletingResources: The contained resources are in the process of being deleted from the cluster
157185
items:
158186
description: "Condition contains details for one aspect of the current
159187
state of this API Resource.\n---\nThis struct is intended for

0 commit comments

Comments
 (0)