Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating go+libs version #279

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- "1.17.x"
- "1.21.x"

services:
- docker
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KUBEBUILDER_VERSION = 2.3.1
export KUBEBUILDER_ASSETS = ${PWD}/cache/kubebuilder_${KUBEBUILDER_VERSION}/bin
CONTROLLER_GEN_VERSION = 0.8.0
CONTROLLER_GEN_VERSION = 0.14.0
CONTROLLER_GEN=${PWD}/cache/controller-gen_${CONTROLLER_GEN_VERSION}/controller-gen
LINT_VERSION = 1.28.3
GOSEC_VERSION="v2.9.2"
Expand Down Expand Up @@ -177,7 +177,7 @@ cache/controller-gen_${CONTROLLER_GEN_VERSION}: cache
trap "rm -rf $$CONTROLLER_GEN_TMP_DIR" EXIT ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
GOBIN=${PWD}/cache/controller-gen_${CONTROLLER_GEN_VERSION} go get sigs.k8s.io/controller-tools/cmd/controller-gen@v${CONTROLLER_GEN_VERSION} ;\
GOBIN=${PWD}/cache/controller-gen_${CONTROLLER_GEN_VERSION} go install sigs.k8s.io/controller-tools/cmd/controller-gen@v${CONTROLLER_GEN_VERSION} ;\
fi

out:
Expand Down
13 changes: 8 additions & 5 deletions controllers/binding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const (
type BindingReconciler struct {
client.Client
Log logr.Logger
Scheme *runtime.Scheme
scheme *runtime.Scheme

CreateResourceServiceKey resource.KeyCreator
CreateCFServiceKey cfservice.KeyCreator
Expand All @@ -91,6 +91,10 @@ func (r *BindingReconciler) SetupWithManager(mgr ctrl.Manager, options controlle
Complete(r)
}

func (r *BindingReconciler) Scheme() *runtime.Scheme {
return r.scheme
}

// +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=ibmcloud.ibm.com,resources=bindings/finalizers,verbs=get;list;watch;create;update;patch;delete
Expand All @@ -102,8 +106,7 @@ func (r *BindingReconciler) SetupWithManager(mgr ctrl.Manager, options controlle
// Reconcile reads the state of the cluster for a Binding object and makes changes based on the state read
// and what is in the Binding.Spec.
// Automatically generates RBAC rules to allow the Controller to read and write Deployments.
func (r *BindingReconciler) Reconcile(request ctrl.Request) (ctrl.Result, error) {
ctx := context.Background()
func (r *BindingReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {
logt := r.Log.WithValues("binding", request.NamespacedName)

// Fetch the Binding instance
Expand Down Expand Up @@ -158,7 +161,7 @@ func (r *BindingReconciler) Reconcile(request ctrl.Request) (ctrl.Result, error)

// Set an owner reference if service and binding are in the same namespace
if serviceInstance.Namespace == instance.Namespace {
if err := r.SetOwnerReference(serviceInstance, instance, r.Scheme); err != nil {
if err := r.SetOwnerReference(serviceInstance, instance, r.Scheme()); err != nil {
logt.Info("Binding could not update owner reference", instance.Name, err.Error())
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -500,7 +503,7 @@ func (r *BindingReconciler) createSecret(instance *ibmcloudv1.Binding, keyConten
},
Data: datamap,
}
if err := r.SetControllerReference(instance, secret, r.Scheme); err != nil {
if err := r.SetControllerReference(instance, secret, r.Scheme()); err != nil {
return err
}
if err := r.Create(context.Background(), secret); err != nil {
Expand Down
Loading