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

Merge dev to main #280

Merged
merged 11 commits into from
Mar 15, 2024
55 changes: 55 additions & 0 deletions api/v1alpha1/clusterset_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2024. projectsveltos.io. All rights reserved.

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.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// ClusterSetFinalizer allows ClusterSetReconciler to clean up resources associated with
// ClusterSet before removing it from the apiserver.
ClusterSetFinalizer = "clustersetfinalizer.projectsveltos.io"

ClusterSetKind = "ClusterSet"
)

//+kubebuilder:object:root=true
//+kubebuilder:resource:path=clustersets,scope=Cluster
//+kubebuilder:subresource:status

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

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

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&ClusterSet{}, &ClusterSetList{})
}
55 changes: 55 additions & 0 deletions api/v1alpha1/set_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2024. projectsveltos.io. All rights reserved.

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.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// SetFinalizer allows SetReconciler to clean up resources associated with
// Set before removing it from the apiserver.
SetFinalizer = "setfinalizer.projectsveltos.io"

SetKind = "Set"
)

//+kubebuilder:object:root=true
//+kubebuilder:resource:path=sets,scope=Namespaced
//+kubebuilder:subresource:status

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

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

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&Set{}, &SetList{})
}
35 changes: 35 additions & 0 deletions api/v1alpha1/spec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Copyright 2024. projectsveltos.io. All rights reserved.

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.
*/

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
)

type Spec struct {
// ClusterSelector identifies clusters to associate to.
// +optional
ClusterSelector Selector `json:"clusterSelector,omitempty"`

// ClusterRefs identifies clusters to associate to.
// +optional
ClusterRefs []corev1.ObjectReference `json:"clusterRefs,omitempty"`

// MaxReplicas specifies the maximum number of clusters to be selected
// from the pool matching the clusterSelector.
MaxReplicas int `json:"maxReplicas,omitempty"`
}
32 changes: 32 additions & 0 deletions api/v1alpha1/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2023. projectsveltos.io. All rights reserved.

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.
*/

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
)

// Status defines the observed state of ClusterSet/Set
type Status struct {
// MatchingClusterRefs reference all the clusters currently matching
// ClusterSet/Set ClusterSelector
MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusterRefs,omitempty"`

// SelectedClusters reference all the cluster currently selected among
// all the ones matching
SelectedClusterRefs []corev1.ObjectReference `json:"selectedClusterRefs,omitempty"`
}
164 changes: 163 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

Loading
Loading