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

🌱 Update the latest version to v0.15.2 #461

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
open-cluster-management.io/api v0.15.1-0.20241106012558-db876bf4ff8a
open-cluster-management.io/cluster-proxy v0.4.0
open-cluster-management.io/managed-serviceaccount v0.6.0
open-cluster-management.io/ocm v0.15.0
open-cluster-management.io/ocm v0.15.2
open-cluster-management.io/sdk-go v0.15.0
sigs.k8s.io/apiserver-network-proxy v0.29.0
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ open-cluster-management.io/cluster-proxy v0.4.0 h1:rm0UDaDWe3/P3xLzwqdHtqNksKwSz
open-cluster-management.io/cluster-proxy v0.4.0/go.mod h1:gTvfDHAhGezhdg4BD3ECBn6jbg2Y5PbHhV2ceW5nrB0=
open-cluster-management.io/managed-serviceaccount v0.6.0 h1:qIi5T9WQJBuoGqnYGIktXbtqfQoiN2H9XU2P/6lAQiw=
open-cluster-management.io/managed-serviceaccount v0.6.0/go.mod h1:G4LUTbZiyrB8c0+rqi/xnDmGlsg7Rdr4T7MPLCWhyQI=
open-cluster-management.io/ocm v0.15.0 h1:anXQzvQUhM/DT8FcKVi4n8AY97IA5DVI0mb8R1wsvbs=
open-cluster-management.io/ocm v0.15.0/go.mod h1:d6ubRiBaouiQ+yV+wFAmarpU7I77nXhkJnQJf8gLZC4=
open-cluster-management.io/ocm v0.15.2 h1:i1b3a7mRrRVJlw9rooEFmZuHdaRVrmfoBOuEDfyxklI=
open-cluster-management.io/ocm v0.15.2/go.mod h1:d6ubRiBaouiQ+yV+wFAmarpU7I77nXhkJnQJf8gLZC4=
open-cluster-management.io/sdk-go v0.15.0 h1:2IAJnPfUoY6rPC5w7LhqAnvIlgekPoVW03LdZO1unIM=
open-cluster-management.io/sdk-go v0.15.0/go.mod h1:fi5WBsbC5K3txKb8eRLuP0Sim/Oqz/PHX18skAEyjiA=
oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo=
Expand Down
6 changes: 5 additions & 1 deletion pkg/cmd/init/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ func (o *Options) run() error {
}

