Skip to content

Commit 7a5b67e

Browse files
authored
Error handling updates in quota management usage (#367)
* Small error handling updates. * Small formatting updates Improved error handling. * Updates to the gitignore. * Changes to allow for quota trees to present * Addressed PR comment. Removed un-used code Fixed other linter warnings. * Fixed issues with correct interpretation of quanty in QM trees and requests * Cleanup e2e script. Added rules to update the deployment crds. * Changed regex for quota specification * Fixed error in qm backend struct More error handling updates * Fixed test case error Minor cleanup in the Fits function. * First pass at fixing the concurency issues * Added explicit quota release steps for errors in ScheduleNext Logging improvements Additional test cases in quotaforest manager * Added sleep to allow for the test namespace to be cleaned up. * Small changes to unit test
1 parent 713ac74 commit 7a5b67e

30 files changed

+8452
-8367
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,8 @@ kubernetes.tar.gz
127127

128128
# .devcontainer files
129129
.devcontainer
130-
130+
#local debug files
131+
cmd/kar-controllers/__debug_bin
132+
apiserver.local.config
133+
kubeconfig
134+
cover.out

Makefile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ ${BIN_DIR}/deepcopy-gen:
7272
$(info Compiling deepcopy-gen...)
7373
go build -o ${BIN_DIR}/deepcopy-gen ./cmd/deepcopy-gen/
7474

75-
images: verify-tag-name generate-code
75+
images: verify-tag-name generate-code update-deployment-crds
7676
$(info List executable directory)
7777
$(info repo id: ${git_repository_id})
7878
$(info branch: ${GIT_BRANCH})
@@ -83,7 +83,7 @@ else
8383
docker build --no-cache --tag mcad-controller:${TAG} --build-arg GO_BUILD_ARGS=$(GO_BUILD_ARGS) -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
8484
endif
8585

86-
images-podman: verify-tag-name generate-code
86+
images-podman: verify-tag-name generate-code update-deployment-crds
8787
$(info List executable directory)
8888
$(info repo id: ${git_repository_id})
8989
$(info branch: ${GIT_BRANCH})
@@ -115,9 +115,9 @@ endif
115115

116116
run-test:
117117
$(info Running unit tests...)
118-
hack/make-rules/test.sh $(WHAT) $(TESTS)
118+
go test -v -coverprofile cover.out -race -parallel 8 ./pkg/...
119119

120-
run-e2e: verify-tag-name
120+
run-e2e: verify-tag-name update-deployment-crds
121121
ifeq ($(strip $(quay_repository)),)
122122
echo "Running e2e with MCAD local image: mcad-controller ${TAG} IfNotPresent."
123123
hack/run-e2e-kind.sh mcad-controller ${TAG} IfNotPresent
@@ -131,3 +131,22 @@ coverage:
131131

132132
clean:
133133
rm -rf _output/
134+
135+
#CRD file maintenance rules
136+
DEPLOYMENT_CRD_DIR=deployment/mcad-controller/crds
137+
CRD_BASE_DIR=config/crd/bases
138+
MCAD_CRDS= ${DEPLOYMENT_CRD_DIR}/ibm.com_quotasubtree-v1.yaml \
139+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_appwrappers.yaml \
140+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_queuejobs.yaml \
141+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml
142+
143+
update-deployment-crds: ${MCAD_CRDS}
144+
145+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_schedulingspecs.yaml
146+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_appwrappers.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_appwrappers.yaml
147+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_queuejobs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_queuejobs.yaml
148+
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_schedulingspecs.yaml
149+
150+
151+
$(DEPLOYMENT_CRD_DIR)/%: ${CRD_BASE_DIR}/%
152+
cp $< $@

config/crd/bases/ibm.com_quotasubtree-v1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ spec:
5353
properties:
5454
cpu:
5555
x-kubernetes-int-or-string: true
56-
pattern: '^[0-9]*(m)*$'
56+
pattern: '^[0-9]*(m)?$'
5757
memory:
5858
x-kubernetes-int-or-string: true
59-
pattern: '^[0-9]*(Ei|Pi|Ti|Gi|Mi|Ki|E|P|T|G|M|K)*$'
59+
pattern: '^[0-9]*(Ei|Pi|Ti|Gi|Mi|Ki|E|P|T|G|M|K)?$'
6060
nvidia.com/gpu:
6161
x-kubernetes-int-or-string: true
62-
pattern: '^[0-9]*$'
62+
pattern: '^[0-9]?$'

config/crd/bases/mcad.ibm.com_appwrappers.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ kind: CustomResourceDefinition
55
metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.4.1
8-
creationTimestamp: null
98
name: appwrappers.mcad.ibm.com
109
spec:
1110
group: mcad.ibm.com
@@ -68,6 +67,8 @@ spec:
6867
The associated item's level .status.conditions[].type field is monitored for any one of these conditions. Once all items with this
6968
option is set and the conditionstatus is met the entire appwrapper state will be changed to one of the valid appwrapper completion state. Note :- this is an AND
7069
operation for all items where this option is set. See the list of appwrapper states for a list of valid complete states.
70+
type: string
71+
7172
custompodresources:
7273
description: Optional section that specifies resource requirements
7374
for non-standard k8s resources, follows same format as

config/crd/bases/mcad.ibm.com_queuejobs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ kind: CustomResourceDefinition
55
metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.4.1
8-
creationTimestamp: null
98
name: queuejobs.mcad.ibm.com
109
spec:
1110
group: mcad.ibm.com

config/crd/bases/mcad.ibm.com_schedulingspecs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ kind: CustomResourceDefinition
55
metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.4.1
8-
creationTimestamp: null
98
name: schedulingspecs.mcad.ibm.com
109
spec:
1110
group: mcad.ibm.com
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: quotasubtrees.ibm.com
5+
finalizers: []
6+
spec:
7+
group: ibm.com
8+
scope: Namespaced
9+
names:
10+
kind: QuotaSubtree
11+
singular: quotasubtree
12+
plural: quotasubtrees
13+
shortNames:
14+
- qst
15+
versions:
16+
- name: v1
17+
served: true
18+
storage: true
19+
subresources:
20+
status: {}
21+
schema:
22+
openAPIV3Schema:
23+
type: object
24+
properties:
25+
status:
26+
type: object
27+
x-kubernetes-preserve-unknown-fields: true
28+
spec:
29+
type: object
30+
properties:
31+
parent:
32+
type: string
33+
parentNamespace:
34+
type: string
35+
children:
36+
type: array
37+
items:
38+
type: object
39+
properties:
40+
name:
41+
type: string
42+
namespace:
43+
type: string
44+
quotas:
45+
type: object
46+
properties:
47+
disabled:
48+
type: boolean
49+
hardLimit:
50+
type: boolean
51+
requests:
52+
type: object
53+
properties:
54+
cpu:
55+
x-kubernetes-int-or-string: true
56+
pattern: '^[0-9]*(m)?$'
57+
memory:
58+
x-kubernetes-int-or-string: true
59+
pattern: '^[0-9]*(Ei|Pi|Ti|Gi|Mi|Ki|E|P|T|G|M|K)?$'
60+
nvidia.com/gpu:
61+
x-kubernetes-int-or-string: true
62+
pattern: '^[0-9]?$'

0 commit comments

Comments
 (0)