Skip to content

Commit eb80bde

Browse files
committed
Merge remote-tracking branch 'upstream/main' into resource-extension
2 parents 7de6aee + 586eb13 commit eb80bde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1668
-6871
lines changed

.github/workflows/mcad-CI.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will build mcad and run unit test and E2E tests
2+
name: MCAD-CI
3+
on:
4+
pull_request:
5+
branches:
6+
- 'main'
7+
- 'release-*'
8+
9+
jobs:
10+
MCAD-CI:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
ref: "refs/pull/${{ github.event.number }}/merge"
18+
fetch-depth: 0
19+
20+
- name: Set latest tag and Branch name
21+
run: |
22+
echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
23+
echo "TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v3
27+
with:
28+
go-version: 1.18.10
29+
30+
- name: Build
31+
run:
32+
make mcad-controller
33+
34+
- name: Run Unit tests
35+
run: make run-test
36+
37+
- name: Build Image
38+
run: |
39+
make images -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }}
40+
41+
- name: Run E2E tests
42+
run: |
43+
make run-e2e -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }}
44+

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
# Skip CI check when running as a pull request
3+
if: "$TRAVIS_PULL_REQUEST != false"
4+
15
language: go
26

37
sudo: required
@@ -25,8 +29,6 @@ script:
2529
- make run-test
2630
# Process 'make images' when NOT a pull request
2731
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make images; fi'
28-
# Process 'make images' when running as a pull request
29-
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then unset quay_repository && make images; fi'
3032
# Process 'make push-images' when NOT a pull request
3133
- 'if [[ "$TRAVIS_PULL_REQUEST" == "false" && ! "$TRAVIS_BRANCH" =~ "^v[0-9]\.[0-9]+\.[0-9]+" ]]; then make push-images; fi'
3234
# Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes

Makefile

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ GIT_BRANCH:=$(shell git symbolic-ref --short HEAD 2>&1 | grep -v fatal)
66
#define the GO_BUILD_ARGS if you need to pass additional arguments to the go build
77
GO_BUILD_ARGS?=
88

9+
## Location to install dependencies to
10+
LOCALBIN ?= $(shell pwd)/bin
11+
$(LOCALBIN):
12+
mkdir -p $(LOCALBIN)
13+
14+
## Tool Versions
15+
CONTROLLER_TOOLS_VERSION ?= v0.9.2
16+
17+
## Tool Binaries
18+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
19+
920
# Reset branch name if this a Travis CI environment
1021
ifneq ($(strip $(TRAVIS_BRANCH)),)
1122
GIT_BRANCH:=${TRAVIS_BRANCH}
@@ -28,7 +39,7 @@ endif
2839

2940
.PHONY: print-global-variables
3041

31-
# Build the controler executable for use in docker image build
42+
# Build the controller executable for use in docker image build
3243
mcad-controller: init generate-code
3344
ifeq ($(strip $(GO_BUILD_ARGS)),)
3445
$(info Compiling controller)
@@ -60,6 +71,15 @@ verify-tag-name: print-global-variables
6071
# Check for invalid tag name
6172
t=${TAG} && [ $${#t} -le 128 ] || { echo "Target name $$t has 128 or more chars"; false; }
6273

74+
.PHONY: controller-gen
75+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
76+
$(CONTROLLER_GEN): $(LOCALBIN)
77+
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
78+
79+
.PHONY: manifests
80+
manifests: controller-gen ## Generate CustomResourceDefinition objects.
81+
$(CONTROLLER_GEN) crd:allowDangerousTypes=true paths="./pkg/apis/..." output:crd:artifacts:config=config/crd/bases
82+
6383
generate-code: pkg/apis/controller/v1beta1/zz_generated.deepcopy.go
6484

6585
pkg/apis/controller/v1beta1/zz_generated.deepcopy.go: ${BIN_DIR}/deepcopy-gen
@@ -139,18 +159,17 @@ clean:
139159
#CRD file maintenance rules
140160
DEPLOYMENT_CRD_DIR=deployment/mcad-controller/crds
141161
CRD_BASE_DIR=config/crd/bases
142-
MCAD_CRDS= ${DEPLOYMENT_CRD_DIR}/ibm.com_quotasubtree-v1.yaml \
162+
MCAD_CRDS= ${DEPLOYMENT_CRD_DIR}/ibm.com_quotasubtrees.yaml \
143163
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_appwrappers.yaml \
144164
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_queuejobs.yaml \
145165
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml
146166

147167
update-deployment-crds: ${MCAD_CRDS}
148168

149-
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_schedulingspecs.yaml
169+
${DEPLOYMENT_CRD_DIR}/ibm.com_quotasubtrees.yaml : ${CRD_BASE_DIR}/ibm.com_quotasubtrees.yaml
150170
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_appwrappers.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_appwrappers.yaml
151171
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_queuejobs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_queuejobs.yaml
152172
${DEPLOYMENT_CRD_DIR}/mcad.ibm.com_schedulingspecs.yaml : ${CRD_BASE_DIR}/mcad.ibm.com_schedulingspecs.yaml
153173

154-
155174
$(DEPLOYMENT_CRD_DIR)/%: ${CRD_BASE_DIR}/%
156-
cp $< $@
175+
cp $< $@

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

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

0 commit comments

Comments
 (0)