if !o.ClusteradmFlags.DryRun {
if err := helperwait.WaitUntilCRDReady(apiExtensionsClient, "clustermanagers.operator.open-cluster-management.io", o.wait); err != nil {
if err := helperwait.WaitUntilCRDReady(
o.Streams.Out, apiExtensionsClient, "clustermanagers.operator.open-cluster-management.io", o.wait); err != nil {
return err
}
}
if o.wait && !o.ClusteradmFlags.DryRun {
if err := helperwait.WaitUntilRegistrationOperatorReady(
o.Streams.Out,
o.ClusteradmFlags.KubectlFactory,
int64(o.ClusteradmFlags.Timeout)); err != nil {
return err
Expand All @@ -202,6 +204,7 @@ func (o *Options) run() error {

if o.wait && !o.ClusteradmFlags.DryRun {
if err := helperwait.WaitUntilClusterManagerRegistrationReady(
o.Streams.Out,
o.ClusteradmFlags.KubectlFactory,
int64(o.ClusteradmFlags.Timeout)); err != nil {
return err
Expand Down Expand Up @@ -318,6 +321,7 @@ func (o *Options) deploySingletonControlplane(kubeClient kubernetes.Interface) e
// fetch the kubeconfig and get the token
if o.wait && !o.ClusteradmFlags.DryRun {
if err := helperwait.WaitUntilMulticlusterControlplaneReady(
o.Streams.Out,
o.ClusteradmFlags.KubectlFactory,
o.SingletonName,
int64(o.ClusteradmFlags.Timeout)); err != nil {
Expand Down
21 changes: 15 additions & 6 deletions pkg/cmd/join/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/pem"
"fmt"
gherrors "github.com/pkg/errors"
"io"
"os"
"reflect"
"strings"
Expand Down Expand Up @@ -395,26 +396,30 @@ func (o *Options) applyKlusterlet(r *reader.ResourceReader, operatorClient opera
}

if !o.ClusteradmFlags.DryRun {
if err := wait.WaitUntilCRDReady(apiExtensionsClient, "klusterlets.operator.open-cluster-management.io", o.wait); err != nil {
if err := wait.WaitUntilCRDReady(
o.Streams.Out, apiExtensionsClient, "klusterlets.operator.open-cluster-management.io", o.wait); err != nil {
return err
}
}

if !available && o.wait && !o.ClusteradmFlags.DryRun {
err = waitUntilRegistrationOperatorConditionIsTrue(o.ClusteradmFlags.KubectlFactory, int64(o.ClusteradmFlags.Timeout))
err = waitUntilRegistrationOperatorConditionIsTrue(
o.Streams.Out, o.ClusteradmFlags.KubectlFactory, int64(o.ClusteradmFlags.Timeout))
if err != nil {
return err
}
}

if o.wait && !o.ClusteradmFlags.DryRun {
if o.mode == string(operatorv1.InstallModeHosted) {
err = waitUntilKlusterletConditionIsTrue(operatorClient, int64(o.ClusteradmFlags.Timeout), o.klusterletChartConfig.Klusterlet.Name)
err = waitUntilKlusterletConditionIsTrue(
o.Streams.Out, operatorClient, int64(o.ClusteradmFlags.Timeout), o.klusterletChartConfig.Klusterlet.Name)
if err != nil {
return err
}
} else {
err = waitUntilKlusterletConditionIsTrue(operatorClient, int64(o.ClusteradmFlags.Timeout), o.klusterletChartConfig.Klusterlet.Name)
err = waitUntilKlusterletConditionIsTrue(
o.Streams.Out, operatorClient, int64(o.ClusteradmFlags.Timeout), o.klusterletChartConfig.Klusterlet.Name)
if err != nil {
return err
}
Expand Down Expand Up @@ -475,6 +480,7 @@ func (o *Options) waitUntilManagedClusterIsCreated(timeout int64, clusterName st
phase := &atomic.Value{}
phase.Store("")
operatorSpinner := printer.NewSpinnerWithStatus(
o.Streams.Out,
"Waiting for managed cluster to be created...",
time.Millisecond*500,
"Managed cluster is created.\n",
Expand Down Expand Up @@ -505,7 +511,7 @@ func (o *Options) waitUntilManagedClusterIsCreated(timeout int64, clusterName st
})
}

func waitUntilRegistrationOperatorConditionIsTrue(f util.Factory, timeout int64) error {
func waitUntilRegistrationOperatorConditionIsTrue(w io.Writer, f util.Factory, timeout int64) error {
var restConfig *rest.Config
restConfig, err := f.ToRESTConfig()
if err != nil {
Expand All @@ -519,6 +525,7 @@ func waitUntilRegistrationOperatorConditionIsTrue(f util.Factory, timeout int64)
phase := &atomic.Value{}
phase.Store("")
operatorSpinner := printer.NewSpinnerWithStatus(
w,
"Waiting for registration operator to become ready...",
time.Millisecond*500,
"Registration operator is now available.\n",
Expand Down Expand Up @@ -556,10 +563,12 @@ func waitUntilRegistrationOperatorConditionIsTrue(f util.Factory, timeout int64)
}

// Wait until the klusterlet condition available=true, or timeout in $timeout seconds
func waitUntilKlusterletConditionIsTrue(client operatorclient.Interface, timeout int64, klusterletName string) error {
func waitUntilKlusterletConditionIsTrue(
w io.Writer, client operatorclient.Interface, timeout int64, klusterletName string) error {
phase := &atomic.Value{}
phase.Store("")
klusterletSpinner := printer.NewSpinnerWithStatus(
w,
"Waiting for klusterlet agent to become ready...",
time.Millisecond*500,
"Klusterlet is now available.\n",
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/upgrade/clustermanager/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ func (o *Options) run() error {
}

if !o.ClusteradmFlags.DryRun {
if err := wait.WaitUntilCRDReady(apiExtensionsClient, "clustermanagers.operator.open-cluster-management.io", o.wait); err != nil {
if err := wait.WaitUntilCRDReady(
o.Streams.Out, apiExtensionsClient, "clustermanagers.operator.open-cluster-management.io", o.wait); err != nil {
return err
}
}
if o.wait && !o.ClusteradmFlags.DryRun {
if err := wait.WaitUntilRegistrationOperatorReady(
o.Streams.Out,
o.ClusteradmFlags.KubectlFactory,
int64(o.ClusteradmFlags.Timeout)); err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/upgrade/klusterlet/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ func (o *Options) run() error {
}

if !o.ClusteradmFlags.DryRun {
if err := wait.WaitUntilCRDReady(apiExtensionsClient, "klusterlets.operator.open-cluster-management.io", o.wait); err != nil {
if err := wait.WaitUntilCRDReady(
o.Streams.Out, apiExtensionsClient, "klusterlets.operator.open-cluster-management.io", o.wait); err != nil {
return err
}
}
if o.wait && !o.ClusteradmFlags.DryRun {
if err := wait.WaitUntilRegistrationOperatorReady(
o.Streams.Out,
o.ClusteradmFlags.KubectlFactory,
int64(o.ClusteradmFlags.Timeout)); err != nil {
return err
Expand Down
8 changes: 5 additions & 3 deletions pkg/helpers/printer/prefixwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ type flusher interface {
Flush()
}

func NewSpinner(suffix string, interval time.Duration) *spinner.Spinner {
func NewSpinner(w io.Writer, suffix string, interval time.Duration) *spinner.Spinner {
return spinner.New(
spinner.CharSets[14],
interval,
spinner.WithWriter(w),
spinner.WithColor("green"),
spinner.WithHiddenCursor(true),
spinner.WithSuffix(suffixColor.Sprintf(" %s", suffix)))
}

func NewSpinnerWithStatus(suffix string, interval time.Duration, final string, statusFunc func() string) *spinner.Spinner {
s := NewSpinner(suffix, interval)
func NewSpinnerWithStatus(
w io.Writer, suffix string, interval time.Duration, final string, statusFunc func() string) *spinner.Spinner {
s := NewSpinner(w, suffix, interval)
s.FinalMSG = final
s.PreUpdate = func(s *spinner.Spinner) {
status := statusFunc()
Expand Down
14 changes: 9 additions & 5 deletions pkg/helpers/wait/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package wait
import (
"context"
"fmt"
"io"
"sync/atomic"
"time"

Expand All @@ -21,20 +22,20 @@ import (
"open-cluster-management.io/clusteradm/pkg/helpers/printer"
)

func WaitUntilCRDReady(apiExtensionsClient apiextensionsclient.Interface, crdName string, wait bool) error {
func WaitUntilCRDReady(w io.Writer, apiExtensionsClient apiextensionsclient.Interface, crdName string, wait bool) error {
b := retry.DefaultBackoff
b.Duration = 200 * time.Millisecond

if wait {
crdSpinner := printer.NewSpinner("Waiting for CRD to be ready...", time.Second)
crdSpinner := printer.NewSpinner(w, "Waiting for CRD to be ready...", time.Second)
crdSpinner.FinalMSG = "CRD successfully registered.\n"
crdSpinner.Start()
defer crdSpinner.Stop()
}
return helpers.WaitCRDToBeReady(apiExtensionsClient, crdName, b, wait)
}

func WaitUntilRegistrationOperatorReady(f util.Factory, timeout int64) error {
func WaitUntilRegistrationOperatorReady(w io.Writer, f util.Factory, timeout int64) error {
var restConfig *rest.Config
restConfig, err := f.ToRESTConfig()
if err != nil {
Expand All @@ -49,6 +50,7 @@ func WaitUntilRegistrationOperatorReady(f util.Factory, timeout int64) error {
phase.Store("")
text := "Waiting for registration operator to become ready..."
operatorSpinner := printer.NewSpinnerWithStatus(
w,
text,
time.Second,
"Registration operator is now available.\n",
Expand Down Expand Up @@ -85,7 +87,7 @@ func WaitUntilRegistrationOperatorReady(f util.Factory, timeout int64) error {
})
}

func WaitUntilClusterManagerRegistrationReady(f util.Factory, timeout int64) error {
func WaitUntilClusterManagerRegistrationReady(w io.Writer, f util.Factory, timeout int64) error {
var restConfig *rest.Config
restConfig, err := f.ToRESTConfig()
if err != nil {
Expand All @@ -100,6 +102,7 @@ func WaitUntilClusterManagerRegistrationReady(f util.Factory, timeout int64) err
phase.Store("")
text := "Waiting for cluster manager registration to become ready..."
clusterManagerSpinner := printer.NewSpinnerWithStatus(
w,
text,
time.Second,
"ClusterManager registration is now available.\n",
Expand Down Expand Up @@ -136,7 +139,7 @@ func WaitUntilClusterManagerRegistrationReady(f util.Factory, timeout int64) err
})
}

func WaitUntilMulticlusterControlplaneReady(f util.Factory, ns string, timeout int64) error {
func WaitUntilMulticlusterControlplaneReady(w io.Writer, f util.Factory, ns string, timeout int64) error {
var restConfig *rest.Config
restConfig, err := f.ToRESTConfig()
if err != nil {
Expand All @@ -151,6 +154,7 @@ func WaitUntilMulticlusterControlplaneReady(f util.Factory, ns string, timeout i
phase.Store("")
text := "Waiting for multicluster controlplane to become ready..."
clusterManagerSpinner := printer.NewSpinnerWithStatus(
w,
text,
time.Second,
"Multicluster controlplane is now available.\n",
Expand Down
9 changes: 8 additions & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type VersionBundle struct {
MulticlusterControlplane string
}

var defaultBundleVersion = "0.15.0"
var defaultBundleVersion = "0.15.2"

func GetDefaultBundleVersion() string {
return defaultBundleVersion
Expand Down Expand Up @@ -106,6 +106,13 @@ func GetVersionBundle(version string) (VersionBundle, error) {
MulticlusterControlplane: "v0.6.0",
}

versionBundleList["0.15.2"] = VersionBundle{
OCM: "v0.15.2",
AppAddon: "v0.15.0",
PolicyAddon: "v0.15.0",
MulticlusterControlplane: "v0.6.0",
}

// default
versionBundleList["default"] = versionBundleList[defaultBundleVersion]

Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versio
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/scheme
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/typed/authentication/v1alpha1
open-cluster-management.io/managed-serviceaccount/pkg/generated/clientset/versioned/typed/authentication/v1beta1
# open-cluster-management.io/ocm v0.15.0
# open-cluster-management.io/ocm v0.15.2
## explicit; go 1.22.5
open-cluster-management.io/ocm/deploy/cluster-manager/chart
open-cluster-management.io/ocm/deploy/klusterlet/chart
Expand Down

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

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

Loading