Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/machine-api-operator/client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/golang/glog"
osclientset "github.com/openshift/client-go/config/clientset/versioned"
mapiclientset "github.com/openshift/machine-api-operator/pkg/generated/clientset/versioned"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand All @@ -20,6 +21,11 @@ func (cb *ClientBuilder) KubeClientOrDie(name string) kubernetes.Interface {
return kubernetes.NewForConfigOrDie(rest.AddUserAgent(cb.config, name))
}

// NewForConfigOrDie returns the kubernetes client interface for dynamic objects.
func (cb *ClientBuilder) dynamicClientOrDie(name string) dynamic.Interface {
return dynamic.NewForConfigOrDie(rest.AddUserAgent(cb.config, name))
}

// OpenshiftClientOrDie returns the kubernetes client interface for Openshift objects.
func (cb *ClientBuilder) OpenshiftClientOrDie(name string) osclientset.Interface {
return osclientset.NewForConfigOrDie(rest.AddUserAgent(cb.config, name))
Expand Down
1 change: 1 addition & 0 deletions cmd/machine-api-operator/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func startControllers(ctx *ControllerContext) {
ctx.ConfigInformerFactory.Config().V1().FeatureGates(),
ctx.ClientBuilder.KubeClientOrDie(componentName),
ctx.ClientBuilder.OpenshiftClientOrDie(componentName),
ctx.ClientBuilder.dynamicClientOrDie(componentName),
recorder,
).Run(1, ctx.Stop)
}
Expand Down
8 changes: 8 additions & 0 deletions install/0000_30_machine-api-operator_09_rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ rules:
- watch
- list
- patch

- apiGroups:
- metal3.io
resources:
- provisionings
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
4 changes: 4 additions & 0 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/dynamic"
appsinformersv1 "k8s.io/client-go/informers/apps/v1"
"k8s.io/client-go/kubernetes"
appslisterv1 "k8s.io/client-go/listers/apps/v1"
Expand Down Expand Up @@ -41,6 +42,7 @@ type Operator struct {

kubeClient kubernetes.Interface
osClient osclientset.Interface
dynamicClient dynamic.Interface
eventRecorder record.EventRecorder

syncHandler func(ic string) error
Expand Down Expand Up @@ -68,6 +70,7 @@ func New(

kubeClient kubernetes.Interface,
osClient osclientset.Interface,
dynamicClient dynamic.Interface,

recorder record.EventRecorder,
) *Operator {
Expand All @@ -84,6 +87,7 @@ func New(
imagesFile: imagesFile,
kubeClient: kubeClient,
osClient: osClient,
dynamicClient: dynamicClient,
eventRecorder: recorder,
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineapioperator"),
operandVersions: operandVersions,
Expand Down