Skip to content

Commit 8974ea6

Browse files
committed
Remove non-generic resource items from AppWrapper API
1 parent d4d856b commit 8974ea6

File tree

19 files changed

+286
-5417
lines changed

19 files changed

+286
-5417
lines changed

Diff for: pkg/apis/controller/v1beta1/appwrapper.go

+16-63
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const AppWrapperPlural string = "appwrappers"
4242
// which AppWrapper it belongs to.
4343
const AppWrapperAnnotationKey = "appwrapper.mcad.ibm.com/appwrapper-name"
4444

45-
//+kubebuilder:object:root=true
46-
//+kubebuilder:subresource:status
45+
// +kubebuilder:object:root=true
46+
// +kubebuilder:subresource:status
4747

4848
// Definition of AppWrapper class
4949
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -54,7 +54,7 @@ type AppWrapper struct {
5454
Status AppWrapperStatus `json:"status,omitempty"`
5555
}
5656

57-
//+kubebuilder:object:root=true
57+
// +kubebuilder:object:root=true
5858

5959
// AppWrapperList is a collection of AppWrappers.
6060
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -89,8 +89,6 @@ type AppWrapperResourceList struct {
8989
metav1.TypeMeta `json:",inline"`
9090
metav1.ListMeta `json:"metadata"`
9191

92-
// +optional
93-
Items []AppWrapperResource `json:"Items"`
9492
// +optional
9593
GenericItems []AppWrapperGenericResource `json:"GenericItems"`
9694
}
@@ -100,42 +98,7 @@ type AppWrapperService struct {
10098
Spec v1.ServiceSpec `json:"spec"`
10199
}
102100

