Skip to content

Change quota management API group version to v1alpha1 #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 22 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $(LOCALBIN):

## Tool Versions
CONTROLLER_TOOLS_VERSION ?= v0.9.2
CODEGEN_VERSION ?= v0.20.15
CODEGEN_VERSION ?= v0.27.2

## Tool Binaries
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
Expand Down Expand Up @@ -69,63 +69,50 @@ verify-tag-name: print-global-variables
t=${TAG} && [ $${#t} -le 128 ] || { echo "Target name $$t has 128 or more chars"; false; }
.PHONY: generate-client ## Generate client packages
generate-client: code-generator
rm -rf pkg/client/clientset/versioned pkg/client/informers/externalversions pkg/client/listers/controller/v1beta1 pkg/client/listers/quotasubtree/v1
# TODO: add this back when the version of the tool has been updated and supports this executable
# $(APPLYCONFIGURATION_GEN) \
# --input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
# --go-header-file="hack/boilerplate/boilerplate.go.txt" \
# --output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/applyconfiguration" \
# --trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
rm -rf pkg/client/applyconfiguration pkg/client/clientset/versioned pkg/client/informers/externalversions pkg/client/listers/controller/v1beta1 pkg/client/listers/quotasubtree/v1alpha1
$(APPLYCONFIGURATION_GEN) \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
--go-header-file="hack/boilerplate/boilerplate.go.txt" \
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/applyconfiguration" \
--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
$(CLIENT_GEN) \
--input="pkg/apis/controller/v1beta1" \
--input="pkg/apis/quotaplugins/quotasubtree/v1" \
--input="pkg/apis/quotaplugins/quotasubtree/v1alpha1" \
--input-base="github.com/project-codeflare/multi-cluster-app-dispatcher" \
--go-header-file="hack/boilerplate/boilerplate.go.txt" \
--clientset-name "versioned" \
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset" \
--output-base="."
# TODO: add the following line back once the tool has been upgraded
# --trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
--output-base="." \
--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
$(LISTER_GEN) \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1" \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1alpha1" \
--go-header-file="hack/boilerplate/boilerplate.go.txt" \
--output-base="." \
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers"
# TODO: add the following line back once the tool has been upgraded
# --trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers" \
--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
$(INFORMER_GEN) \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1" \
--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1alpha1" \
--versioned-clientset-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned" \
--listers-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers" \
--go-header-file="hack/boilerplate/boilerplate.go.txt" \
--output-base="." \
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers"
# TODO: add the following line back once the tool has been upgraded
# --trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
# TODO: remove the following lines once the tool has been upgraded and they are no longer needed.
# The `mv` and `rm` are necessary as the generators write to the gihub.com/... path.
mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned pkg/client/clientset/versioned
mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers/externalversions pkg/client/informers/externalversions
mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers/controller/v1beta1 pkg/client/listers/controller/v1beta1
mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers/quotasubtree/v1 pkg/client/listers/quotasubtree/v1
rm -rf github.com
--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers" \
--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: code-generator
#TODO: add $(APPLYCONFIGURATION_GEN) as a dependency when the tool is supported
code-generator: $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN) $(CONTROLLER_GEN)

# TODO: enable this target once the tools is supported
#.PHONY: applyconfiguration-gen
#applyconfiguration-gen: $(APPLYCONFIGURATION_GEN)
#$(APPLYCONFIGURATION_GEN): $(LOCALBIN)
# test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION)
code-generator: $(APPLYCONFIGURATION_GEN) $(CLIENT_GEN) $(LISTER_GEN) $(INFORMER_GEN) $(CONTROLLER_GEN)

.PHONY: applyconfiguration-gen
applyconfiguration-gen: $(APPLYCONFIGURATION_GEN)
$(APPLYCONFIGURATION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION)

.PHONY: client-gen
client-gen: $(CLIENT_GEN)
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/quota.codeflare.dev_quotasubtrees.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
singular: quotasubtree
scope: Namespaced
versions:
- name: v1
- name: v1alpha1
schema:
openAPIV3Schema:
description: QuotaSubtree is a specification for a quota subtree resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
singular: quotasubtree
scope: Namespaced
versions:
- name: v1
- name: v1alpha1
schema:
openAPIV3Schema:
description: QuotaSubtree is a specification for a quota subtree resource
Expand Down
6 changes: 3 additions & 3 deletions doc/usage/quota_management/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ One of the key features of quota trees is the hardLimit attribute, which determi
from its siblings or not. A sibling is another child node that shares the same parent node. If a quota has hardLimit set
to true, then it can only use the resources defined in its specification. If a quota has hardLimit set to false, then it
can use any unused resources from its siblings, as long as it does not violate the parent node’s limits. However, if an
object is defined which neccesitates borrowing from a sibling node, then if another kubernetes object is created which
object is defined which necessitates borrowing from a sibling node, then if another kubernetes object is created which
uses the borrowees quota (and is within the borrowees limit) then the borrower will be preempted to free these
resources.

Expand All @@ -21,7 +21,7 @@ optimize resource utilization, avoid resource starvation, and ensure quality of
## Example QuotaSubtree

```yaml
apiVersion: quota.codeflare.dev/v1
apiVersion: quota.codeflare.dev/v1alpha1
kind: QuotaSubtree
metadata:
name: context-root
Expand All @@ -37,7 +37,7 @@ spec:
cpu: 2000m
memory: 8000Mi
---
apiVersion: quota.codeflare.dev/v1
apiVersion: quota.codeflare.dev/v1alpha1
kind: QuotaSubtree
metadata:
name: context-root-children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ limitations under the License.
// +kubebuilder:object:generate=true
// +groupName=quota.codeflare.dev

package v1
package v1alpha1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -16,7 +16,7 @@ const (
GroupName = "quota.codeflare.dev"

// GroupVersion is the version of scheduling group
GroupVersion = "v1"
GroupVersion = "v1alpha1"
)

// SchemeGroupVersion is the group version used to register these objects.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package v1
package v1alpha1

/*
Copyright 2022 The Multi-Cluster App Dispatcher Authors.

Expand Down Expand Up @@ -54,10 +55,10 @@ type QuotaSubtreeSpec struct {

// Child is the spec for a QuotaSubtree resource
type Child struct {
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
Quotas Quota `json:"quotas,omitempty" protobuf:"bytes,4,opt,name=quotas"`
Path string `json:"path,omitempty" protobuf:"bytes,5,opt,name=path"`
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
Quotas Quota `json:"quotas,omitempty" protobuf:"bytes,4,opt,name=quotas"`
Path string `json:"path,omitempty" protobuf:"bytes,5,opt,name=path"`
}

// Quota is the spec for a QuotaSubtree resource
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading