Skip to content

Commit

Permalink
Top-level MultiKueue cluster API (#1631)
Browse files Browse the repository at this point in the history
* [api/v1alpha1] Make MultiKueueCluster an API object.

* [multikueue] Make MultiKueueCluster an API object.

* Fix after rebase

* Review Remarks

* Review Remarks

* Review Remarks

* [API/multikueue] Drop KubeConfig.Name

* Review remarks

* Review remarks
  • Loading branch information
trasc authored Jan 29, 2024
1 parent 3b37fbf commit 248255d
Show file tree
Hide file tree
Showing 42 changed files with 2,493 additions and 971 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,9 @@ import (

const (
MultiKueueConfigSecretKey = "kubeconfig"
MultiKueueClusterActive = "Active"
)

// MultiKueueConfigSpec defines the desired state of MultiKueueConfig
type MultiKueueConfigSpec struct {
// clusters contains the list of configurations for using worker clusters.
//
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=100
Clusters []MultiKueueCluster `json:"clusters"`
}

type MultiKueueCluster struct {
Name string `json:"name"`
KubeconfigRef KubeconfigRef `json:"kubeconfigRef"`
}

type LocationType string

const (
Expand All @@ -48,11 +33,11 @@ const (
SecretLocationType LocationType = "Secret"
)

type KubeconfigRef struct {
// Name of the cluster inside the given KubeConfig.
Name string `json:"name"`

type KubeConfig struct {
// Location of the KubeConfig.
//
// If LocationType is Secret then Location is the name of the secret inside the namespace in
// which the kueue controller manager is running. The config should be stored in the "kubeconfig" key.
Location string `json:"location"`

// Type of the KubeConfig location.
Expand All @@ -62,21 +47,70 @@ type KubeconfigRef struct {
LocationType LocationType `json:"locationType"`
}

//+genclient
//+genclient:nonNamespaced
//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:resource:scope=Cluster
type MultiKueueClusterSpec struct {
// Information how to connect to the cluster.
KubeConfig KubeConfig `json:"kubeConfig"`
}

type MultiKueueClusterStatus struct {
// +optional
// +listType=map
// +listMapKey=type
// +patchStrategy=merge
// +patchMergeKey=type
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// MultiKueueCluster is the Schema for the multikueue API
type MultiKueueCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MultiKueueClusterSpec `json:"spec,omitempty"`
Status MultiKueueClusterStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// MultiKueueClusterList contains a list of MultiKueueCluster
type MultiKueueClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MultiKueueCluster `json:"items"`
}

// MultiKueueConfigSpec defines the desired state of MultiKueueConfig
type MultiKueueConfigSpec struct {
// List of MultiKueueClusters names where the workloads from the ClusterQueue should be distributed.
//
// +listType=set
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=10
Clusters []string `json:"clusters"`
}

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:scope=Cluster

// MultiKueueConfig is the Schema for the provisioningrequestconfig API
// MultiKueueConfig is the Schema for the multikueue API
type MultiKueueConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MultiKueueConfigSpec `json:"spec,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// MultiKueueConfigList contains a list of MultiKueueConfig
type MultiKueueConfigList struct {
Expand All @@ -86,5 +120,5 @@ type MultiKueueConfigList struct {
}

func init() {
SchemeBuilder.Register(&MultiKueueConfig{}, &MultiKueueConfigList{})
SchemeBuilder.Register(&MultiKueueConfig{}, &MultiKueueConfigList{}, &MultiKueueCluster{}, &MultiKueueClusterList{})
}
94 changes: 88 additions & 6 deletions apis/kueue/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 248255d

Please sign in to comment.