diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 818a71f6..502ef28f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - build: + test: runs-on: ubuntu-latest steps: - name: Check out code @@ -18,5 +18,7 @@ jobs: go-version: '1.22' - name: Lint run: make lint-all + - name: Verify + run: bash ${GITHUB_WORKSPACE}/hack/verify-codegen.sh - name: Unit Test run: make test diff --git a/Makefile b/Makefile index f0fb1aec..09e67599 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,14 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." + +.PHONY: update-codegen +update-codegen: + sh ./hack/update-codegen.sh + +.PHONY: verify-codegen +verify-codegen: + sh ./hack/verify-codegen.sh .PHONY: fmt fmt: ## Run go fmt against code. diff --git a/api/autoscaling/v1alpha1/podautoscaler_types.go b/api/autoscaling/v1alpha1/podautoscaler_types.go index a804533a..bd1bc623 100644 --- a/api/autoscaling/v1alpha1/podautoscaler_types.go +++ b/api/autoscaling/v1alpha1/podautoscaler_types.go @@ -121,6 +121,7 @@ type PodAutoscalerStatus struct { } // +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodAutoscalerList contains a list of PodAutoscaler type PodAutoscalerList struct { diff --git a/api/model/v1alpha1/modeladapter_types.go b/api/model/v1alpha1/modeladapter_types.go index dfc4817b..b0c2f664 100644 --- a/api/model/v1alpha1/modeladapter_types.go +++ b/api/model/v1alpha1/modeladapter_types.go @@ -100,6 +100,7 @@ type ModelAdapter struct { } // +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ModelAdapterList contains a list of ModelAdapter type ModelAdapterList struct { diff --git a/api/orchestration/v1alpha1/groupversion_info.go b/api/orchestration/v1alpha1/groupversion_info.go index c95e91e7..8d0db131 100644 --- a/api/orchestration/v1alpha1/groupversion_info.go +++ b/api/orchestration/v1alpha1/groupversion_info.go @@ -28,9 +28,16 @@ var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "orchestration.aibrix.ai", Version: "v1alpha1"} + // SchemeGroupVersion is group version used to register these objects. + SchemeGroupVersion = GroupVersion + // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme ) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/api/orchestration/v1alpha1/rayclusterfleet_types.go b/api/orchestration/v1alpha1/rayclusterfleet_types.go index 56cbe2ed..032d5e05 100644 --- a/api/orchestration/v1alpha1/rayclusterfleet_types.go +++ b/api/orchestration/v1alpha1/rayclusterfleet_types.go @@ -146,8 +146,10 @@ const ( FleetReplicaFailure FleetConditionType = "ReplicaFailure" ) -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // RayClusterFleet is the Schema for the rayclusterfleets API type RayClusterFleet struct { @@ -158,7 +160,8 @@ type RayClusterFleet struct { Status RayClusterFleetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // RayClusterFleetList contains a list of RayClusterFleet type RayClusterFleetList struct { diff --git a/api/orchestration/v1alpha1/rayclusterreplicaset_types.go b/api/orchestration/v1alpha1/rayclusterreplicaset_types.go index 46d81450..47180b6f 100644 --- a/api/orchestration/v1alpha1/rayclusterreplicaset_types.go +++ b/api/orchestration/v1alpha1/rayclusterreplicaset_types.go @@ -83,8 +83,10 @@ type RayClusterReplicaSetStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // RayClusterReplicaSet is the Schema for the rayclusterreplicasets API type RayClusterReplicaSet struct { @@ -95,7 +97,8 @@ type RayClusterReplicaSet struct { Status RayClusterReplicaSetStatus `json:"status,omitempty"` } -//+kubebuilder:object:root=true +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // RayClusterReplicaSetList contains a list of RayClusterReplicaSet type RayClusterReplicaSetList struct { diff --git a/docs/development/app/README.md b/docs/development/app/README.md index 33663936..b8096131 100644 --- a/docs/development/app/README.md +++ b/docs/development/app/README.md @@ -9,7 +9,7 @@ kind load docker-image aibrix/vllm:v0.1.0 2. Deploy mocked model image ```shell kubectl apply -f docs/development/app/deployment.yaml -kubectl port-forward svc/llama2-70b 8000:8000 & +kubectl -n aibrix-system port-forward svc/llama2-70b 8000:8000 & ``` ## Test python app separately diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh old mode 100644 new mode 100755 index 94b80604..c44de536 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -36,6 +36,7 @@ echo ">> Temporary output directory ${TEMP_DIR}" # Ensure we can execute. chmod +x ${CODEGEN_PKG}/generate-groups.sh +chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh # generate the code with: # --output-base because this script should also be able to run inside the vendor dir of @@ -43,9 +44,9 @@ chmod +x ${CODEGEN_PKG}/generate-groups.sh # instead of the $GOPATH directly. For normal projects this can be dropped. # cd ${SCRIPT_ROOT} -${CODEGEN_PKG}/generate-groups.sh all \ +${CODEGEN_PKG}/generate-groups.sh applyconfiguration,client,informer,lister \ github.com/aibrix/aibrix/pkg/client github.com/aibrix/aibrix/api \ - "model:v1alpha1 autoscaling:v1alpha1" \ + "model:v1alpha1 autoscaling:v1alpha1 orchestration:v1alpha1" \ --output-base "${TEMP_DIR}" \ --go-header-file hack/boilerplate.go.txt diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh index 94b80604..e270a93d 100755 --- a/hack/verify-codegen.sh +++ b/hack/verify-codegen.sh @@ -8,46 +8,35 @@ set -o nounset set -o pipefail SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -ROOT_PKG=github.com/aibrix/aibrix +DIFFROOT="${SCRIPT_ROOT}/pkg/client" +TMP_DIFFROOT="$(mktemp -d -t "$(basename "$0").XXXXXX")" -# Grab code-generator version from go.sum -CODEGEN_VERSION=$(grep 'k8s.io/code-generator' go.sum | awk '{print $2}' | sed 's/\/go.mod//g' | head -1) -CODEGEN_PKG=$(echo `go env GOPATH`"/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}") - -if [[ ! -d ${CODEGEN_PKG} ]]; then - echo "${CODEGEN_PKG} is missing. Running 'go mod download'." - go mod download -fi - -echo ">> Using ${CODEGEN_PKG}" - -# code-generator does work with go.mod but makes assumptions about -# the project living in `$GOPATH/src`. To work around this and support -# any location; create a temporary directory, use this as an output -# base, and copy everything back once generated. -TEMP_DIR=$(mktemp -d) cleanup() { - echo ">> Removing ${TEMP_DIR}" -# rm -rf ${TEMP_DIR} + rm -rf "${TMP_DIFFROOT}" } trap "cleanup" EXIT SIGINT -echo ">> Temporary output directory ${TEMP_DIR}" +cleanup + +mkdir -p "${TMP_DIFFROOT}" +cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" # Ensure we can execute. -chmod +x ${CODEGEN_PKG}/generate-groups.sh - -# generate the code with: -# --output-base because this script should also be able to run inside the vendor dir of -# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir -# instead of the $GOPATH directly. For normal projects this can be dropped. -# -cd ${SCRIPT_ROOT} -${CODEGEN_PKG}/generate-groups.sh all \ - github.com/aibrix/aibrix/pkg/client github.com/aibrix/aibrix/api \ - "model:v1alpha1 autoscaling:v1alpha1" \ - --output-base "${TEMP_DIR}" \ - --go-header-file hack/boilerplate.go.txt - -# Copy everything back. -cp -a "${TEMP_DIR}/${ROOT_PKG}/." "${SCRIPT_ROOT}/" +chmod +x ${SCRIPT_ROOT}/hack/update-codegen.sh + +"${SCRIPT_ROOT}/hack/update-codegen.sh" +echo "diffing ${DIFFROOT} against freshly generated codegen" +ret=0 +diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? +if [[ $ret -eq 0 ]]; then + echo "${DIFFROOT} up to date." +else + echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" + exit 1 +fi + +# smoke test +echo "Smoke testing by compiling..." +pushd "${SCRIPT_ROOT}" + go build "${DIFFROOT}/..." +popd \ No newline at end of file diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/fleetcondition.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/fleetcondition.go new file mode 100644 index 00000000..49034024 --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/fleetcondition.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// FleetConditionApplyConfiguration represents an declarative configuration of the FleetCondition type for use +// with apply. +type FleetConditionApplyConfiguration struct { + Type *v1alpha1.FleetConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// FleetConditionApplyConfiguration constructs an declarative configuration of the FleetCondition type for use with +// apply. +func FleetCondition() *FleetConditionApplyConfiguration { + return &FleetConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithType(value v1alpha1.FleetConditionType) *FleetConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *FleetConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastUpdateTime sets the LastUpdateTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastUpdateTime field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *FleetConditionApplyConfiguration { + b.LastUpdateTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *FleetConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithReason(value string) *FleetConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *FleetConditionApplyConfiguration) WithMessage(value string) *FleetConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleet.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleet.go new file mode 100644 index 00000000..a694a802 --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleet.go @@ -0,0 +1,218 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RayClusterFleetApplyConfiguration represents an declarative configuration of the RayClusterFleet type for use +// with apply. +type RayClusterFleetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *RayClusterFleetSpecApplyConfiguration `json:"spec,omitempty"` + Status *RayClusterFleetStatusApplyConfiguration `json:"status,omitempty"` +} + +// RayClusterFleet constructs an declarative configuration of the RayClusterFleet type for use with +// apply. +func RayClusterFleet(name, namespace string) *RayClusterFleetApplyConfiguration { + b := &RayClusterFleetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("RayClusterFleet") + b.WithAPIVersion("orchestration/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithKind(value string) *RayClusterFleetApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithAPIVersion(value string) *RayClusterFleetApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithName(value string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithGenerateName(value string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithNamespace(value string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithUID(value types.UID) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithResourceVersion(value string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithGeneration(value int64) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RayClusterFleetApplyConfiguration) WithLabels(entries map[string]string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RayClusterFleetApplyConfiguration) WithAnnotations(entries map[string]string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RayClusterFleetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RayClusterFleetApplyConfiguration) WithFinalizers(values ...string) *RayClusterFleetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *RayClusterFleetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithSpec(value *RayClusterFleetSpecApplyConfiguration) *RayClusterFleetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *RayClusterFleetApplyConfiguration) WithStatus(value *RayClusterFleetStatusApplyConfiguration) *RayClusterFleetApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetspec.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetspec.go new file mode 100644 index 00000000..bdbd18db --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetspec.go @@ -0,0 +1,107 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RayClusterFleetSpecApplyConfiguration represents an declarative configuration of the RayClusterFleetSpec type for use +// with apply. +type RayClusterFleetSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Selector *v1.LabelSelector `json:"selector,omitempty"` + Template *rayv1.RayClusterSpec `json:"template,omitempty"` + Strategy *appsv1.DeploymentStrategy `json:"strategy,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + Paused *bool `json:"paused,omitempty"` + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +// RayClusterFleetSpecApplyConfiguration constructs an declarative configuration of the RayClusterFleetSpec type for use with +// apply. +func RayClusterFleetSpec() *RayClusterFleetSpecApplyConfiguration { + return &RayClusterFleetSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithReplicas(value int32) *RayClusterFleetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithSelector(value v1.LabelSelector) *RayClusterFleetSpecApplyConfiguration { + b.Selector = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithTemplate(value rayv1.RayClusterSpec) *RayClusterFleetSpecApplyConfiguration { + b.Template = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithStrategy(value appsv1.DeploymentStrategy) *RayClusterFleetSpecApplyConfiguration { + b.Strategy = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithMinReadySeconds(value int32) *RayClusterFleetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithRevisionHistoryLimit sets the RevisionHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RevisionHistoryLimit field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32) *RayClusterFleetSpecApplyConfiguration { + b.RevisionHistoryLimit = &value + return b +} + +// WithPaused sets the Paused field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Paused field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithPaused(value bool) *RayClusterFleetSpecApplyConfiguration { + b.Paused = &value + return b +} + +// WithProgressDeadlineSeconds sets the ProgressDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProgressDeadlineSeconds field is set to the value of the last call. +func (b *RayClusterFleetSpecApplyConfiguration) WithProgressDeadlineSeconds(value int32) *RayClusterFleetSpecApplyConfiguration { + b.ProgressDeadlineSeconds = &value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetstatus.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetstatus.go new file mode 100644 index 00000000..a404fce2 --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterfleetstatus.go @@ -0,0 +1,106 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RayClusterFleetStatusApplyConfiguration represents an declarative configuration of the RayClusterFleetStatus type for use +// with apply. +type RayClusterFleetStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` + UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + UnavailableReplicas *int32 `json:"unavailableReplicas,omitempty"` + Conditions []FleetConditionApplyConfiguration `json:"conditions,omitempty"` + CollisionCount *int32 `json:"collisionCount,omitempty"` +} + +// RayClusterFleetStatusApplyConfiguration constructs an declarative configuration of the RayClusterFleetStatus type for use with +// apply. +func RayClusterFleetStatus() *RayClusterFleetStatusApplyConfiguration { + return &RayClusterFleetStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithObservedGeneration(value int64) *RayClusterFleetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithReplicas(value int32) *RayClusterFleetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithUpdatedReplicas sets the UpdatedReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedReplicas field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithUpdatedReplicas(value int32) *RayClusterFleetStatusApplyConfiguration { + b.UpdatedReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithReadyReplicas(value int32) *RayClusterFleetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithAvailableReplicas(value int32) *RayClusterFleetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUnavailableReplicas sets the UnavailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableReplicas field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithUnavailableReplicas(value int32) *RayClusterFleetStatusApplyConfiguration { + b.UnavailableReplicas = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *RayClusterFleetStatusApplyConfiguration) WithConditions(values ...*FleetConditionApplyConfiguration) *RayClusterFleetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithCollisionCount sets the CollisionCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CollisionCount field is set to the value of the last call. +func (b *RayClusterFleetStatusApplyConfiguration) WithCollisionCount(value int32) *RayClusterFleetStatusApplyConfiguration { + b.CollisionCount = &value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicaset.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicaset.go new file mode 100644 index 00000000..0caca32d --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicaset.go @@ -0,0 +1,218 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RayClusterReplicaSetApplyConfiguration represents an declarative configuration of the RayClusterReplicaSet type for use +// with apply. +type RayClusterReplicaSetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *RayClusterReplicaSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *RayClusterReplicaSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// RayClusterReplicaSet constructs an declarative configuration of the RayClusterReplicaSet type for use with +// apply. +func RayClusterReplicaSet(name, namespace string) *RayClusterReplicaSetApplyConfiguration { + b := &RayClusterReplicaSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("RayClusterReplicaSet") + b.WithAPIVersion("orchestration/v1alpha1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithKind(value string) *RayClusterReplicaSetApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithAPIVersion(value string) *RayClusterReplicaSetApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithName(value string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithGenerateName(value string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithNamespace(value string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithUID(value types.UID) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithResourceVersion(value string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithGeneration(value int64) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RayClusterReplicaSetApplyConfiguration) WithLabels(entries map[string]string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RayClusterReplicaSetApplyConfiguration) WithAnnotations(entries map[string]string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RayClusterReplicaSetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RayClusterReplicaSetApplyConfiguration) WithFinalizers(values ...string) *RayClusterReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *RayClusterReplicaSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithSpec(value *RayClusterReplicaSetSpecApplyConfiguration) *RayClusterReplicaSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *RayClusterReplicaSetApplyConfiguration) WithStatus(value *RayClusterReplicaSetStatusApplyConfiguration) *RayClusterReplicaSetApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetspec.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetspec.go new file mode 100644 index 00000000..e9c8fb9a --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetspec.go @@ -0,0 +1,70 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RayClusterReplicaSetSpecApplyConfiguration represents an declarative configuration of the RayClusterReplicaSetSpec type for use +// with apply. +type RayClusterReplicaSetSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + Selector *v1.LabelSelector `json:"selector,omitempty"` + Template *rayv1.RayClusterSpec `json:"template,omitempty"` +} + +// RayClusterReplicaSetSpecApplyConfiguration constructs an declarative configuration of the RayClusterReplicaSetSpec type for use with +// apply. +func RayClusterReplicaSetSpec() *RayClusterReplicaSetSpecApplyConfiguration { + return &RayClusterReplicaSetSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *RayClusterReplicaSetSpecApplyConfiguration) WithReplicas(value int32) *RayClusterReplicaSetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *RayClusterReplicaSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *RayClusterReplicaSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *RayClusterReplicaSetSpecApplyConfiguration) WithSelector(value v1.LabelSelector) *RayClusterReplicaSetSpecApplyConfiguration { + b.Selector = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *RayClusterReplicaSetSpecApplyConfiguration) WithTemplate(value rayv1.RayClusterSpec) *RayClusterReplicaSetSpecApplyConfiguration { + b.Template = &value + return b +} diff --git a/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetstatus.go b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetstatus.go new file mode 100644 index 00000000..59b40929 --- /dev/null +++ b/pkg/client/applyconfiguration/orchestration/v1alpha1/rayclusterreplicasetstatus.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// RayClusterReplicaSetStatusApplyConfiguration represents an declarative configuration of the RayClusterReplicaSetStatus type for use +// with apply. +type RayClusterReplicaSetStatusApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + FullyLabeledReplicas *int32 `json:"fullyLabeledReplicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Conditions []v1.Condition `json:"conditions,omitempty"` +} + +// RayClusterReplicaSetStatusApplyConfiguration constructs an declarative configuration of the RayClusterReplicaSetStatus type for use with +// apply. +func RayClusterReplicaSetStatus() *RayClusterReplicaSetStatusApplyConfiguration { + return &RayClusterReplicaSetStatusApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithReplicas(value int32) *RayClusterReplicaSetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithFullyLabeledReplicas sets the FullyLabeledReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FullyLabeledReplicas field is set to the value of the last call. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithFullyLabeledReplicas(value int32) *RayClusterReplicaSetStatusApplyConfiguration { + b.FullyLabeledReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithReadyReplicas(value int32) *RayClusterReplicaSetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *RayClusterReplicaSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithObservedGeneration(value int64) *RayClusterReplicaSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *RayClusterReplicaSetStatusApplyConfiguration) WithConditions(values ...v1.Condition) *RayClusterReplicaSetStatusApplyConfiguration { + for i := range values { + b.Conditions = append(b.Conditions, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go index 5099a90f..8c9388f5 100644 --- a/pkg/client/applyconfiguration/utils.go +++ b/pkg/client/applyconfiguration/utils.go @@ -20,8 +20,10 @@ package applyconfiguration import ( v1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1" modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" autoscalingv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/autoscaling/v1alpha1" applyconfigurationmodelv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/model/v1alpha1" + applyconfigurationorchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/orchestration/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -47,6 +49,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case modelv1alpha1.SchemeGroupVersion.WithKind("ModelAdapterStatus"): return &applyconfigurationmodelv1alpha1.ModelAdapterStatusApplyConfiguration{} + // Group=orchestration, Version=v1alpha1 + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("FleetCondition"): + return &applyconfigurationorchestrationv1alpha1.FleetConditionApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterFleet"): + return &applyconfigurationorchestrationv1alpha1.RayClusterFleetApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterFleetSpec"): + return &applyconfigurationorchestrationv1alpha1.RayClusterFleetSpecApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterFleetStatus"): + return &applyconfigurationorchestrationv1alpha1.RayClusterFleetStatusApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterReplicaSet"): + return &applyconfigurationorchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterReplicaSetSpec"): + return &applyconfigurationorchestrationv1alpha1.RayClusterReplicaSetSpecApplyConfiguration{} + case orchestrationv1alpha1.SchemeGroupVersion.WithKind("RayClusterReplicaSetStatus"): + return &applyconfigurationorchestrationv1alpha1.RayClusterReplicaSetStatusApplyConfiguration{} + } return nil } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 4f8d6017..b64bcab6 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -23,6 +23,7 @@ import ( autoscalingv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1" modelv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/model/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/orchestration/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -32,13 +33,15 @@ type Interface interface { Discovery() discovery.DiscoveryInterface AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface ModelV1alpha1() modelv1alpha1.ModelV1alpha1Interface + OrchestrationV1alpha1() orchestrationv1alpha1.OrchestrationV1alpha1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - autoscalingV1alpha1 *autoscalingv1alpha1.AutoscalingV1alpha1Client - modelV1alpha1 *modelv1alpha1.ModelV1alpha1Client + autoscalingV1alpha1 *autoscalingv1alpha1.AutoscalingV1alpha1Client + modelV1alpha1 *modelv1alpha1.ModelV1alpha1Client + orchestrationV1alpha1 *orchestrationv1alpha1.OrchestrationV1alpha1Client } // AutoscalingV1alpha1 retrieves the AutoscalingV1alpha1Client @@ -51,6 +54,11 @@ func (c *Clientset) ModelV1alpha1() modelv1alpha1.ModelV1alpha1Interface { return c.modelV1alpha1 } +// OrchestrationV1alpha1 retrieves the OrchestrationV1alpha1Client +func (c *Clientset) OrchestrationV1alpha1() orchestrationv1alpha1.OrchestrationV1alpha1Interface { + return c.orchestrationV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -103,6 +111,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.orchestrationV1alpha1, err = orchestrationv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -126,6 +138,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.autoscalingV1alpha1 = autoscalingv1alpha1.New(c) cs.modelV1alpha1 = modelv1alpha1.New(c) + cs.orchestrationV1alpha1 = orchestrationv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 1608e5f1..978b9f09 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -23,6 +23,8 @@ import ( fakeautoscalingv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake" modelv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/model/v1alpha1" fakemodelv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/model/v1alpha1/fake" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/orchestration/v1alpha1" + fakeorchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -89,3 +91,8 @@ func (c *Clientset) AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha func (c *Clientset) ModelV1alpha1() modelv1alpha1.ModelV1alpha1Interface { return &fakemodelv1alpha1.FakeModelV1alpha1{Fake: &c.Fake} } + +// OrchestrationV1alpha1 retrieves the OrchestrationV1alpha1Client +func (c *Clientset) OrchestrationV1alpha1() orchestrationv1alpha1.OrchestrationV1alpha1Interface { + return &fakeorchestrationv1alpha1.FakeOrchestrationV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 052c7d22..f3e17e8b 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,6 +20,7 @@ package fake import ( autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1" modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,6 +34,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ autoscalingv1alpha1.AddToScheme, modelv1alpha1.AddToScheme, + orchestrationv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index a27edc30..071fac13 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,6 +20,7 @@ package scheme import ( autoscalingv1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1" modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,6 +34,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ autoscalingv1alpha1.AddToScheme, modelv1alpha1.AddToScheme, + orchestrationv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/doc.go new file mode 100644 index 00000000..446d7263 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/doc.go new file mode 100644 index 00000000..80e491a1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_orchestration_client.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_orchestration_client.go new file mode 100644 index 00000000..2b7fbf60 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_orchestration_client.go @@ -0,0 +1,43 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/aibrix/aibrix/pkg/client/clientset/versioned/typed/orchestration/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeOrchestrationV1alpha1 struct { + *testing.Fake +} + +func (c *FakeOrchestrationV1alpha1) RayClusterFleets(namespace string) v1alpha1.RayClusterFleetInterface { + return &FakeRayClusterFleets{c, namespace} +} + +func (c *FakeOrchestrationV1alpha1) RayClusterReplicaSets(namespace string) v1alpha1.RayClusterReplicaSetInterface { + return &FakeRayClusterReplicaSets{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOrchestrationV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterfleet.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterfleet.go new file mode 100644 index 00000000..ec61070c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterfleet.go @@ -0,0 +1,188 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/orchestration/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRayClusterFleets implements RayClusterFleetInterface +type FakeRayClusterFleets struct { + Fake *FakeOrchestrationV1alpha1 + ns string +} + +var rayclusterfleetsResource = v1alpha1.SchemeGroupVersion.WithResource("rayclusterfleets") + +var rayclusterfleetsKind = v1alpha1.SchemeGroupVersion.WithKind("RayClusterFleet") + +// Get takes name of the rayClusterFleet, and returns the corresponding rayClusterFleet object, and an error if there is any. +func (c *FakeRayClusterFleets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RayClusterFleet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rayclusterfleetsResource, c.ns, name), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// List takes label and field selectors, and returns the list of RayClusterFleets that match those selectors. +func (c *FakeRayClusterFleets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RayClusterFleetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rayclusterfleetsResource, rayclusterfleetsKind, c.ns, opts), &v1alpha1.RayClusterFleetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RayClusterFleetList{ListMeta: obj.(*v1alpha1.RayClusterFleetList).ListMeta} + for _, item := range obj.(*v1alpha1.RayClusterFleetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested rayClusterFleets. +func (c *FakeRayClusterFleets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rayclusterfleetsResource, c.ns, opts)) + +} + +// Create takes the representation of a rayClusterFleet and creates it. Returns the server's representation of the rayClusterFleet, and an error, if there is any. +func (c *FakeRayClusterFleets) Create(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.CreateOptions) (result *v1alpha1.RayClusterFleet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rayclusterfleetsResource, c.ns, rayClusterFleet), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// Update takes the representation of a rayClusterFleet and updates it. Returns the server's representation of the rayClusterFleet, and an error, if there is any. +func (c *FakeRayClusterFleets) Update(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterFleet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rayclusterfleetsResource, c.ns, rayClusterFleet), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeRayClusterFleets) UpdateStatus(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (*v1alpha1.RayClusterFleet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(rayclusterfleetsResource, "status", c.ns, rayClusterFleet), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// Delete takes name of the rayClusterFleet and deletes it. Returns an error if one occurs. +func (c *FakeRayClusterFleets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(rayclusterfleetsResource, c.ns, name, opts), &v1alpha1.RayClusterFleet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRayClusterFleets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rayclusterfleetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RayClusterFleetList{}) + return err +} + +// Patch applies the patch and returns the patched rayClusterFleet. +func (c *FakeRayClusterFleets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterFleet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterfleetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied rayClusterFleet. +func (c *FakeRayClusterFleets) Apply(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) { + if rayClusterFleet == nil { + return nil, fmt.Errorf("rayClusterFleet provided to Apply must not be nil") + } + data, err := json.Marshal(rayClusterFleet) + if err != nil { + return nil, err + } + name := rayClusterFleet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterFleet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterfleetsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeRayClusterFleets) ApplyStatus(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) { + if rayClusterFleet == nil { + return nil, fmt.Errorf("rayClusterFleet provided to Apply must not be nil") + } + data, err := json.Marshal(rayClusterFleet) + if err != nil { + return nil, err + } + name := rayClusterFleet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterFleet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterfleetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.RayClusterFleet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterFleet), err +} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterreplicaset.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterreplicaset.go new file mode 100644 index 00000000..812ad4ae --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/fake/fake_rayclusterreplicaset.go @@ -0,0 +1,188 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/orchestration/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRayClusterReplicaSets implements RayClusterReplicaSetInterface +type FakeRayClusterReplicaSets struct { + Fake *FakeOrchestrationV1alpha1 + ns string +} + +var rayclusterreplicasetsResource = v1alpha1.SchemeGroupVersion.WithResource("rayclusterreplicasets") + +var rayclusterreplicasetsKind = v1alpha1.SchemeGroupVersion.WithKind("RayClusterReplicaSet") + +// Get takes name of the rayClusterReplicaSet, and returns the corresponding rayClusterReplicaSet object, and an error if there is any. +func (c *FakeRayClusterReplicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rayclusterreplicasetsResource, c.ns, name), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// List takes label and field selectors, and returns the list of RayClusterReplicaSets that match those selectors. +func (c *FakeRayClusterReplicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RayClusterReplicaSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rayclusterreplicasetsResource, rayclusterreplicasetsKind, c.ns, opts), &v1alpha1.RayClusterReplicaSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RayClusterReplicaSetList{ListMeta: obj.(*v1alpha1.RayClusterReplicaSetList).ListMeta} + for _, item := range obj.(*v1alpha1.RayClusterReplicaSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested rayClusterReplicaSets. +func (c *FakeRayClusterReplicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rayclusterreplicasetsResource, c.ns, opts)) + +} + +// Create takes the representation of a rayClusterReplicaSet and creates it. Returns the server's representation of the rayClusterReplicaSet, and an error, if there is any. +func (c *FakeRayClusterReplicaSets) Create(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.CreateOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rayclusterreplicasetsResource, c.ns, rayClusterReplicaSet), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// Update takes the representation of a rayClusterReplicaSet and updates it. Returns the server's representation of the rayClusterReplicaSet, and an error, if there is any. +func (c *FakeRayClusterReplicaSets) Update(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rayclusterreplicasetsResource, c.ns, rayClusterReplicaSet), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeRayClusterReplicaSets) UpdateStatus(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (*v1alpha1.RayClusterReplicaSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(rayclusterreplicasetsResource, "status", c.ns, rayClusterReplicaSet), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// Delete takes name of the rayClusterReplicaSet and deletes it. Returns an error if one occurs. +func (c *FakeRayClusterReplicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(rayclusterreplicasetsResource, c.ns, name, opts), &v1alpha1.RayClusterReplicaSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRayClusterReplicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rayclusterreplicasetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RayClusterReplicaSetList{}) + return err +} + +// Patch applies the patch and returns the patched rayClusterReplicaSet. +func (c *FakeRayClusterReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterreplicasetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied rayClusterReplicaSet. +func (c *FakeRayClusterReplicaSets) Apply(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + if rayClusterReplicaSet == nil { + return nil, fmt.Errorf("rayClusterReplicaSet provided to Apply must not be nil") + } + data, err := json.Marshal(rayClusterReplicaSet) + if err != nil { + return nil, err + } + name := rayClusterReplicaSet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterReplicaSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterreplicasetsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeRayClusterReplicaSets) ApplyStatus(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + if rayClusterReplicaSet == nil { + return nil, fmt.Errorf("rayClusterReplicaSet provided to Apply must not be nil") + } + data, err := json.Marshal(rayClusterReplicaSet) + if err != nil { + return nil, err + } + name := rayClusterReplicaSet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterReplicaSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rayclusterreplicasetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.RayClusterReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.RayClusterReplicaSet), err +} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..6deb7e5a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/generated_expansion.go @@ -0,0 +1,22 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type RayClusterFleetExpansion interface{} + +type RayClusterReplicaSetExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/orchestration_client.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/orchestration_client.go new file mode 100644 index 00000000..65490429 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/orchestration_client.go @@ -0,0 +1,111 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + "github.com/aibrix/aibrix/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type OrchestrationV1alpha1Interface interface { + RESTClient() rest.Interface + RayClusterFleetsGetter + RayClusterReplicaSetsGetter +} + +// OrchestrationV1alpha1Client is used to interact with features provided by the orchestration group. +type OrchestrationV1alpha1Client struct { + restClient rest.Interface +} + +func (c *OrchestrationV1alpha1Client) RayClusterFleets(namespace string) RayClusterFleetInterface { + return newRayClusterFleets(c, namespace) +} + +func (c *OrchestrationV1alpha1Client) RayClusterReplicaSets(namespace string) RayClusterReplicaSetInterface { + return newRayClusterReplicaSets(c, namespace) +} + +// NewForConfig creates a new OrchestrationV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*OrchestrationV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new OrchestrationV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*OrchestrationV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &OrchestrationV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new OrchestrationV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *OrchestrationV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OrchestrationV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *OrchestrationV1alpha1Client { + return &OrchestrationV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OrchestrationV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterfleet.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterfleet.go new file mode 100644 index 00000000..6c1db393 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterfleet.go @@ -0,0 +1,255 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/orchestration/v1alpha1" + scheme "github.com/aibrix/aibrix/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RayClusterFleetsGetter has a method to return a RayClusterFleetInterface. +// A group's client should implement this interface. +type RayClusterFleetsGetter interface { + RayClusterFleets(namespace string) RayClusterFleetInterface +} + +// RayClusterFleetInterface has methods to work with RayClusterFleet resources. +type RayClusterFleetInterface interface { + Create(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.CreateOptions) (*v1alpha1.RayClusterFleet, error) + Update(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (*v1alpha1.RayClusterFleet, error) + UpdateStatus(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (*v1alpha1.RayClusterFleet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.RayClusterFleet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RayClusterFleetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterFleet, err error) + Apply(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) + ApplyStatus(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) + RayClusterFleetExpansion +} + +// rayClusterFleets implements RayClusterFleetInterface +type rayClusterFleets struct { + client rest.Interface + ns string +} + +// newRayClusterFleets returns a RayClusterFleets +func newRayClusterFleets(c *OrchestrationV1alpha1Client, namespace string) *rayClusterFleets { + return &rayClusterFleets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the rayClusterFleet, and returns the corresponding rayClusterFleet object, and an error if there is any. +func (c *rayClusterFleets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RayClusterFleet, err error) { + result = &v1alpha1.RayClusterFleet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RayClusterFleets that match those selectors. +func (c *rayClusterFleets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RayClusterFleetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.RayClusterFleetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rayclusterfleets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested rayClusterFleets. +func (c *rayClusterFleets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rayclusterfleets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a rayClusterFleet and creates it. Returns the server's representation of the rayClusterFleet, and an error, if there is any. +func (c *rayClusterFleets) Create(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.CreateOptions) (result *v1alpha1.RayClusterFleet, err error) { + result = &v1alpha1.RayClusterFleet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rayclusterfleets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterFleet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a rayClusterFleet and updates it. Returns the server's representation of the rayClusterFleet, and an error, if there is any. +func (c *rayClusterFleets) Update(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterFleet, err error) { + result = &v1alpha1.RayClusterFleet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(rayClusterFleet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterFleet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *rayClusterFleets) UpdateStatus(ctx context.Context, rayClusterFleet *v1alpha1.RayClusterFleet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterFleet, err error) { + result = &v1alpha1.RayClusterFleet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(rayClusterFleet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterFleet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the rayClusterFleet and deletes it. Returns an error if one occurs. +func (c *rayClusterFleets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *rayClusterFleets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("rayclusterfleets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched rayClusterFleet. +func (c *rayClusterFleets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterFleet, err error) { + result = &v1alpha1.RayClusterFleet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied rayClusterFleet. +func (c *rayClusterFleets) Apply(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) { + if rayClusterFleet == nil { + return nil, fmt.Errorf("rayClusterFleet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(rayClusterFleet) + if err != nil { + return nil, err + } + name := rayClusterFleet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterFleet.Name must be provided to Apply") + } + result = &v1alpha1.RayClusterFleet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *rayClusterFleets) ApplyStatus(ctx context.Context, rayClusterFleet *orchestrationv1alpha1.RayClusterFleetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterFleet, err error) { + if rayClusterFleet == nil { + return nil, fmt.Errorf("rayClusterFleet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(rayClusterFleet) + if err != nil { + return nil, err + } + + name := rayClusterFleet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterFleet.Name must be provided to Apply") + } + + result = &v1alpha1.RayClusterFleet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("rayclusterfleets"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterreplicaset.go b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterreplicaset.go new file mode 100644 index 00000000..acdd007d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/orchestration/v1alpha1/rayclusterreplicaset.go @@ -0,0 +1,255 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/pkg/client/applyconfiguration/orchestration/v1alpha1" + scheme "github.com/aibrix/aibrix/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RayClusterReplicaSetsGetter has a method to return a RayClusterReplicaSetInterface. +// A group's client should implement this interface. +type RayClusterReplicaSetsGetter interface { + RayClusterReplicaSets(namespace string) RayClusterReplicaSetInterface +} + +// RayClusterReplicaSetInterface has methods to work with RayClusterReplicaSet resources. +type RayClusterReplicaSetInterface interface { + Create(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.CreateOptions) (*v1alpha1.RayClusterReplicaSet, error) + Update(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (*v1alpha1.RayClusterReplicaSet, error) + UpdateStatus(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (*v1alpha1.RayClusterReplicaSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.RayClusterReplicaSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RayClusterReplicaSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterReplicaSet, err error) + Apply(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) + ApplyStatus(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) + RayClusterReplicaSetExpansion +} + +// rayClusterReplicaSets implements RayClusterReplicaSetInterface +type rayClusterReplicaSets struct { + client rest.Interface + ns string +} + +// newRayClusterReplicaSets returns a RayClusterReplicaSets +func newRayClusterReplicaSets(c *OrchestrationV1alpha1Client, namespace string) *rayClusterReplicaSets { + return &rayClusterReplicaSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the rayClusterReplicaSet, and returns the corresponding rayClusterReplicaSet object, and an error if there is any. +func (c *rayClusterReplicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RayClusterReplicaSets that match those selectors. +func (c *rayClusterReplicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RayClusterReplicaSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.RayClusterReplicaSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested rayClusterReplicaSets. +func (c *rayClusterReplicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a rayClusterReplicaSet and creates it. Returns the server's representation of the rayClusterReplicaSet, and an error, if there is any. +func (c *rayClusterReplicaSets) Create(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.CreateOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterReplicaSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a rayClusterReplicaSet and updates it. Returns the server's representation of the rayClusterReplicaSet, and an error, if there is any. +func (c *rayClusterReplicaSets) Update(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(rayClusterReplicaSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterReplicaSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *rayClusterReplicaSets) UpdateStatus(ctx context.Context, rayClusterReplicaSet *v1alpha1.RayClusterReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(rayClusterReplicaSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rayClusterReplicaSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the rayClusterReplicaSet and deletes it. Returns an error if one occurs. +func (c *rayClusterReplicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *rayClusterReplicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched rayClusterReplicaSet. +func (c *rayClusterReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RayClusterReplicaSet, err error) { + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied rayClusterReplicaSet. +func (c *rayClusterReplicaSets) Apply(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + if rayClusterReplicaSet == nil { + return nil, fmt.Errorf("rayClusterReplicaSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(rayClusterReplicaSet) + if err != nil { + return nil, err + } + name := rayClusterReplicaSet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterReplicaSet.Name must be provided to Apply") + } + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *rayClusterReplicaSets) ApplyStatus(ctx context.Context, rayClusterReplicaSet *orchestrationv1alpha1.RayClusterReplicaSetApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.RayClusterReplicaSet, err error) { + if rayClusterReplicaSet == nil { + return nil, fmt.Errorf("rayClusterReplicaSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(rayClusterReplicaSet) + if err != nil { + return nil, err + } + + name := rayClusterReplicaSet.Name + if name == nil { + return nil, fmt.Errorf("rayClusterReplicaSet.Name must be provided to Apply") + } + + result = &v1alpha1.RayClusterReplicaSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("rayclusterreplicasets"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 626306c2..3edd09e6 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -26,6 +26,7 @@ import ( autoscaling "github.com/aibrix/aibrix/pkg/client/informers/externalversions/autoscaling" internalinterfaces "github.com/aibrix/aibrix/pkg/client/informers/externalversions/internalinterfaces" model "github.com/aibrix/aibrix/pkg/client/informers/externalversions/model" + orchestration "github.com/aibrix/aibrix/pkg/client/informers/externalversions/orchestration" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -255,6 +256,7 @@ type SharedInformerFactory interface { Autoscaling() autoscaling.Interface Model() model.Interface + Orchestration() orchestration.Interface } func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { @@ -264,3 +266,7 @@ func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { func (f *sharedInformerFactory) Model() model.Interface { return model.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Orchestration() orchestration.Interface { + return orchestration.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index fc778d6b..a07b2ea9 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,6 +22,7 @@ import ( v1alpha1 "github.com/aibrix/aibrix/api/autoscaling/v1alpha1" modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1" + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -60,6 +61,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case modelv1alpha1.SchemeGroupVersion.WithResource("modeladapters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Model().V1alpha1().ModelAdapters().Informer()}, nil + // Group=orchestration, Version=v1alpha1 + case orchestrationv1alpha1.SchemeGroupVersion.WithResource("rayclusterfleets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Orchestration().V1alpha1().RayClusterFleets().Informer()}, nil + case orchestrationv1alpha1.SchemeGroupVersion.WithResource("rayclusterreplicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Orchestration().V1alpha1().RayClusterReplicaSets().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/informers/externalversions/orchestration/interface.go b/pkg/client/informers/externalversions/orchestration/interface.go new file mode 100644 index 00000000..b785f529 --- /dev/null +++ b/pkg/client/informers/externalversions/orchestration/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package orchestration + +import ( + internalinterfaces "github.com/aibrix/aibrix/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aibrix/aibrix/pkg/client/informers/externalversions/orchestration/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/orchestration/v1alpha1/interface.go b/pkg/client/informers/externalversions/orchestration/v1alpha1/interface.go new file mode 100644 index 00000000..6e976a38 --- /dev/null +++ b/pkg/client/informers/externalversions/orchestration/v1alpha1/interface.go @@ -0,0 +1,51 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/aibrix/aibrix/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RayClusterFleets returns a RayClusterFleetInformer. + RayClusterFleets() RayClusterFleetInformer + // RayClusterReplicaSets returns a RayClusterReplicaSetInformer. + RayClusterReplicaSets() RayClusterReplicaSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RayClusterFleets returns a RayClusterFleetInformer. +func (v *version) RayClusterFleets() RayClusterFleetInformer { + return &rayClusterFleetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RayClusterReplicaSets returns a RayClusterReplicaSetInformer. +func (v *version) RayClusterReplicaSets() RayClusterReplicaSetInformer { + return &rayClusterReplicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterfleet.go b/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterfleet.go new file mode 100644 index 00000000..d3b54707 --- /dev/null +++ b/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterfleet.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + versioned "github.com/aibrix/aibrix/pkg/client/clientset/versioned" + internalinterfaces "github.com/aibrix/aibrix/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aibrix/aibrix/pkg/client/listers/orchestration/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RayClusterFleetInformer provides access to a shared informer and lister for +// RayClusterFleets. +type RayClusterFleetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RayClusterFleetLister +} + +type rayClusterFleetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRayClusterFleetInformer constructs a new informer for RayClusterFleet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRayClusterFleetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRayClusterFleetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRayClusterFleetInformer constructs a new informer for RayClusterFleet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRayClusterFleetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OrchestrationV1alpha1().RayClusterFleets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OrchestrationV1alpha1().RayClusterFleets(namespace).Watch(context.TODO(), options) + }, + }, + &orchestrationv1alpha1.RayClusterFleet{}, + resyncPeriod, + indexers, + ) +} + +func (f *rayClusterFleetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRayClusterFleetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *rayClusterFleetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&orchestrationv1alpha1.RayClusterFleet{}, f.defaultInformer) +} + +func (f *rayClusterFleetInformer) Lister() v1alpha1.RayClusterFleetLister { + return v1alpha1.NewRayClusterFleetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterreplicaset.go b/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterreplicaset.go new file mode 100644 index 00000000..46b052ff --- /dev/null +++ b/pkg/client/informers/externalversions/orchestration/v1alpha1/rayclusterreplicaset.go @@ -0,0 +1,89 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + orchestrationv1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + versioned "github.com/aibrix/aibrix/pkg/client/clientset/versioned" + internalinterfaces "github.com/aibrix/aibrix/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/aibrix/aibrix/pkg/client/listers/orchestration/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RayClusterReplicaSetInformer provides access to a shared informer and lister for +// RayClusterReplicaSets. +type RayClusterReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RayClusterReplicaSetLister +} + +type rayClusterReplicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRayClusterReplicaSetInformer constructs a new informer for RayClusterReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRayClusterReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRayClusterReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRayClusterReplicaSetInformer constructs a new informer for RayClusterReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRayClusterReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OrchestrationV1alpha1().RayClusterReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OrchestrationV1alpha1().RayClusterReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &orchestrationv1alpha1.RayClusterReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *rayClusterReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRayClusterReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *rayClusterReplicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&orchestrationv1alpha1.RayClusterReplicaSet{}, f.defaultInformer) +} + +func (f *rayClusterReplicaSetInformer) Lister() v1alpha1.RayClusterReplicaSetLister { + return v1alpha1.NewRayClusterReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/orchestration/v1alpha1/expansion_generated.go b/pkg/client/listers/orchestration/v1alpha1/expansion_generated.go new file mode 100644 index 00000000..755f1775 --- /dev/null +++ b/pkg/client/listers/orchestration/v1alpha1/expansion_generated.go @@ -0,0 +1,34 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// RayClusterFleetListerExpansion allows custom methods to be added to +// RayClusterFleetLister. +type RayClusterFleetListerExpansion interface{} + +// RayClusterFleetNamespaceListerExpansion allows custom methods to be added to +// RayClusterFleetNamespaceLister. +type RayClusterFleetNamespaceListerExpansion interface{} + +// RayClusterReplicaSetListerExpansion allows custom methods to be added to +// RayClusterReplicaSetLister. +type RayClusterReplicaSetListerExpansion interface{} + +// RayClusterReplicaSetNamespaceListerExpansion allows custom methods to be added to +// RayClusterReplicaSetNamespaceLister. +type RayClusterReplicaSetNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/orchestration/v1alpha1/rayclusterfleet.go b/pkg/client/listers/orchestration/v1alpha1/rayclusterfleet.go new file mode 100644 index 00000000..6c333ec9 --- /dev/null +++ b/pkg/client/listers/orchestration/v1alpha1/rayclusterfleet.go @@ -0,0 +1,98 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RayClusterFleetLister helps list RayClusterFleets. +// All objects returned here must be treated as read-only. +type RayClusterFleetLister interface { + // List lists all RayClusterFleets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RayClusterFleet, err error) + // RayClusterFleets returns an object that can list and get RayClusterFleets. + RayClusterFleets(namespace string) RayClusterFleetNamespaceLister + RayClusterFleetListerExpansion +} + +// rayClusterFleetLister implements the RayClusterFleetLister interface. +type rayClusterFleetLister struct { + indexer cache.Indexer +} + +// NewRayClusterFleetLister returns a new RayClusterFleetLister. +func NewRayClusterFleetLister(indexer cache.Indexer) RayClusterFleetLister { + return &rayClusterFleetLister{indexer: indexer} +} + +// List lists all RayClusterFleets in the indexer. +func (s *rayClusterFleetLister) List(selector labels.Selector) (ret []*v1alpha1.RayClusterFleet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RayClusterFleet)) + }) + return ret, err +} + +// RayClusterFleets returns an object that can list and get RayClusterFleets. +func (s *rayClusterFleetLister) RayClusterFleets(namespace string) RayClusterFleetNamespaceLister { + return rayClusterFleetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RayClusterFleetNamespaceLister helps list and get RayClusterFleets. +// All objects returned here must be treated as read-only. +type RayClusterFleetNamespaceLister interface { + // List lists all RayClusterFleets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RayClusterFleet, err error) + // Get retrieves the RayClusterFleet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RayClusterFleet, error) + RayClusterFleetNamespaceListerExpansion +} + +// rayClusterFleetNamespaceLister implements the RayClusterFleetNamespaceLister +// interface. +type rayClusterFleetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RayClusterFleets in the indexer for a given namespace. +func (s rayClusterFleetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RayClusterFleet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RayClusterFleet)) + }) + return ret, err +} + +// Get retrieves the RayClusterFleet from the indexer for a given namespace and name. +func (s rayClusterFleetNamespaceLister) Get(name string) (*v1alpha1.RayClusterFleet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("rayclusterfleet"), name) + } + return obj.(*v1alpha1.RayClusterFleet), nil +} diff --git a/pkg/client/listers/orchestration/v1alpha1/rayclusterreplicaset.go b/pkg/client/listers/orchestration/v1alpha1/rayclusterreplicaset.go new file mode 100644 index 00000000..6633d9c8 --- /dev/null +++ b/pkg/client/listers/orchestration/v1alpha1/rayclusterreplicaset.go @@ -0,0 +1,98 @@ +/* +Copyright 2024 The Aibrix Team. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/aibrix/aibrix/api/orchestration/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RayClusterReplicaSetLister helps list RayClusterReplicaSets. +// All objects returned here must be treated as read-only. +type RayClusterReplicaSetLister interface { + // List lists all RayClusterReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RayClusterReplicaSet, err error) + // RayClusterReplicaSets returns an object that can list and get RayClusterReplicaSets. + RayClusterReplicaSets(namespace string) RayClusterReplicaSetNamespaceLister + RayClusterReplicaSetListerExpansion +} + +// rayClusterReplicaSetLister implements the RayClusterReplicaSetLister interface. +type rayClusterReplicaSetLister struct { + indexer cache.Indexer +} + +// NewRayClusterReplicaSetLister returns a new RayClusterReplicaSetLister. +func NewRayClusterReplicaSetLister(indexer cache.Indexer) RayClusterReplicaSetLister { + return &rayClusterReplicaSetLister{indexer: indexer} +} + +// List lists all RayClusterReplicaSets in the indexer. +func (s *rayClusterReplicaSetLister) List(selector labels.Selector) (ret []*v1alpha1.RayClusterReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RayClusterReplicaSet)) + }) + return ret, err +} + +// RayClusterReplicaSets returns an object that can list and get RayClusterReplicaSets. +func (s *rayClusterReplicaSetLister) RayClusterReplicaSets(namespace string) RayClusterReplicaSetNamespaceLister { + return rayClusterReplicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RayClusterReplicaSetNamespaceLister helps list and get RayClusterReplicaSets. +// All objects returned here must be treated as read-only. +type RayClusterReplicaSetNamespaceLister interface { + // List lists all RayClusterReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RayClusterReplicaSet, err error) + // Get retrieves the RayClusterReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RayClusterReplicaSet, error) + RayClusterReplicaSetNamespaceListerExpansion +} + +// rayClusterReplicaSetNamespaceLister implements the RayClusterReplicaSetNamespaceLister +// interface. +type rayClusterReplicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RayClusterReplicaSets in the indexer for a given namespace. +func (s rayClusterReplicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RayClusterReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RayClusterReplicaSet)) + }) + return ret, err +} + +// Get retrieves the RayClusterReplicaSet from the indexer for a given namespace and name. +func (s rayClusterReplicaSetNamespaceLister) Get(name string) (*v1alpha1.RayClusterReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("rayclusterreplicaset"), name) + } + return obj.(*v1alpha1.RayClusterReplicaSet), nil +}