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