103-
// AppWrapperResource is App Wrapper aggregation resource
104-
//todo: To be depricated
105-
type AppWrapperResource struct {
106-
metav1.TypeMeta `json:",inline"`
107-
metav1.ObjectMeta `json:"metadata"`
108-
// Replicas is the number of desired replicas
109-
Replicas int32 `json:"replicas,omitempty" protobuf:"bytes,2,opt,name=replicas"`
110-
111-
// The minimal available pods to run for this AppWrapper; the default value is nil
112-
MinAvailable *int32 `json:"minavailable,omitempty" protobuf:"bytes,3,opt,name=minavailable"`
113-
114-
// The number of allocated replicas from this resource type
115-
// +optional
116-
AllocatedReplicas int32 `json:"allocatedreplicas"`
117-
118-
// +kubebuilder:validation:Type=number
119-
// +kubebuilder:validation:Format=float
120-
// +optional
121-
Priority float64 `json:"priority,omitempty"`
122-
123-
// The increasing rate of priority value for this resource
124-
// +kubebuilder:validation:Type=number
125-
// +kubebuilder:validation:Format=float
126-
PrioritySlope float64 `json:"priorityslope"`
127-
128-
//The type of the resource (is the resource a Pod, a ReplicaSet, a ... ?)
129-
// +optional
130-
Type ResourceType `json:"type"`
131-
132-
//The template for the resource; it is now a raw text because we don't know for what resource
133-
//it should be instantiated
134-
// +kubebuilder:pruning:PreserveUnknownFields
135-
Template runtime.RawExtension `json:"template"`
136-
}
137-
138-
// AppWrapperResource is App Wrapper aggregation resource
101+
// AppWrapperGenericResource is App Wrapper aggregation resource
139102
type AppWrapperGenericResource struct {
140103
metav1.TypeMeta `json:",inline"`
141104
metav1.ObjectMeta `json:"metadata"`
@@ -161,25 +124,25 @@ type AppWrapperGenericResource struct {
161124
// +kubebuilder:validation:Format=float
162125
PrioritySlope float64 `json:"priorityslope"`
163126

164-
//The template for the resource; it is now a raw text because we don't know for what resource
165-
//it should be instantiated
127+
// The template for the resource; it is now a raw text because we don't know for what resource
128+
// it should be instantiated
166129
// +optional
167130
// +kubebuilder:pruning:PreserveUnknownFields
168131
// +kubebuilder:validation:EmbeddedResource
169132
GenericTemplate runtime.RawExtension `json:"generictemplate"`
170133

171-
//Optional section that specifies resource requirements for non-standard k8s resources, follows same format as that
134+
// Optional section that specifies resource requirements for non-standard k8s resources, follows same format as that
172135
// of standard k8s resources
173136
CustomPodResources []CustomPodResourceTemplate `json:"custompodresources,omitempty"`
174137

175-
//Optional field for users to determine completion status of item
138+
// Optional field for users to determine completion status of item
176139
CompletionStatus string `json:"completionstatus,omitempty"`
177140
}
178141

179142
type CustomPodResourceTemplate struct {
180143
Replicas int `json:"replicas"`
181-
//todo: replace with
182-
//Containers []Container Contain v1.ResourceRequirements
144+
// todo: replace with
145+
// Containers []Container Contain v1.ResourceRequirements
183146
Requests v1.ResourceList `json:"requests"`
184147

185148
// +optional
@@ -190,17 +153,7 @@ type CustomPodResourceTemplate struct {
190153
type ResourceType string
191154

192155
const (
193-
ResourceTypePod ResourceType = "Pod"
194-
ResourceTypeService ResourceType = "Service"
195-
ResourceTypeSecret ResourceType = "Secret"
196-
ResourceTypeStatefulSet ResourceType = "StatefulSet"
197-
ResourceTypeDeployment ResourceType = "Deployment"
198-
ResourceTypeReplicaSet ResourceType = "ReplicaSet"
199-
ResourceTypePersistentVolume ResourceType = "PersistentVolume"
200-
ResourceTypePersistentVolumeClaim ResourceType = "PersistentVolumeClaim"
201-
ResourceTypeNamespace ResourceType = "Namespace"
202-
ResourceTypeConfigMap ResourceType = "ConfigMap"
203-
ResourceTypeNetworkPolicy ResourceType = "NetworkPolicy"
156+
ResourceTypePod ResourceType = "Pod"
204157
)
205158

206159
// AppWrapperStatus represents the current state of a AppWrapper
@@ -224,13 +177,13 @@ type AppWrapperStatus struct {
224177
// +optional
225178
MinAvailable int32 `json:"template,omitempty" protobuf:"bytes,4,opt,name=template"`
226179

227-
//Can run?
180+
// Can run?
228181
CanRun bool `json:"canrun,omitempty" protobuf:"bytes,1,opt,name=canrun"`
229182

230-
//Is Dispatched?
183+
// Is Dispatched?
231184
IsDispatched bool `json:"isdispatched,omitempty" protobuf:"bytes,1,opt,name=isdispatched"`
232185

233-
//State - Pending, Running, Failed, Deleted
186+
// State - Pending, Running, Failed, Deleted
234187
State AppWrapperState `json:"state,omitempty"`
235188

236189
Message string `json:"message,omitempty"`
@@ -264,7 +217,7 @@ type AppWrapperStatus struct {
264217
// Represents the latest available observations of pods under appwrapper
265218
PendingPodConditions []PendingPodSpec `json:"pendingpodconditions"`
266219

267-
//Resources consumed
220+
// Resources consumed
268221

269222
TotalCPU float64 `json:"totalcpu,omitempty"`
270223

@@ -275,7 +228,7 @@ type AppWrapperStatus struct {
275228

276229
type AppWrapperState string
277230

278-
//enqueued, active, deleting, succeeded, failed
231+
// enqueued, active, deleting, succeeded, failed
279232
const (
280233
AppWrapperStateEnqueued AppWrapperState = "Pending"
281234
AppWrapperStateActive AppWrapperState = "Running"

Diff for: pkg/apis/controller/v1beta1/zz_generated.deepcopy.go

-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)