Skip to content

Commit cf77643

Browse files
committed
Remove openshift and k8s pins
1 parent 36e0b96 commit cf77643

File tree

4,717 files changed

+427071
-335281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,717 files changed

+427071
-335281
lines changed

cmd/aro/operator.go

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ func operator(ctx context.Context, log *logrus.Entry) error {
7575

7676
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
7777
HealthProbeBindAddress: ":8080",
78-
MetricsBindAddress: "0", // disabled
79-
Port: 8443,
8078
})
8179
if err != nil {
8280
return err

go.mod

+70-92
Large diffs are not rendered by default.

go.sum

+169-167
Large diffs are not rendered by default.

pkg/cluster/delete.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ func (m *manager) deleteGatewayAndWait(ctx context.Context) error {
330330
}
331331

332332
m.log.Info("waiting for gateway record deletion")
333-
return wait.PollImmediateUntil(15*time.Second, func() (bool, error) {
333+
return wait.PollUntilContextCancel(timeoutCtx, 15*time.Second, true, func(ctx context.Context) (bool, error) {
334334
_, err := m.dbGateway.Get(ctx, m.doc.OpenShiftCluster.Properties.NetworkProfile.GatewayPrivateLinkID)
335-
if err != nil && cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) /* already gone */ {
336-
return true, nil
335+
if err != nil && cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) {
336+
return true, err
337337
}
338338
return false, nil
339-
}, timeoutCtx.Done())
339+
})
340340
}
341341

342342
func (m *manager) deleteGateway(ctx context.Context) error {

pkg/cluster/deploybaseresources.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func (m *manager) _attachNSGs(ctx context.Context, timeout time.Duration, pollIn
357357
// NSG since the inner loop is tolerant of that, and since we are attaching
358358
// the same NSG the only allowed failure case is when the NSG cannot be
359359
// attached to begin with, so it shouldn't happen in practice.
360-
_ = wait.PollImmediateUntil(pollInterval, func() (bool, error) {
360+
_ = wait.PollUntilContextCancel(timeoutCtx, pollInterval, true, func(ctx context.Context) (bool, error) {
361361
var c bool
362362
c, innerErr = func() (bool, error) {
363363
for _, subnetID := range []string{
@@ -414,9 +414,8 @@ func (m *manager) _attachNSGs(ctx context.Context, timeout time.Duration, pollIn
414414
}
415415
return true, nil
416416
}()
417-
418417
return c, innerErr
419-
}, timeoutCtx.Done())
418+
})
420419

421420
return innerErr
422421
}

pkg/cluster/install.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
kruntime "k8s.io/apimachinery/pkg/runtime"
1616
"k8s.io/client-go/dynamic"
1717
"k8s.io/client-go/kubernetes"
18+
"k8s.io/client-go/rest"
1819
"sigs.k8s.io/controller-runtime/pkg/client"
1920
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
2021

@@ -632,7 +633,12 @@ func (m *manager) initializeKubernetesClients(ctx context.Context) error {
632633
return err
633634
}
634635

635-
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, apiutil.WithLazyDiscovery)
636+
httpClient, err := rest.HTTPClientFor(restConfig)
637+
if err != nil {
638+
return err
639+
}
640+
641+
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, httpClient)
636642
if err != nil {
637643
return err
638644
}

pkg/deploy/predeploy.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,9 @@ func (d *deployer) restartOldScaleset(ctx context.Context, vmssName string, lbHe
553553
}
554554

555555
func (d *deployer) waitForReadiness(ctx context.Context, vmssName string, vmInstanceID string) error {
556-
return wait.PollImmediateUntil(10*time.Second, func() (bool, error) {
556+
return wait.PollUntilContextCancel(ctx, 10*time.Second, true, func(ctx context.Context) (bool, error) {
557557
return d.isVMInstanceHealthy(ctx, d.config.RPResourceGroupName, vmssName, vmInstanceID), nil
558-
}, ctx.Done())
558+
})
559559
}
560560

561561
func (d *deployer) isVMInstanceHealthy(ctx context.Context, resourceGroupName string, vmssName string, vmInstanceID string) bool {

pkg/deploy/upgrade_gateway.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ func (d *deployer) gatewayWaitForReadiness(ctx context.Context, vmssName string)
3939
}
4040

4141
d.log.Printf("waiting for %s instances to be healthy", vmssName)
42-
return wait.PollImmediateUntil(10*time.Second, func() (bool, error) {
42+
return wait.PollUntilContextCancel(ctx, 10*time.Second, true, func(ctx context.Context) (bool, error) {
4343
for _, vm := range scalesetVMs {
4444
if !d.isVMInstanceHealthy(ctx, d.config.GatewayResourceGroupName, vmssName, *vm.InstanceID) {
4545
return false, nil
4646
}
4747
}
4848

4949
return true, nil
50-
}, ctx.Done())
50+
})
5151
}
5252

