зеркало из https://github.com/Azure/ARO-RP.git
Switch maoclient -> machineclient and maofake -> machinefake
This commit is contained in:
Родитель
51cceb0c9f
Коммит
e01b7da31a
|
@ -1,3 +1,4 @@
|
|||
//go:build aro
|
||||
// +build aro
|
||||
|
||||
package main
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
configclient "github.com/openshift/client-go/config/clientset/versioned"
|
||||
consoleclient "github.com/openshift/client-go/console/clientset/versioned"
|
||||
imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
securityclient "github.com/openshift/client-go/security/clientset/versioned"
|
||||
mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -92,7 +92,7 @@ func operator(ctx context.Context, log *logrus.Entry) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
maocli, err := maoclient.NewForConfig(restConfig)
|
||||
maocli, err := machineclient.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
configclient "github.com/openshift/client-go/config/clientset/versioned"
|
||||
imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
operatorclient "github.com/openshift/client-go/operator/clientset/versioned"
|
||||
samplesclient "github.com/openshift/client-go/samples/clientset/versioned"
|
||||
securityclient "github.com/openshift/client-go/security/clientset/versioned"
|
||||
|
@ -83,7 +83,7 @@ type manager struct {
|
|||
|
||||
kubernetescli kubernetes.Interface
|
||||
extensionscli extensionsclient.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
mcocli mcoclient.Interface
|
||||
operatorcli operatorclient.Interface
|
||||
configcli configclient.Interface
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"testing"
|
||||
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -149,7 +149,7 @@ func TestFixMCSUserData(t *testing.T) {
|
|||
userDataSecret(t, "openshift-machine-api", "master-user-data", "https://api-int.example.com:22623/config/master", ""),
|
||||
userDataSecret(t, "openshift-machine-api", "worker-user-data", "", "https://api-int.example.com:22623/config/worker"),
|
||||
),
|
||||
maocli: maofake.NewSimpleClientset(
|
||||
maocli: machinefake.NewSimpleClientset(
|
||||
testMachineSet(t, "openshift-machine-api", "worker", &machinev1beta1.AzureMachineProviderSpec{
|
||||
UserDataSecret: &corev1.SecretReference{
|
||||
Name: "worker-user-data",
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
configclient "github.com/openshift/client-go/config/clientset/versioned"
|
||||
imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
operatorclient "github.com/openshift/client-go/operator/clientset/versioned"
|
||||
samplesclient "github.com/openshift/client-go/samples/clientset/versioned"
|
||||
securityclient "github.com/openshift/client-go/security/clientset/versioned"
|
||||
|
@ -261,7 +261,7 @@ func (m *manager) initializeKubernetesClients(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
m.maocli, err = maoclient.NewForConfig(restConfig)
|
||||
m.maocli, err = machineclient.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
configv1 "github.com/openshift/api/config/v1"
|
||||
configclient "github.com/openshift/client-go/config/clientset/versioned"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
|
@ -35,7 +35,7 @@ type Monitor struct {
|
|||
restconfig *rest.Config
|
||||
cli kubernetes.Interface
|
||||
configcli configclient.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
mcocli mcoclient.Interface
|
||||
m metrics.Emitter
|
||||
arocli aroclient.Interface
|
||||
|
@ -72,7 +72,7 @@ func NewMonitor(ctx context.Context, log *logrus.Entry, restConfig *rest.Config,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
maocli, err := maoclient.NewForConfig(restConfig)
|
||||
maocli, err := machineclient.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
|
||||
"github.com/golang/mock/gomock"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -68,7 +68,7 @@ func TestEmitNodeConditions(t *testing.T) {
|
|||
},
|
||||
},
|
||||
})
|
||||
maoclient := maofake.NewSimpleClientset(
|
||||
machineclient := machinefake.NewSimpleClientset(
|
||||
&machinev1beta1.Machine{
|
||||
Spec: machinev1beta1.MachineSpec{
|
||||
ProviderSpec: machinev1beta1.ProviderSpec{
|
||||
|
@ -104,7 +104,7 @@ func TestEmitNodeConditions(t *testing.T) {
|
|||
|
||||
mon := &Monitor{
|
||||
cli: cli,
|
||||
maocli: maoclient,
|
||||
maocli: machineclient,
|
||||
m: m,
|
||||
}
|
||||
|
||||
|
@ -154,13 +154,13 @@ func TestGetSpotInstances(t *testing.T) {
|
|||
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
node corev1.Node
|
||||
expectedSpotInstance bool
|
||||
}{
|
||||
{
|
||||
name: "node is a spot instance",
|
||||
maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
Spec: machinev1beta1.MachineSpec{
|
||||
ProviderSpec: machinev1beta1.ProviderSpec{
|
||||
Value: &kruntime.RawExtension{
|
||||
|
@ -185,7 +185,7 @@ func TestGetSpotInstances(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "node is not a spot instance",
|
||||
maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
Spec: machinev1beta1.MachineSpec{
|
||||
ProviderSpec: machinev1beta1.ProviderSpec{
|
||||
Value: &kruntime.RawExtension{
|
||||
|
@ -210,7 +210,7 @@ func TestGetSpotInstances(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "node is missing annotation",
|
||||
maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
Spec: machinev1beta1.MachineSpec{
|
||||
ProviderSpec: machinev1beta1.ProviderSpec{
|
||||
Value: &kruntime.RawExtension{
|
||||
|
@ -233,7 +233,7 @@ func TestGetSpotInstances(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "malformed json in providerSpec",
|
||||
maocli: maofake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
maocli: machinefake.NewSimpleClientset(&machinev1beta1.Machine{
|
||||
Spec: machinev1beta1.MachineSpec{
|
||||
ProviderSpec: machinev1beta1.ProviderSpec{
|
||||
Value: &kruntime.RawExtension{
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -37,7 +37,7 @@ type Reconciler struct {
|
|||
arocli aroclient.Interface
|
||||
}
|
||||
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface, role string) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface, role string) *Reconciler {
|
||||
checkers := []Checker{NewInternetChecker(log, arocli, role)}
|
||||
|
||||
if role == operator.RoleMaster {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"context"
|
||||
|
||||
operatorv1 "github.com/openshift/api/operator/v1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -27,12 +27,12 @@ type ServicePrincipalChecker struct {
|
|||
|
||||
arocli aroclient.Interface
|
||||
kubernetescli kubernetes.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
|
||||
role string
|
||||
}
|
||||
|
||||
func NewServicePrincipalChecker(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface, role string) *ServicePrincipalChecker {
|
||||
func NewServicePrincipalChecker(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface, role string) *ServicePrincipalChecker {
|
||||
return &ServicePrincipalChecker{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
operatorv1 "github.com/openshift/api/operator/v1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
|
@ -31,13 +31,13 @@ type Reconciler struct {
|
|||
log *logrus.Entry
|
||||
|
||||
arocli aroclient.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
|
||||
isLocalDevelopmentMode bool
|
||||
role string
|
||||
}
|
||||
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface, isLocalDevelopmentMode bool, role string) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface, isLocalDevelopmentMode bool, role string) *Reconciler {
|
||||
return &Reconciler{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest/to"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
operatorv1 "github.com/openshift/api/operator/v1"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
func TestMachineReconciler(t *testing.T) {
|
||||
// Fake cluster with AZs
|
||||
newFakeMao1 := func(diskSize, imagePublisher, vmSize, masterVmSize string) *maofake.Clientset {
|
||||
newFakeMao1 := func(diskSize, imagePublisher, vmSize, masterVmSize string) *machinefake.Clientset {
|
||||
master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true)
|
||||
master1 := getValidMachine("foo-hx8z7-master-1", "", "", "", "", true)
|
||||
master2 := getValidMachine("foo-hx8z7-master-2", "", "", masterVmSize, "", true)
|
||||
|
@ -35,11 +35,11 @@ func TestMachineReconciler(t *testing.T) {
|
|||
workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1")
|
||||
workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2")
|
||||
|
||||
return maofake.NewSimpleClientset(worker0, worker1, worker2, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
return machinefake.NewSimpleClientset(worker0, worker1, worker2, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
}
|
||||
|
||||
// Fake cluster missing a master
|
||||
newFakeMao2 := func() *maofake.Clientset {
|
||||
newFakeMao2 := func() *machinefake.Clientset {
|
||||
master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true)
|
||||
master2 := getValidMachine("foo-hx8z7-master-2", "", "", "", "", true)
|
||||
worker0 := getValidMachine("foo-hx8z7-worker-0", "", "", "", "", false)
|
||||
|
@ -49,11 +49,11 @@ func TestMachineReconciler(t *testing.T) {
|
|||
workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1")
|
||||
workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2")
|
||||
|
||||
return maofake.NewSimpleClientset(worker0, worker1, worker2, master0, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
return machinefake.NewSimpleClientset(worker0, worker1, worker2, master0, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
}
|
||||
|
||||
// Fake cluster missing a worker
|
||||
newFakeMao3 := func() *maofake.Clientset {
|
||||
newFakeMao3 := func() *machinefake.Clientset {
|
||||
master0 := getValidMachine("foo-hx8z7-master-0", "", "", "", "", true)
|
||||
master1 := getValidMachine("foo-hx8z7-master-1", "", "", "", "", true)
|
||||
master2 := getValidMachine("foo-hx8z7-master-2", "", "", "", "", true)
|
||||
|
@ -63,7 +63,7 @@ func TestMachineReconciler(t *testing.T) {
|
|||
workerMachineSet1 := workerMachineSet("foo-hx8z7-machineset-1")
|
||||
workerMachineSet2 := workerMachineSet("foo-hx8z7-machineset-2")
|
||||
|
||||
return maofake.NewSimpleClientset(worker0, worker1, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
return machinefake.NewSimpleClientset(worker0, worker1, master0, master1, master2, workerMachineSet0, workerMachineSet1, workerMachineSet2)
|
||||
}
|
||||
|
||||
baseCluster := arov1alpha1.Cluster{
|
||||
|
@ -79,7 +79,7 @@ func TestMachineReconciler(t *testing.T) {
|
|||
tests := []struct {
|
||||
name string
|
||||
request ctrl.Request
|
||||
maocli *maofake.Clientset
|
||||
maocli *machinefake.Clientset
|
||||
arocli *arofake.Clientset
|
||||
wantConditions []operatorv1.OperatorCondition
|
||||
}{
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -33,11 +33,11 @@ type Reconciler struct {
|
|||
log *logrus.Entry
|
||||
|
||||
arocli aroclient.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
}
|
||||
|
||||
// MachineSet reconciler watches MachineSet objects for changes, evaluates total worker replica count, and reverts changes if needed.
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface) *Reconciler {
|
||||
return &Reconciler{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
"github.com/sirupsen/logrus"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -69,7 +69,7 @@ func TestReconciler(t *testing.T) {
|
|||
name string
|
||||
objectName string
|
||||
machinesets []kruntime.Object
|
||||
mocks func(maocli *maofake.Clientset)
|
||||
mocks func(maocli *machinefake.Clientset)
|
||||
wantReplicas int32
|
||||
featureFlag bool
|
||||
assertReplicas bool
|
||||
|
@ -149,7 +149,7 @@ func TestReconciler(t *testing.T) {
|
|||
name: "machineset-0 not found",
|
||||
objectName: "aro-fake-machineset-0",
|
||||
machinesets: fakeMachineSets(2, 0, 0),
|
||||
mocks: func(maocli *maofake.Clientset) {
|
||||
mocks: func(maocli *machinefake.Clientset) {
|
||||
maocli.PrependReactor("get", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) {
|
||||
return true, nil, &kerrors.StatusError{ErrStatus: metav1.Status{
|
||||
Message: "machineset-0 not found",
|
||||
|
@ -165,7 +165,7 @@ func TestReconciler(t *testing.T) {
|
|||
name: "get machinesets failed with error",
|
||||
objectName: "aro-fake-machineset-0",
|
||||
machinesets: fakeMachineSets(1, 0, 0),
|
||||
mocks: func(maocli *maofake.Clientset) {
|
||||
mocks: func(maocli *machinefake.Clientset) {
|
||||
maocli.PrependReactor("get", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) {
|
||||
return true, nil, errors.New("fake error")
|
||||
})
|
||||
|
@ -178,7 +178,7 @@ func TestReconciler(t *testing.T) {
|
|||
name: "machineset-0 can't be updated",
|
||||
objectName: "aro-fake-machineset-0",
|
||||
machinesets: fakeMachineSets(1, 0, 0),
|
||||
mocks: func(maocli *maofake.Clientset) {
|
||||
mocks: func(maocli *machinefake.Clientset) {
|
||||
maocli.PrependReactor("update", "machinesets", func(action ktesting.Action) (handled bool, ret kruntime.Object, err error) {
|
||||
return true, nil, errors.New("fake error from update")
|
||||
})
|
||||
|
@ -201,7 +201,7 @@ func TestReconciler(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
maocli := maofake.NewSimpleClientset(tt.machinesets...)
|
||||
maocli := machinefake.NewSimpleClientset(tt.machinesets...)
|
||||
|
||||
if tt.mocks != nil {
|
||||
tt.mocks(maocli)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -41,10 +41,10 @@ type Reconciler struct {
|
|||
|
||||
arocli aroclient.Interface
|
||||
kubernetescli kubernetes.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
}
|
||||
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface) *Reconciler {
|
||||
return &Reconciler{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
imageregistryclient "github.com/openshift/client-go/imageregistry/clientset/versioned"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -42,7 +42,7 @@ type Reconciler struct {
|
|||
|
||||
arocli aroclient.Interface
|
||||
kubernetescli kubernetes.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
imageregistrycli imageregistryclient.Interface
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ type reconcileManager struct {
|
|||
}
|
||||
|
||||
// NewReconciler creates a new Reconciler
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli maoclient.Interface, kubernetescli kubernetes.Interface, imageregistrycli imageregistryclient.Interface) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, maocli machineclient.Interface, kubernetescli kubernetes.Interface, imageregistrycli imageregistryclient.Interface) *Reconciler {
|
||||
return &Reconciler{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -44,7 +44,7 @@ type Reconciler struct {
|
|||
|
||||
arocli aroclient.Interface
|
||||
kubernetescli kubernetes.Interface
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
}
|
||||
|
||||
// reconcileManager is an instance of the manager instantiated per request
|
||||
|
@ -59,7 +59,7 @@ type reconcileManager struct {
|
|||
}
|
||||
|
||||
// NewReconciler creates a new Reconciler
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli maoclient.Interface) *Reconciler {
|
||||
func NewReconciler(log *logrus.Entry, arocli aroclient.Interface, kubernetescli kubernetes.Interface, maocli machineclient.Interface) *Reconciler {
|
||||
return &Reconciler{
|
||||
log: log,
|
||||
arocli: arocli,
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
|
@ -25,7 +25,7 @@ const (
|
|||
)
|
||||
|
||||
func newWorkerProfilesEnricherTask(log *logrus.Entry, restConfig *rest.Config, oc *api.OpenShiftCluster) (enricherTask, error) {
|
||||
maocli, err := maoclient.NewForConfig(restConfig)
|
||||
maocli, err := machineclient.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func newWorkerProfilesEnricherTask(log *logrus.Entry, restConfig *rest.Config, o
|
|||
|
||||
type workerProfilesEnricherTask struct {
|
||||
log *logrus.Entry
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
oc *api.OpenShiftCluster
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -40,15 +40,15 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
client func() maoclient.Interface
|
||||
client func() machineclient.Interface
|
||||
modifyOc func(*api.OpenShiftCluster)
|
||||
wantOc *api.OpenShiftCluster
|
||||
wantErr string
|
||||
}{
|
||||
{
|
||||
name: "machine set objects exists - valid provider spec JSON",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset(
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset(
|
||||
&machinev1beta1.MachineSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "fake-worker-profile-1",
|
||||
|
@ -136,8 +136,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "machine set objects exists - invalid provider spec JSON",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset(
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset(
|
||||
&machinev1beta1.MachineSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "fake-worker-profile-1",
|
||||
|
@ -166,8 +166,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "machine set objects exists - provider spec is missing",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset(
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset(
|
||||
&machinev1beta1.MachineSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "fake-worker-profile-1",
|
||||
|
@ -185,8 +185,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "machine set objects exists - provider spec is missing raw value",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset(
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset(
|
||||
&machinev1beta1.MachineSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "fake-worker-profile-1",
|
||||
|
@ -213,8 +213,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "machine set objects do not exist",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset()
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset()
|
||||
},
|
||||
wantOc: &api.OpenShiftCluster{
|
||||
ID: clusterID,
|
||||
|
@ -225,8 +225,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "machine set list request failed",
|
||||
client: func() maoclient.Interface {
|
||||
client := maofake.NewSimpleClientset()
|
||||
client: func() machineclient.Interface {
|
||||
client := machinefake.NewSimpleClientset()
|
||||
client.PrependReactor("list", "machinesets", func(action ktesting.Action) (bool, kruntime.Object, error) {
|
||||
return true, nil, errors.New("fake list error")
|
||||
})
|
||||
|
@ -239,8 +239,8 @@ func TestWorkerProfilesEnricherTask(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "invalid cluster object",
|
||||
client: func() maoclient.Interface {
|
||||
return maofake.NewSimpleClientset()
|
||||
client: func() machineclient.Interface {
|
||||
return machinefake.NewSimpleClientset()
|
||||
},
|
||||
modifyOc: func(oc *api.OpenShiftCluster) {
|
||||
oc.ID = "invalid"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
azureproviderv1beta1 "sigs.k8s.io/cluster-api-provider-azure/pkg/apis/azureprovider/v1beta1"
|
||||
|
@ -21,12 +21,12 @@ type KubeManager interface {
|
|||
}
|
||||
|
||||
type kubeManager struct {
|
||||
maocli maoclient.Interface
|
||||
maocli machineclient.Interface
|
||||
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
func NewKubeManager(maocli maoclient.Interface, subscriptionID string) KubeManager {
|
||||
func NewKubeManager(maocli machineclient.Interface, subscriptionID string) KubeManager {
|
||||
return &kubeManager{
|
||||
maocli: maocli,
|
||||
subscriptionID: subscriptionID,
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
|
||||
maofake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
machinefake "github.com/openshift/client-go/machine/clientset/versioned/fake"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
@ -93,7 +93,7 @@ func TestListFromCluster(t *testing.T) {
|
|||
}
|
||||
|
||||
m := kubeManager{
|
||||
maocli: maofake.NewSimpleClientset(&workerMachine, &masterMachine),
|
||||
maocli: machinefake.NewSimpleClientset(&workerMachine, &masterMachine),
|
||||
subscriptionID: subscriptionId,
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest/azure/auth"
|
||||
maoclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
|
||||
projectclient "github.com/openshift/client-go/project/clientset/versioned"
|
||||
mcoclient "github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -53,7 +53,7 @@ type clientSet struct {
|
|||
|
||||
RestConfig *rest.Config
|
||||
Kubernetes kubernetes.Interface
|
||||
MachineAPI maoclient.Interface
|
||||
MachineAPI machineclient.Interface
|
||||
MachineConfig mcoclient.Interface
|
||||
AROClusters aroclient.Interface
|
||||
Project projectclient.Interface
|
||||
|
@ -108,7 +108,7 @@ func newClientSet(ctx context.Context) (*clientSet, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
machineapicli, err := maoclient.NewForConfig(restconfig)
|
||||
machineapicli, err := machineclient.NewForConfig(restconfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче