Skip to content

Commit 3dbbd62

Browse files
committed
updating make manifests target
1 parent 9912d96 commit 3dbbd62

9 files changed

+672
-1025
lines changed

Makefile

+11-32
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ defaults:
148148

149149
# this encounters sed issues on MacOS, quick fix is to use gsed or to escape the parentheses i.e. \( \)
150150
.PHONY: manifests
151-
manifests: controller-gen kustomize ## Generate RBAC objects.
151+
manifests: controller-gen kustomize install-yq ## Generate RBAC objects.
152152
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."
153-
# $(SED) -i -E "s|(- )\${MCAD_REPO}.*|\1\${MCAD_CRD}|" config/crd/mcad/kustomization.yaml
154-
# $(KUSTOMIZE) build config/crd/mcad > config/crd/mcad.yaml && make split_yaml FILE=config/crd/mcad.yaml
153+
$(SED) -i -E "s|(- )\${MCAD_REPO}.*|\1\${MCAD_CRD}|" config/crd/mcad/kustomization.yaml
154+
$(KUSTOMIZE) build config/crd/mcad > config/crd/mcad.yaml
155+
$(YQ) -s '"crd-" + .spec.names.singular' config/crd/mcad.yaml --no-doc
156+
mv crd-*.yml config/crd
155157

156158
.PHONY: fmt
157159
fmt: ## Run go fmt against code.
@@ -236,6 +238,7 @@ SED ?= /usr/bin/sed
236238
KUSTOMIZE_VERSION ?= v4.5.4
237239
CODEGEN_VERSION ?= v0.27.2
238240
CONTROLLER_TOOLS_VERSION ?= v0.9.2
241+
YQ_VERSION ?= v4.30.8 ## latest version that works with go1.19
239242
OPERATOR_SDK_VERSION ?= v1.27.0
240243
GH_CLI_VERSION ?= 2.30.0
241244

@@ -261,6 +264,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
261264
$(CONTROLLER_GEN): $(LOCALBIN)
262265
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
263266

267+
.PHONY: install-yq
268+
install-yq: $(YQ) ## Download yq locally if necessary
269+
$(YQ): $(LOCALBIN)
270+
test -s $(LOCALBIN)/yq || GOBIN=$(LOCALBIN) go install github.com/mikefarah/yq/v4@$(YQ_VERSION)
271+
264272
.PHONY: envtest
265273
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
266274
$(ENVTEST): $(LOCALBIN)
@@ -388,32 +396,3 @@ verify-imports: openshift-goimports ## Run import verifications.
388396
.PHONY: scorecard-bundle
389397
scorecard-bundle: install-operator-sdk ## Run scorecard tests on bundle image.
390398
$(OPERATOR_SDK) scorecard bundle
391-
392-
393-
FILE ?= input.yaml # Default value, it isn't a file, but the make cmds fill hang for longer without it
394-
temp_dir := temp_split
395-
output_dir := 'config/crd/'
396-
397-
.PHONY: check_yq
398-
check_yq:
399-
@command -v wget >/dev/null 2>&1 || (echo "Installing wget..."; apt-get install -y wget)
400-
@command -v $(YQ) >/dev/null 2>&1 || (echo "Installing yq..."; wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64.tar.gz -O - |\
401-
tar xz && mv yq_linux_amd64 $(YQ))
402-
403-
# this works on a MacOS by replacing awk with gawk
404-
.PHONY: split_yaml
405-
split_yaml:
406-
@$(MAKE) check_yq
407-
@mkdir -p $(temp_dir)
408-
@awk '/apiVersion: /{if (x>0) close("$(temp_dir)/section_" x ".yaml"); x++}{print > "$(temp_dir)/section_"x".yaml"}' $(FILE)
409-
@$(MAKE) process_sections
410-
411-
.PHONY: process_sections
412-
process_sections:
413-
@mkdir -p $(output_dir)
414-
@for section_file in $(temp_dir)/section_*; do \
415-
metadata_name=$$(YQ e '.metadata.name' $$section_file); \
416-
file_name=$$(echo $$metadata_name | awk -F'.' '{print $$2"."$$3"_"$$1".yaml"}'); \
417-
mv $$section_file $(output_dir)/$$file_name; \
418-
done
419-
@rm -r $(temp_dir)

config/crd/crd-appwrapper.yml

+462
Large diffs are not rendered by default.