5353
func (d *deployer) gatewayRemoveOldScalesets(ctx context.Context) error {

pkg/deploy/upgrade_rp.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ func (d *deployer) rpWaitForReadiness(ctx context.Context, vmssName string) erro
3939
}
4040

4141
d.log.Printf("waiting for %s instances to be healthy", vmssName)
42-
return wait.PollImmediateUntil(10*time.Second, func() (bool, error) {
42+
return wait.PollUntilContextCancel(ctx, 10*time.Second, true, func(ctx context.Context) (bool, error) {
4343
for _, vm := range scalesetVMs {
4444
if !d.isVMInstanceHealthy(ctx, d.config.RPResourceGroupName, vmssName, *vm.InstanceID) {
4545
return false, nil
4646
}
4747
}
4848

4949
return true, nil
50-
}, ctx.Done())
50+
})
5151
}
5252

5353
func (d *deployer) rpRemoveOldScalesets(ctx context.Context) error {

pkg/frontend/admin_openshiftcluster_etcdcertificaterenew_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ func TestAdminEtcdCertificateRenew(t *testing.T) {
299299
},
300300
},
301301
},
302-
LatestAvailableRevision: 1,
303302
NodeStatuses: []operatorv1.NodeStatus{
304303
{
305304
NodeName: "master-0",
@@ -320,7 +319,6 @@ func TestAdminEtcdCertificateRenew(t *testing.T) {
320319
},
321320
},
322321
},
323-
LatestAvailableRevision: 2,
324322
NodeStatuses: []operatorv1.NodeStatus{
325323
{
326324
NodeName: "master-0",
@@ -450,7 +448,6 @@ func TestAdminEtcdCertificateRenew(t *testing.T) {
450448
},
451449
},
452450
},
453-
LatestAvailableRevision: 1,
454451
NodeStatuses: []operatorv1.NodeStatus{
455452
{
456453
NodeName: "master-0",
@@ -471,7 +468,6 @@ func TestAdminEtcdCertificateRenew(t *testing.T) {
471468
},
472469
},
473470
},
474-
LatestAvailableRevision: 2,
475471
NodeStatuses: []operatorv1.NodeStatus{
476472
{
477473
NodeName: "master-0",
@@ -646,7 +642,6 @@ func TestAdminEtcdCertificateRecovery(t *testing.T) {
646642
},
647643
},
648644
},
649-
LatestAvailableRevision: 1,
650645
NodeStatuses: []operatorv1.NodeStatus{
651646
{
652647
NodeName: "master-0",
@@ -667,7 +662,6 @@ func TestAdminEtcdCertificateRecovery(t *testing.T) {
667662
},
668663
},
669664
},
670-
LatestAvailableRevision: 2,
671665
NodeStatuses: []operatorv1.NodeStatus{
672666
{
673667
NodeName: "master-0",
@@ -688,7 +682,6 @@ func TestAdminEtcdCertificateRecovery(t *testing.T) {
688682
},
689683
},
690684
},
691-
LatestAvailableRevision: 3,
692685
NodeStatuses: []operatorv1.NodeStatus{
693686
{
694687
NodeName: "master-0",

pkg/frontend/adminactions/kubeactions.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"k8s.io/apimachinery/pkg/watch"
2020
"k8s.io/client-go/dynamic"
2121
"k8s.io/client-go/kubernetes"
22+
"k8s.io/client-go/rest"
2223
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
2324

2425
"github.com/Azure/ARO-RP/pkg/api"
@@ -59,7 +60,12 @@ func NewKubeActions(log *logrus.Entry, env env.Interface, oc *api.OpenShiftClust
5960
return nil, err
6061
}
6162

62-
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, apiutil.WithLazyDiscovery)
63+
httpClient, err := rest.HTTPClientFor(restConfig)
64+
if err != nil {
65+
return nil, err
66+
}
67+
68+
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, httpClient)
6369
if err != nil {
6470
return nil, err
6571
}

pkg/mimo/actuator/task.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/Azure/go-autorest/autorest"
1111
"github.com/sirupsen/logrus"
1212

13+
"k8s.io/client-go/rest"
1314
"sigs.k8s.io/controller-runtime/pkg/client"
1415
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
1516

@@ -89,7 +90,12 @@ func (t *th) ClientHelper() (clienthelper.Interface, error) {
8990
return nil, err
9091
}
9192

