Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Top-level MultiKueue cluster API #1631

Merged
merged 9 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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