config/crd/crd-quotasubtree.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.9.2
6+
creationTimestamp: null
7+
name: quotasubtrees.quota.codeflare.dev
8+
spec:
9+
group: quota.codeflare.dev
10+
names:
11+
kind: QuotaSubtree
12+
listKind: QuotaSubtreeList
13+
plural: quotasubtrees
14+
singular: quotasubtree
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: QuotaSubtree is a specification for a quota subtree resource
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
type: string
25+
kind:
26+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
27+
type: string
28+
metadata:
29+
type: object
30+
spec:
31+
description: QuotaSubtreeSpec is the spec for a resource plan
32+
properties:
33+
children:
34+
items:
35+
description: Child is the spec for a QuotaSubtree resource
36+
properties:
37+
name:
38+
type: string
39+
namespace:
40+
type: string
41+
path:
42+
type: string
43+
quotas:
44+
description: Quota is the spec for a QuotaSubtree resource
45+
properties:
46+
disabled:
47+
type: boolean
48+
hardLimit:
49+
type: boolean
50+
requests:
51+
additionalProperties:
52+
anyOf:
53+
- type: integer
54+
- type: string
55+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
56+
x-kubernetes-int-or-string: true
57+
type: object
58+
type: object
59+
type: object
60+
type: array
61+
parent:
62+
type: string
63+
parentNamespace:
64+
type: string
65+
type: object
66+
status:
67+
description: QuotaSubtreeStatus is the status for a QuotaSubtree resource
68+
properties:
69+
children:
70+
items:
71+
description: ResourceAllocation is the spec for the child status
72+
properties:
73+
allocated:
74+
description: ResourceAllocationStatus is the spec for the child resource usage
75+
properties:
76+
requests:
77+
additionalProperties:
78+
type: string
79+
type: object
80+
type: object
81+
name:
82+
type: string
83+
namespace:
84+
type: string
85+
path:
86+
type: string
87+
type: object
88+
type: array
89+
totalAllocation:
90+
description: ResourceAllocation is the spec for the child status
91+
properties:
92+
allocated:
93+
description: ResourceAllocationStatus is the spec for the child resource usage
94+
properties:
95+
requests:
96+
additionalProperties:
97+
type: string
98+
type: object
99+
type: object
100+
name:
101+
type: string
102+
namespace:
103+
type: string
104+
path:
105+
type: string
106+
type: object
107+
required:
108+
- children
109+
- totalAllocation
110+
type: object
111+
required:
112+
- spec
113+
type: object
114+
served: true
115+
storage: true

config/crd/crd-schedulingspec.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.9.2
6+
creationTimestamp: null
7+
name: schedulingspecs.workload.codeflare.dev
8+
spec:
9+
group: workload.codeflare.dev
10+
names:
11+
kind: SchedulingSpec
12+
listKind: SchedulingSpecList
13+
plural: schedulingspecs
14+
singular: schedulingspec
15+
scope: Namespaced
16+
versions:
17+
- name: v1beta1
18+
schema:
19+
openAPIV3Schema:
20+
properties:
21+
apiVersion:
22+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
type: string
24+
kind:
25+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
26+
type: string
27+
metadata:
28+
type: object
29+
spec:
30+
properties:
31+
dispatchDuration:
32+
description: Wall clock duration time of appwrapper in seconds.
33+
properties:
34+
expected:
35+
type: integer
36+
limit:
37+
type: integer
38+
overrun:
39+
type: boolean
40+
type: object
41+
minAvailable:
42+
description: Expected number of pods in running and/or completed state. Requeuing is triggered when the number of running/completed pods is not equal to this value. When not specified, requeuing is disabled and no check is performed.
43+
type: integer
44+
nodeSelector:
45+
additionalProperties:
46+
type: string
47+
type: object
48+
requeuing:
49+
description: Specification of the requeuing strategy based on waiting time. Values in this field control how often the pod check should happen, and if requeuing has reached its maximum number of times.
50+
properties:
51+
growthType:
52+
default: exponential
53+
description: Growth strategy to increase the waiting time between requeuing checks. The values available are 'exponential', 'linear', or 'none'. For example, 'exponential' growth would double the 'timeInSeconds' value every time a requeuing event is triggered. If the string value is misspelled or not one of the possible options, the growth behavior is defaulted to 'none'.
54+
type: string
55+
initialTimeInSeconds:
56+
description: Value to keep track of the initial wait time. Users cannot set this as it is taken from 'timeInSeconds'.
57+
type: integer
58+
maxNumRequeuings:
59+
default: 0
60+
description: Maximum number of requeuing events allowed. Once this value is reached (e.g., 'numRequeuings = maxNumRequeuings', no more requeuing checks are performed and the generic items are stopped and removed from the cluster (AppWrapper remains deployed).
61+
type: integer
62+
maxTimeInSeconds:
63+
default: 0
64+
description: Maximum waiting time for requeuing checks.
65+
type: integer
66+
numRequeuings:
67+
default: 0
68+
description: Field to keep track of how many times a requeuing event has been triggered.
69+
type: integer
70+
timeInSeconds:
71+
default: 300
72+
description: Initial waiting time before requeuing conditions are checked. This value is specified by the user, but it may grow as requeuing events happen.
73+
type: integer
74+
type: object
75+
type: object
76+
required:
77+
- metadata
78+
type: object
79+
served: true
80+
storage: true

config/crd/kustomization.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# since it depends on service name and namespace that are out of this kustomize package.
33
# It should be run by config/default
44
resources:
5-
- quota.codeflare_quotasubtrees.yaml
6-
- workload.codeflare_appwrappers.yaml
7-
- workload.codeflare_schedulingspecs.yaml
5+
- crd-appwrapper.yml
6+
- crd-quotasubtree.yml
7+
- crd-schedulingspec.yml
88

99
#+kubebuilder:scaffold:crdkustomizeresource

config/crd/mcad/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
4-
- github.com/project-codeflare/multi-cluster-app-dispatcher/config/crd?ref=v1.36.0
4+
- github.com/project-codeflare/multi-cluster-app-dispatcher/config/crd?ref=v1.37.1

0 commit comments

Comments
 (0)