92-
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, apiutil.WithLazyDiscovery)
93+
httpClient, err := rest.HTTPClientFor(restConfig)
94+
if err != nil {
95+
return nil, err
96+
}
97+
98+
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, httpClient)
9399
if err != nil {
94100
return nil, err
95101
}

pkg/monitor/cluster/cluster.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,13 @@ func NewMonitor(log *logrus.Entry, restConfig *rest.Config, oc *api.OpenShiftClu
115115
return nil, err
116116
}
117117

118+
httpClient, err := rest.HTTPClientFor(restConfig)
119+
if err != nil {
120+
return nil, err
121+
}
122+
118123
// lazy discovery will not attempt to reach out to the apiserver immediately
119-
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, apiutil.WithLazyDiscovery)
124+
mapper, err := apiutil.NewDynamicRESTMapper(restConfig, httpClient)
120125
if err != nil {
121126
return nil, err
122127
}
@@ -163,8 +168,13 @@ func getHiveClientSet(hiveRestConfig *rest.Config) (client.Client, error) {
163168
return nil, nil
164169
}
165170

171+
httpClient, err := rest.HTTPClientFor(hiveRestConfig)
172+
if err != nil {
173+
return nil, err
174+
}
175+
166176
// lazy discovery will not attempt to reach out to the apiserver immediately
167-
mapper, err := apiutil.NewDynamicRESTMapper(hiveRestConfig, apiutil.WithLazyDiscovery)
177+
mapper, err := apiutil.NewDynamicRESTMapper(hiveRestConfig, httpClient)
168178
if err != nil {
169179
return nil, err
170180
}

pkg/operator/controllers/banner/banner_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"sigs.k8s.io/controller-runtime/pkg/handler"
1616
"sigs.k8s.io/controller-runtime/pkg/predicate"
1717
"sigs.k8s.io/controller-runtime/pkg/reconcile"
18-
"sigs.k8s.io/controller-runtime/pkg/source"
1918

2019
consolev1 "github.com/openshift/api/console/v1"
2120

@@ -69,7 +68,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
6968
return ctrl.NewControllerManagedBy(mgr).
7069
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
7170
// watching ConsoleNotifications in case a user edits it
72-
Watches(&source.Kind{Type: &consolev1.ConsoleNotification{}}, &handler.EnqueueRequestForObject{}, builder.WithPredicates(aroBannerPredicate)).
71+
Watches(&consolev1.ConsoleNotification{}, &handler.EnqueueRequestForObject{}, builder.WithPredicates(aroBannerPredicate)).
7372
Named(ControllerName).
7473
Complete(r)
7574
}

pkg/operator/controllers/checkers/clusterdnschecker/controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"sigs.k8s.io/controller-runtime/pkg/handler"
1717
"sigs.k8s.io/controller-runtime/pkg/predicate"
1818
"sigs.k8s.io/controller-runtime/pkg/reconcile"
19-
"sigs.k8s.io/controller-runtime/pkg/source"
2019

2120
operatorv1 "github.com/openshift/api/operator/v1"
2221

@@ -127,7 +126,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
127126
builder := ctrl.NewControllerManagedBy(mgr).
128127
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
129128
Watches(
130-
&source.Kind{Type: &operatorv1.DNS{}},
129+
&operatorv1.DNS{},
131130
&handler.EnqueueRequestForObject{},
132131
builder.WithPredicates(defaultClusterDNSPredicate),
133132
)

pkg/operator/controllers/checkers/ingresscertificatechecker/controller.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/handler"
1818
"sigs.k8s.io/controller-runtime/pkg/predicate"
1919
"sigs.k8s.io/controller-runtime/pkg/reconcile"
20-
"sigs.k8s.io/controller-runtime/pkg/source"
2120

2221
configv1 "github.com/openshift/api/config/v1"
2322
operatorv1 "github.com/openshift/api/operator/v1"
@@ -128,12 +127,12 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
128127
builder := ctrl.NewControllerManagedBy(mgr).
129128
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
130129
Watches(
131-
&source.Kind{Type: &operatorv1.IngressController{}},
130+
&operatorv1.IngressController{},
132131
&handler.EnqueueRequestForObject{},
133132
builder.WithPredicates(defaultIngressControllerPredicate),
134133
).
135134
Watches(
136-
&source.Kind{Type: &configv1.ClusterVersion{}},
135+
&configv1.ClusterVersion{},
137136
&handler.EnqueueRequestForObject{},
138137
builder.WithPredicates(predicates.ClusterVersion),
139138
)

