Skip to content

Commit

Permalink
fix: forward context in toolchain-common pkg/client (#502)
Browse files Browse the repository at this point in the history
* fix: forward context in toolchain-common pkg/client

Signed-off-by: Francesco Ilario <filario@redhat.com>

* go.mod add replace to filariow/toolchain-common fork

Signed-off-by: Francesco Ilario <filario@redhat.com>

* Remove replace rule from go.mod

Signed-off-by: Francesco Ilario <filario@redhat.com>

* Remove context.TODO

Signed-off-by: Francesco Ilario <filario@redhat.com>

---------

Signed-off-by: Francesco Ilario <filario@redhat.com>
Co-authored-by: Alexey Kazakov <alkazako@redhat.com>
  • Loading branch information
filariow and alexeykazakov authored Nov 20, 2023
1 parent 082aed8 commit 8c0146d
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.
return reconcile.Result{}, err
}

if err := r.handleWebConsolePluginDeploy(reqLogger, crtConfig, request.Namespace); err != nil {
if err := r.handleWebConsolePluginDeploy(ctx, crtConfig, request.Namespace); err != nil {
return reconcile.Result{}, err
}

Expand All @@ -77,7 +77,7 @@ func (r *Reconciler) handleAutoscalerDeploy(ctx context.Context, cfg membercfg.C
logger := log.FromContext(ctx)
if cfg.Autoscaler().Deploy() {
logger.Info("(Re)Deploying autoscaling buffer")
if err := autoscaler.Deploy(r.Client, r.Client.Scheme(), namespace, cfg.Autoscaler().BufferMemory(), cfg.Autoscaler().BufferReplicas()); err != nil {
if err := autoscaler.Deploy(ctx, r.Client, r.Client.Scheme(), namespace, cfg.Autoscaler().BufferMemory(), cfg.Autoscaler().BufferReplicas()); err != nil {
return err
}
logger.Info("(Re)Deployed autoscaling buffer")
Expand All @@ -96,9 +96,9 @@ func (r *Reconciler) handleAutoscalerDeploy(ctx context.Context, cfg membercfg.C
}

func (r *Reconciler) handleWebhookDeploy(ctx context.Context, cfg membercfg.Configuration, namespace string) error {
logger := log.FromContext(ctx)
// By default the users' pods webhook will be deployed, however in some cases (eg. e2e tests) there can be multiple member operators
// installed in the same cluster. In those cases only 1 webhook is needed because the MutatingWebhookConfiguration is a cluster-scoped resource and naming can conflict.
logger := log.FromContext(ctx)
if cfg.Webhook().Deploy() {
webhookImage := os.Getenv("MEMBER_OPERATOR_WEBHOOK_IMAGE")
logger.Info("(Re)Deploying users' pods webhook")
Expand All @@ -112,11 +112,13 @@ func (r *Reconciler) handleWebhookDeploy(ctx context.Context, cfg membercfg.Conf
return nil
}

func (r *Reconciler) handleWebConsolePluginDeploy(logger logr.Logger, cfg membercfg.Configuration, namespace string) error {
func (r *Reconciler) handleWebConsolePluginDeploy(ctx context.Context, cfg membercfg.Configuration, namespace string) error {
logger := log.FromContext(ctx)

if cfg.WebConsolePlugin().Deploy() {
webconsolepluginImage := os.Getenv("MEMBER_OPERATOR_WEBCONSOLEPLUGIN_IMAGE")
logger.Info("(Re)Deploying web console plugin")
if err := consoledeploy.ConsolePlugin(r.Client, r.Client.Scheme(), namespace, webconsolepluginImage); err != nil {
if err := consoledeploy.ConsolePlugin(ctx, r.Client, r.Client.Scheme(), namespace, webconsolepluginImage); err != nil {
return err
}
logger.Info("(Re)Deployed web console plugin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ func TestHandleWebConsolePluginDeploy(t *testing.T) {
actualConfig, err := membercfg.GetConfiguration(cl)
require.NoError(t, err)

ctx := log.IntoContext(context.TODO(), controller.Log)

// when
err = controller.handleWebConsolePluginDeploy(controller.Log, actualConfig, test.MemberOperatorNs)
err = controller.handleWebConsolePluginDeploy(ctx, actualConfig, test.MemberOperatorNs)

// then
require.NoError(t, err)
Expand All @@ -306,8 +308,10 @@ func TestHandleWebConsolePluginDeploy(t *testing.T) {
actualConfig, err := membercfg.GetConfiguration(cl)
require.NoError(t, err)

ctx := log.IntoContext(context.TODO(), controller.Log)

// when
err = controller.handleWebConsolePluginDeploy(controller.Log, actualConfig, test.MemberOperatorNs)
err = controller.handleWebConsolePluginDeploy(ctx, actualConfig, test.MemberOperatorNs)

// then
require.NoError(t, err)
Expand All @@ -323,11 +327,13 @@ func TestHandleWebConsolePluginDeploy(t *testing.T) {
actualConfig, err := membercfg.GetConfiguration(cl)
require.NoError(t, err)

ctx := log.IntoContext(context.TODO(), controller.Log)

// when
cl.(*test.FakeClient).MockGet = func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
return fmt.Errorf("client error")
}
err = controller.handleWebConsolePluginDeploy(controller.Log, actualConfig, test.MemberOperatorNs)
err = controller.handleWebConsolePluginDeploy(ctx, actualConfig, test.MemberOperatorNs)

// then
require.ErrorContains(t, err, "cannot deploy console plugin template")
Expand Down
6 changes: 4 additions & 2 deletions controllers/memberstatus/creation.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package memberstatus

import (
"context"

toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
commonclient "github.com/codeready-toolchain/toolchain-common/pkg/client"

Expand All @@ -9,7 +11,7 @@ import (
)

// CreateOrUpdateResources creates a memberstatus resource with the given name in the given namespace
func CreateOrUpdateResources(client client.Client, namespace, memberStatusName string) error {
func CreateOrUpdateResources(ctx context.Context, client client.Client, namespace, memberStatusName string) error {
memberStatus := &toolchainv1alpha1.MemberStatus{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Expand All @@ -18,6 +20,6 @@ func CreateOrUpdateResources(client client.Client, namespace, memberStatusName s
Spec: toolchainv1alpha1.MemberStatusSpec{},
}
cl := commonclient.NewApplyClient(client)
_, err := cl.ApplyObject(memberStatus)
_, err := cl.ApplyObject(ctx, memberStatus)
return err
}
4 changes: 2 additions & 2 deletions controllers/memberstatus/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestCreateOrUpdateResources(t *testing.T) {
cl := NewFakeClient(t)

// when
err = CreateOrUpdateResources(cl, MemberOperatorNs, MemberStatusName)
err = CreateOrUpdateResources(context.TODO(), cl, MemberOperatorNs, MemberStatusName)

// then
require.NoError(t, err)
Expand All @@ -42,7 +42,7 @@ func TestCreateOrUpdateResources(t *testing.T) {
}

// when
err = CreateOrUpdateResources(cl, MemberOperatorNs, MemberStatusName)
err = CreateOrUpdateResources(context.TODO(), cl, MemberOperatorNs, MemberStatusName)

// then
require.Error(t, err)
Expand Down
4 changes: 2 additions & 2 deletions controllers/nstemplateset/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type APIClient struct {
func (c APIClient) ApplyToolchainObjects(ctx context.Context, toolchainObjects []runtimeclient.Object, newLabels map[string]string) (bool, error) {
applyClient := applycl.NewApplyClient(c.Client)
anyApplied := false

logger := log.FromContext(ctx)

for _, object := range toolchainObjects {
if _, exists := object.GetAnnotations()[toolchainv1alpha1.TierTemplateObjectOptionalResourceAnnotation]; exists {
if !apiGroupIsPresent(c.AvailableAPIGroups, object.GetObjectKind().GroupVersionKind()) {
Expand Down Expand Up @@ -67,7 +67,7 @@ func (c APIClient) ApplyToolchainObjects(ctx context.Context, toolchainObjects [
continue
}
logger.Info("applying object", "object_namespace", object.GetNamespace(), "object_name", object.GetObjectKind().GroupVersionKind().Kind+"/"+object.GetName())
_, err := applyClient.Apply([]runtimeclient.Object{object}, newLabels)
_, err := applyClient.Apply(ctx, []runtimeclient.Object{object}, newLabels)
if err != nil {
return anyApplied, err
}
Expand Down
14 changes: 7 additions & 7 deletions controllers/nstemplateset/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestApplyToolchainObjects(t *testing.T) {
t.Run("when creating only one object because the other one already exists", func(t *testing.T) {
// given
apiClient, fakeClient := prepareAPIClient(t)
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(devNs, sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(devNs, sa), additionalLabel)
require.NoError(t, err)

// when
Expand All @@ -83,7 +83,7 @@ func TestApplyToolchainObjects(t *testing.T) {
t.Run("when only Deployment is supposed to be applied but the apps group is not present", func(t *testing.T) {
// given
apiClient, fakeClient := prepareAPIClient(t)
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(role, devNs, sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(role, devNs, sa), additionalLabel)
require.NoError(t, err)

// when
Expand All @@ -100,7 +100,7 @@ func TestApplyToolchainObjects(t *testing.T) {
apiClient, fakeClient := prepareAPIClient(t)
// the version is different
apiClient.AvailableAPIGroups = append(apiClient.AvailableAPIGroups, newAPIGroup("apps", "v1alpha2"))
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(role, devNs, sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(role, devNs, sa), additionalLabel)
require.NoError(t, err)

// when
Expand All @@ -116,7 +116,7 @@ func TestApplyToolchainObjects(t *testing.T) {
// given
apiClient, fakeClient := prepareAPIClient(t)
apiClient.AvailableAPIGroups = append(apiClient.AvailableAPIGroups, newAPIGroup("apps", "v1"))
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(role, devNs, sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(role, devNs, sa), additionalLabel)
require.NoError(t, err)

// when
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestApplyToolchainObjects(t *testing.T) {
"update": "me", // new annotation should be added
}
apiClient, fakeClient := prepareAPIClient(t)
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(sa), additionalLabel)
require.NoError(t, err)
called := false
fakeClient.MockGet = func(ctx context.Context, key runtimeclient.ObjectKey, obj runtimeclient.Object, opts ...runtimeclient.GetOption) error {
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestApplyToolchainObjects(t *testing.T) {
t.Run("update Role", func(t *testing.T) {
// given
apiClient, fakeClient := prepareAPIClient(t)
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(devNs, role, sa), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(devNs, role, sa), additionalLabel)
require.NoError(t, err)

// when
Expand All @@ -251,7 +251,7 @@ func TestApplyToolchainObjects(t *testing.T) {
t.Run("create SA when it doesn't exist yet", func(t *testing.T) {
// given
apiClient, fakeClient := prepareAPIClient(t)
_, err := client.NewApplyClient(fakeClient).Apply(copyObjects(devNs, role), additionalLabel)
_, err := client.NewApplyClient(fakeClient).Apply(context.TODO(), copyObjects(devNs, role), additionalLabel)
require.NoError(t, err)
called := false
fakeClient.MockGet = func(ctx context.Context, key runtimeclient.ObjectKey, obj runtimeclient.Object, opts ...runtimeclient.GetOption) error {
Expand Down
23 changes: 12 additions & 11 deletions controllers/nstemplateset/cluster_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,24 @@ var clusterResourceKinds = []toolchainObjectKind{
func (r *clusterResourcesManager) ensure(ctx context.Context, nsTmplSet *toolchainv1alpha1.NSTemplateSet) (bool, error) {
logger := log.FromContext(ctx)
userTierLogger := logger.WithValues("spacename", nsTmplSet.GetName(), "tier", nsTmplSet.Spec.TierName)
uctx := log.IntoContext(ctx, userTierLogger)

userTierCtx := log.IntoContext(ctx, userTierLogger)
userTierLogger.Info("ensuring cluster resources")

spacename := nsTmplSet.GetName()
var tierTemplate *tierTemplate
var err error
if nsTmplSet.Spec.ClusterResources != nil {
tierTemplate, err = getTierTemplate(ctx, r.GetHostCluster, nsTmplSet.Spec.ClusterResources.TemplateRef)
if err != nil {
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(uctx, nsTmplSet, err,
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(userTierCtx, nsTmplSet, err,
"failed to retrieve TierTemplate for the cluster resources with the name '%s'", nsTmplSet.Spec.ClusterResources.TemplateRef)
}
}
// go though all cluster resource kinds
for _, clusterResourceKind := range clusterResourceKinds {
gvkLogger := logger.WithValues("gvk", clusterResourceKind.gvk)
gctx := log.IntoContext(ctx, gvkLogger)
gvkLogger := userTierLogger.WithValues("gvk", clusterResourceKind.gvk)
gvkCtx := log.IntoContext(ctx, gvkLogger)

gvkLogger.Info("ensuring cluster resources")
newObjs := make([]runtimeclient.Object, 0)

Expand All @@ -133,23 +134,23 @@ func (r *clusterResourcesManager) ensure(ctx context.Context, nsTmplSet *toolcha
SpaceName: spacename,
}, retainObjectsOfSameGVK(clusterResourceKind.gvk))
if err != nil {
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(gctx, nsTmplSet, err,
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(gvkCtx, nsTmplSet, err,
"failed to process template for the cluster resources with the name '%s'", nsTmplSet.Spec.ClusterResources.TemplateRef)
}
}

// list all existing objects of the cluster resource kind
currentObjects, err := clusterResourceKind.listExistingResourcesIfAvailable(ctx, r.Client, spacename, r.AvailableAPIGroups)
if err != nil {
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(gctx, nsTmplSet, err,
return false, r.wrapErrorWithStatusUpdateForClusterResourceFailure(gvkCtx, nsTmplSet, err,
"failed to list existing cluster resources of GVK '%v'", clusterResourceKind.gvk)
}

// if there are more than one existing, then check if there is any that should be updated or deleted
if len(currentObjects) > 0 {
updatedOrDeleted, err := r.updateOrDeleteRedundant(gctx, currentObjects, newObjs, tierTemplate, nsTmplSet)
updatedOrDeleted, err := r.updateOrDeleteRedundant(gvkCtx, currentObjects, newObjs, tierTemplate, nsTmplSet)
if err != nil {
return false, r.wrapErrorWithStatusUpdate(gctx, nsTmplSet, r.setStatusUpdateFailed,
return false, r.wrapErrorWithStatusUpdate(gvkCtx, nsTmplSet, r.setStatusUpdateFailed,
err, "failed to update/delete existing cluster resources of GVK '%v'", clusterResourceKind.gvk)
}
if updatedOrDeleted {
Expand All @@ -159,9 +160,9 @@ func (r *clusterResourcesManager) ensure(ctx context.Context, nsTmplSet *toolcha
// if none was found to be either updated or deleted or if there is no existing object available,
// then check if there is any object to be created
if len(newObjs) > 0 {
anyCreated, err := r.createMissing(gctx, currentObjects, newObjs, tierTemplate, nsTmplSet)
anyCreated, err := r.createMissing(gvkCtx, currentObjects, newObjs, tierTemplate, nsTmplSet)
if err != nil {
return false, r.wrapErrorWithStatusUpdate(gctx, nsTmplSet, r.setStatusClusterResourcesProvisionFailed,
return false, r.wrapErrorWithStatusUpdate(gvkCtx, nsTmplSet, r.setStatusClusterResourcesProvisionFailed,
err, "failed to create missing cluster resource of GVK '%v'", clusterResourceKind.gvk)
}
if anyCreated {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/codeready-toolchain/member-operator

require (
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26
github.com/codeready-toolchain/toolchain-common v0.0.0-20231109031831-4700ff0cef46
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3
github.com/go-logr/logr v1.2.3
github.com/google/go-cmp v0.5.9
// using latest commit from 'github.com/openshift/api branch release-4.12'
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26 h1:7l/9jcykzh/Qq93EnPYQYpaejPkWaaHB6BLCwTKngJE=
github.com/codeready-toolchain/api v0.0.0-20231107202930-b028ae440a26/go.mod h1:bImSKnxrpNmCmW/YEGiiZnZqJm3kAmfP5hW4YndK0hE=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231109031831-4700ff0cef46 h1:k5pOiEknSFHA6DiOojzcIrVqd2XXK8f2twSS7lP03EM=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231109031831-4700ff0cef46/go.mod h1:gyyXkpyEXoJJyHLuHBh/fckZ9XqjeP2AKlKkG/r9wpk=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3 h1:sPXhmaRcT7y5rsuXFp3p0dgl6a7SixFVnZLAPRJYClU=
github.com/codeready-toolchain/toolchain-common v0.0.0-20231113200037-9a9f915098e3/go.mod h1:gyyXkpyEXoJJyHLuHBh/fckZ9XqjeP2AKlKkG/r9wpk=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func main() {
// create or update Member status during the operator deployment
setupLog.Info("Creating/updating the MemberStatus resource")
memberStatusName := memberstatus.MemberStatusName
if err := memberstatus.CreateOrUpdateResources(mgr.GetClient(), namespace, memberStatusName); err != nil {
if err := memberstatus.CreateOrUpdateResources(stopChannel, mgr.GetClient(), namespace, memberStatusName); err != nil {
setupLog.Error(err, "cannot create/update MemberStatus resource")
os.Exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/autoscaler/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)

func Deploy(cl runtimeclient.Client, s *runtime.Scheme, namespace, requestsMemory string, replicas int) error {
func Deploy(ctx context.Context, cl runtimeclient.Client, s *runtime.Scheme, namespace, requestsMemory string, replicas int) error {
objs, err := getTemplateObjects(s, namespace, requestsMemory, replicas)
if err != nil {
return err
Expand All @@ -27,7 +27,7 @@ func Deploy(cl runtimeclient.Client, s *runtime.Scheme, namespace, requestsMemor
applyClient := applycl.NewApplyClient(cl)
// create all objects that are within the template, and update only when the object has changed.
for _, obj := range objs {
if _, err := applyClient.ApplyObject(obj); err != nil {
if _, err := applyClient.ApplyObject(ctx, obj); err != nil {
return errs.Wrap(err, "cannot deploy autoscaling buffer template")
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/autoscaler/autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestDeploy(t *testing.T) {
fakeClient := test.NewFakeClient(t)

// when
err := Deploy(fakeClient, s, test.MemberOperatorNs, "500Mi", 10)
err := Deploy(context.TODO(), fakeClient, s, test.MemberOperatorNs, "500Mi", 10)

// then
require.NoError(t, err)
Expand All @@ -63,7 +63,7 @@ func TestDeploy(t *testing.T) {
fakeClient := test.NewFakeClient(t, priorityClass, deployment)

// when
err := Deploy(fakeClient, s, test.MemberOperatorNs, "7Gi", 1)
err := Deploy(context.TODO(), fakeClient, s, test.MemberOperatorNs, "7Gi", 1)

// then
require.NoError(t, err)
Expand All @@ -78,7 +78,7 @@ func TestDeploy(t *testing.T) {
}

// when
err := Deploy(fakeClient, s, test.MemberOperatorNs, "7Gi", 3)
err := Deploy(context.TODO(), fakeClient, s, test.MemberOperatorNs, "7Gi", 3)

// then
assert.EqualError(t, err, "cannot deploy autoscaling buffer template: unable to create resource of kind: PriorityClass, version: v1: some error")
Expand Down
6 changes: 4 additions & 2 deletions pkg/consoleplugin/deploy/deployment.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package deploy

import (
"context"

applycl "github.com/codeready-toolchain/toolchain-common/pkg/client"
"github.com/codeready-toolchain/toolchain-common/pkg/template"

Expand All @@ -11,7 +13,7 @@ import (
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)

func ConsolePlugin(cl runtimeclient.Client, s *runtime.Scheme, namespace, image string) error {
func ConsolePlugin(ctx context.Context, cl runtimeclient.Client, s *runtime.Scheme, namespace, image string) error {
objs, err := getTemplateObjects(s, namespace, image)
if err != nil {
return errs.Wrap(err, "cannot deploy console plugin template")
Expand All @@ -21,7 +23,7 @@ func ConsolePlugin(cl runtimeclient.Client, s *runtime.Scheme, namespace, image
// create all objects that are within the template, and update only when the object has changed.
// if the object was either created or updated, then return and wait for another reconcile
for _, obj := range objs {
if _, err := applyClient.ApplyObject(obj); err != nil {
if _, err := applyClient.ApplyObject(ctx, obj); err != nil {
return errs.Wrap(err, "cannot deploy console plugin template")
}
}
Expand Down
Loading

0 comments on commit 8c0146d

Please sign in to comment.