Skip to content

Commit e2adc22

Browse files
weng271190436Wei Weng
andauthored
chore: add enable v1alpha1 flag back for backward compatibility with CCP (#344)
* add enable v1alpha1 flag back for backward compatibility * return error if v1alpha1 is enabled Signed-off-by: Wei Weng <[email protected]> --------- Signed-off-by: Wei Weng <[email protected]> Co-authored-by: Wei Weng <[email protected]>
1 parent f1a1f82 commit e2adc22

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

cmd/mcs-controller-manager/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package main
88

99
import (
1010
"context"
11+
"errors"
1112
"flag"
1213
"os"
1314
"os/signal"
@@ -60,7 +61,9 @@ var (
6061
tlsClientInsecure = flag.Bool("tls-insecure", false, "Enable TLSClientConfig.Insecure property. Enabling this will make the connection inSecure (should be 'true' for testing purpose only.)")
6162
fleetSystemNamespace = flag.String("fleet-system-namespace", "fleet-system", "The reserved system namespace used by fleet.")
6263

63-
isV1Beta1APIEnabled = flag.Bool("enable-v1beta1-apis", true, "If set, the agents will watch for the v1beta1 APIs.")
64+
// TODO(weiweng): remove fleet v1alpha1 flag after references was removed elsewhere.
65+
isV1Alpha1APIEnabled = flag.Bool("enable-v1alpha1-apis", false, "If set, the agents will watch for the v1alpha1 APIs. This flag is deprecated and will be removed in future releases.")
66+
isV1Beta1APIEnabled = flag.Bool("enable-v1beta1-apis", true, "If set, the agents will watch for the v1beta1 APIs.")
6467

6568
enableNetworkingFeatures = flag.Bool("enable-networking-features", true, "If set, the networking features will be enabled. When disabled, only heartbeat functionality is preserved.")
6669
)
@@ -247,6 +250,11 @@ func setupControllersWithManager(_ context.Context, hubMgr, memberMgr manager.Ma
247250
memberClient := memberMgr.GetClient()
248251
hubClient := hubMgr.GetClient()
249252

253+
if *isV1Alpha1APIEnabled {
254+
klog.Error("Fleet v1alpha1 flag is set to true, but this flag is deprecated and will be removed in future releases")
255+
return errors.New("v1alpha1 APIs are deprecated and no longer supported, please use v1beta1 APIs instead")
256+
}
257+
250258
if *isV1Beta1APIEnabled {
251259
klog.V(1).InfoS("Create internalmembercluster (v1beta1 API) reconciler")
252260
if err := (&imcv1beta1.Reconciler{

cmd/member-net-controller-manager/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package main
99

1010
import (
1111
"context"
12+
"errors"
1213
"flag"
1314
"fmt"
1415
"os"
@@ -70,7 +71,9 @@ var (
7071
tlsClientInsecure = flag.Bool("tls-insecure", false, "Enable TLSClientConfig.Insecure property. Enabling this will make the connection inSecure (should be 'true' for testing purpose only.)")
7172
fleetSystemNamespace = flag.String("fleet-system-namespace", "fleet-system", "The reserved system namespace used by fleet.")
7273

73-
isV1Beta1APIEnabled = flag.Bool("enable-v1beta1-apis", true, "If set, the agents will watch for the v1beta1 APIs.")
74+
// TODO(weiweng): remove fleet v1alpha1 flag after references was removed elsewhere.
75+
isV1Alpha1APIEnabled = flag.Bool("enable-v1alpha1-apis", false, "If set, the agents will watch for the v1alpha1 APIs. This flag is deprecated and will be removed in future releases.")
76+
isV1Beta1APIEnabled = flag.Bool("enable-v1beta1-apis", true, "If set, the agents will watch for the v1beta1 APIs.")
7477

7578
enableTrafficManagerFeature = flag.Bool("enable-traffic-manager-feature", true, "If set, the traffic manager feature will be enabled.")
7679

@@ -274,6 +277,11 @@ func setupControllersWithManager(ctx context.Context, hubMgr, memberMgr manager.
274277
memberClient := memberMgr.GetClient()
275278
hubClient := hubMgr.GetClient()
276279

280+
if *isV1Alpha1APIEnabled {
281+
klog.Error("Fleet v1alpha1 flag is set to true, but this flag is deprecated and will be removed in future releases")
282+
return errors.New("v1alpha1 APIs are deprecated and no longer supported, please use v1beta1 APIs instead")
283+
}
284+
277285
if *isV1Beta1APIEnabled {
278286
klog.V(1).InfoS("Create internalmembercluster (v1beta1 API) reconciler")
279287
if err := (&imcv1beta1.Reconciler{

0 commit comments

Comments
 (0)