Skip to content

Commit

Permalink
Merge pull request #69 from gianlucam76/v1beta1
Browse files Browse the repository at this point in the history
Move to v1beta1
  • Loading branch information
gianlucam76 authored Jun 23, 2024
2 parents 1687004 + 66aacae commit d98966e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ARCH ?= amd64
OS ?= $(shell uname -s | tr A-Z a-z)
K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= main
TAG ?= dev

## Tool Binaries
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resources:
domain: projectsveltos.io
group: lib
kind: SveltosCluster
version: v1alpha1
version: v1beta1
- controller: true
domain: x-k8s.io
group: cluster
Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
"github.com/projectsveltos/libsveltos/lib/crd"
"github.com/projectsveltos/libsveltos/lib/logsettings"
"github.com/projectsveltos/shard-controller/internal/controller"
Expand Down Expand Up @@ -119,7 +119,7 @@ func main() {
ctx := ctrl.SetupSignalHandler()

logsettings.RegisterForLogSettings(ctx,
libsveltosv1alpha1.ComponentShardController, ctrl.Log.WithName("log-setter"),
libsveltosv1beta1.ComponentShardController, ctrl.Log.WithName("log-setter"),
ctrl.GetConfigOrDie())

if err = (&controller.SveltosClusterReconciler{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/pkg/errors v0.9.1
github.com/projectsveltos/libsveltos v0.32.1-0.20240611141238-c8675b616482
github.com/projectsveltos/libsveltos v0.32.1-0.20240623114855-e2d71f6c02d4
github.com/spf13/pflag v1.0.5
golang.org/x/text v0.16.0
k8s.io/api v0.30.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/projectsveltos/libsveltos v0.32.1-0.20240611141238-c8675b616482 h1:FSLwV0I/Z4mzcfY+iP46bz1CT07AMzK34xXdPm7Fahs=
github.com/projectsveltos/libsveltos v0.32.1-0.20240611141238-c8675b616482/go.mod h1:z6avfRqeHbzqkThyqqqoGcCWMI0JBeAjdeZlbJ7P8TI=
github.com/projectsveltos/libsveltos v0.32.1-0.20240623114855-e2d71f6c02d4 h1:P7DLljBI/BmqS9hFNoN4kaTaTvnYjUBs7XKLxP4v8Sc=
github.com/projectsveltos/libsveltos v0.32.1-0.20240623114855-e2d71f6c02d4/go.mod h1:z6avfRqeHbzqkThyqqqoGcCWMI0JBeAjdeZlbJ7P8TI=
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/sveltoscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
logs "github.com/projectsveltos/libsveltos/lib/logsettings"
)

Expand All @@ -46,7 +46,7 @@ func (r *SveltosClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reque
logger.V(logs.LogInfo).Info("Reconciling SveltosCluster")

// Fecth the SveltosCluster instance
sveltosCluster := &libsveltosv1alpha1.SveltosCluster{}
sveltosCluster := &libsveltosv1beta1.SveltosCluster{}
addTypeInformationToObject(r.Scheme, sveltosCluster)
return reconcile.Result{}, processCluster(ctx, r.Config, r.Client, r.AgentInMgmtCluster,
sveltosCluster, req, logger)
Expand All @@ -55,6 +55,6 @@ func (r *SveltosClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// SetupWithManager sets up the controller with the Manager.
func (r *SveltosClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&libsveltosv1alpha1.SveltosCluster{}).
For(&libsveltosv1beta1.SveltosCluster{}).
Complete(r)
}
4 changes: 2 additions & 2 deletions internal/controller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
logs "github.com/projectsveltos/libsveltos/lib/logsettings"
libsveltosset "github.com/projectsveltos/libsveltos/lib/set"
"github.com/projectsveltos/libsveltos/lib/sharding"
Expand Down Expand Up @@ -89,7 +89,7 @@ func InitScheme() (*runtime.Scheme, error) {
if err := clusterv1.AddToScheme(s); err != nil {
return nil, err
}
if err := libsveltosv1alpha1.AddToScheme(s); err != nil {
if err := libsveltosv1beta1.AddToScheme(s); err != nil {
return nil, err
}
if err := apiextensionsv1.AddToScheme(s); err != nil {
Expand Down
20 changes: 10 additions & 10 deletions internal/controller/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
libsveltosset "github.com/projectsveltos/libsveltos/lib/set"
"github.com/projectsveltos/libsveltos/lib/sharding"
"github.com/projectsveltos/shard-controller/internal/controller"
Expand Down Expand Up @@ -187,7 +187,7 @@ var _ = Describe("Utils", func() {

It("processCluster, for existing cluster, starts tracking it", func() {
shardKey := randomString()
cluster := &libsveltosv1alpha1.SveltosCluster{
cluster := &libsveltosv1beta1.SveltosCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: randomString(),
Name: randomString(),
Expand Down Expand Up @@ -223,16 +223,16 @@ var _ = Describe("Utils", func() {
clusterRef := &corev1.ObjectReference{
Namespace: cluster.Namespace,
Name: cluster.Name,
Kind: libsveltosv1alpha1.SveltosClusterKind,
APIVersion: libsveltosv1alpha1.GroupVersion.String(),
Kind: libsveltosv1beta1.SveltosClusterKind,
APIVersion: libsveltosv1beta1.GroupVersion.String(),
}
verifyClusterIsRegisteredForShard(clusterRef, shardKey)

cluster.Annotations = map[string]string{}
Expect(testEnv.Update(context.TODO(), cluster)).To(Succeed())

Eventually(func() bool {
currentCluster := &libsveltosv1alpha1.SveltosCluster{}
currentCluster := &libsveltosv1beta1.SveltosCluster{}
err = testEnv.Get(context.TODO(),
types.NamespacedName{Namespace: cluster.Namespace, Name: cluster.Name}, currentCluster)
if err != nil {
Expand All @@ -255,7 +255,7 @@ var _ = Describe("Utils", func() {

It("processCluster, for deleted cluster, stops tracking it", func() {
shardKey := randomString()
cluster := &libsveltosv1alpha1.SveltosCluster{
cluster := &libsveltosv1beta1.SveltosCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: randomString(),
Name: randomString(),
Expand All @@ -268,8 +268,8 @@ var _ = Describe("Utils", func() {
clusterRef := &corev1.ObjectReference{
Namespace: cluster.Namespace,
Name: cluster.Name,
Kind: libsveltosv1alpha1.SveltosClusterKind,
APIVersion: libsveltosv1alpha1.GroupVersion.String(),
Kind: libsveltosv1beta1.SveltosClusterKind,
APIVersion: libsveltosv1beta1.GroupVersion.String(),
}

req := ctrl.Request{
Expand Down Expand Up @@ -416,8 +416,8 @@ func getClusterRef() *corev1.ObjectReference {
return &corev1.ObjectReference{
Name: randomString(),
Namespace: randomString(),
Kind: string(libsveltosv1alpha1.ClusterTypeSveltos),
APIVersion: libsveltosv1alpha1.GroupVersion.String(),
Kind: string(libsveltosv1beta1.ClusterTypeSveltos),
APIVersion: libsveltosv1beta1.GroupVersion.String(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/test/helpers/external/sveltos-api-const.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ package external

const (
clusterProfileGroup = "config.projectsveltos.io"
clusterProfileTestVersion = "v1alpha1"
clusterProfileTestVersion = "v1beta1"
)
4 changes: 2 additions & 2 deletions test/fv/fv_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1"
"github.com/projectsveltos/libsveltos/lib/sharding"
)

Expand Down Expand Up @@ -92,7 +92,7 @@ var _ = BeforeSuite(func() {

Expect(clientgoscheme.AddToScheme(scheme)).To(Succeed())
Expect(clusterv1.AddToScheme(scheme)).To(Succeed())
Expect(libsveltosv1alpha1.AddToScheme(scheme)).To(Succeed())
Expect(libsveltosv1beta1.AddToScheme(scheme)).To(Succeed())
Expect(sourcev1.AddToScheme(scheme)).To(Succeed())

var err error
Expand Down

0 comments on commit d98966e

Please sign in to comment.