pkg/operator/controllers/checkers/serviceprincipalchecker/controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/handler"
1818
"sigs.k8s.io/controller-runtime/pkg/predicate"
1919
"sigs.k8s.io/controller-runtime/pkg/reconcile"
20-
"sigs.k8s.io/controller-runtime/pkg/source"
2120

2221
operatorv1 "github.com/openshift/api/operator/v1"
2322

@@ -124,7 +123,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
124123
builder := ctrl.NewControllerManagedBy(mgr).
125124
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
126125
Watches(
127-
&source.Kind{Type: &corev1.Secret{}},
126+
&corev1.Secret{},
128127
&handler.EnqueueRequestForObject{},
129128
builder.WithPredicates(clusterSPPredicate),
130129
)

pkg/operator/controllers/cloudproviderconfig/cloudproviderconfig_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"sigs.k8s.io/controller-runtime/pkg/handler"
2020
"sigs.k8s.io/controller-runtime/pkg/predicate"
2121
"sigs.k8s.io/controller-runtime/pkg/reconcile"
22-
"sigs.k8s.io/controller-runtime/pkg/source"
2322

2423
"github.com/Azure/ARO-RP/pkg/operator"
2524
arov1alpha1 "github.com/Azure/ARO-RP/pkg/operator/apis/aro.openshift.io/v1alpha1"
@@ -173,7 +172,7 @@ func (r *CloudProviderConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
173172
return ctrl.NewControllerManagedBy(mgr).
174173
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
175174
Watches(
176-
&source.Kind{Type: &corev1.ConfigMap{}},
175+
&corev1.ConfigMap{},
177176
&handler.EnqueueRequestForObject{},
178177
builder.WithPredicates(cloudProviderConfigPredicate),
179178
).

pkg/operator/controllers/cpms/cpms_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"sigs.k8s.io/controller-runtime/pkg/handler"
1414
"sigs.k8s.io/controller-runtime/pkg/predicate"
1515
"sigs.k8s.io/controller-runtime/pkg/reconcile"
16-
"sigs.k8s.io/controller-runtime/pkg/source"
1716

1817
machinev1 "github.com/openshift/api/machine/v1"
1918

@@ -93,7 +92,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
9392
return ctrl.NewControllerManagedBy(mgr).
9493
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(aroClusterPredicate, predicate.GenerationChangedPredicate{}))).
9594
Watches(
96-
&source.Kind{Type: &machinev1.ControlPlaneMachineSet{}},
95+
&machinev1.ControlPlaneMachineSet{},
9796
&handler.EnqueueRequestForObject{},
9897
builder.WithPredicates(predicate.GenerationChangedPredicate{}), // only watch for spec changes
9998
).

pkg/operator/controllers/dnsmasq/cluster_controller.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/handler"
1818
"sigs.k8s.io/controller-runtime/pkg/predicate"
1919
"sigs.k8s.io/controller-runtime/pkg/reconcile"
20-
"sigs.k8s.io/controller-runtime/pkg/source"
2120

2221
configv1 "github.com/openshift/api/config/v1"
2322
mcv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
@@ -105,7 +104,7 @@ func (r *ClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
105104
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
106105
Named(ClusterControllerName).
107106
Watches(
108-
&source.Kind{Type: &configv1.ClusterVersion{}},
107+
&configv1.ClusterVersion{},
109108
&handler.EnqueueRequestForObject{},
110109
builder.WithPredicates(clusterVersionPredicate),
111110
).

pkg/operator/controllers/etchosts/cluster_controller.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/handler"
1818
"sigs.k8s.io/controller-runtime/pkg/predicate"
1919
"sigs.k8s.io/controller-runtime/pkg/reconcile"
20-
"sigs.k8s.io/controller-runtime/pkg/source"
2120

2221
mcv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
2322

@@ -199,10 +198,10 @@ func (r *EtcHostsClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
199198

200199
etcHostsBuilder := ctrl.NewControllerManagedBy(mgr).
201200
For(&arov1alpha1.Cluster{}, builder.WithPredicates(predicate.And(predicates.AROCluster, predicate.GenerationChangedPredicate{}))).
202-
Watches(&source.Kind{Type: &mcv1.MachineConfigPool{}},
201+
Watches(&mcv1.MachineConfigPool{},
203202
&handler.EnqueueRequestForObject{},
204203
builder.WithPredicates(predicate.GenerationChangedPredicate{})).
205-
Watches(&source.Kind{Type: &mcv1.MachineConfig{}},
204+
Watches(&mcv1.MachineConfig{},
206205
&handler.EnqueueRequestForObject{},
207206
builder.WithPredicates(predicate.GenerationChangedPredicate{}))
208207

0 commit comments

Comments
 (0)