Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ukff committed Dec 18, 2024
1 parent dcec865 commit a9f02c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/btpoperator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ func (r *BtpOperatorReconciler) handleSapBtpManagerChange(ctx context.Context, l
clusterIdUnstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(clusterIdSecret)
clusterIdUnstructuredObj := &unstructured.Unstructured{Object: clusterIdUnstructured}
if err != nil {
return fmt.Errorf("failed to secret: %s in %s to unstructred : %s \n", sapBtpSecret.GetName(), sapBtpSecret.GetNamespace(), err.Error())
return fmt.Errorf("failed to secret: %s in %s to unstructred : %s \n", clusterIdSecret.GetName(), clusterIdSecret.GetNamespace(), err.Error())
}

synced, err := r.getDependedResourcesForSecretChange(ctx, clusterIdUnstructuredObj, sapBtpSecret, configMap, logger)
Expand All @@ -2100,6 +2100,7 @@ func (r *BtpOperatorReconciler) handleSapBtpManagerChange(ctx context.Context, l
if err != nil {
return err
}
logger.Info("deployment restarted")

synced, err = r.getDependedResourcesForSecretChange(ctx, clusterIdUnstructuredObj, sapBtpSecret, configMap, logger)
if err != nil {
Expand Down Expand Up @@ -2132,7 +2133,7 @@ func (r *BtpOperatorReconciler) getDependedResourcesForSecretChange(ctx context.
return false, fmt.Errorf("failed to get secret %s in %s : %s \n", sapBtpSecret.GetName(), sapBtpSecret.GetNamespace(), err.Error())
}

err = r.Get(context.Background(), client.ObjectKey{Name: btpServiceOperatorConfigMap, Namespace: ChartNamespace}, configMap)
err = r.Get(ctx, client.ObjectKey{Name: btpServiceOperatorConfigMap, Namespace: ChartNamespace}, configMap)
if err != nil {
return false, fmt.Errorf("failed to get configmap %s in %s : %s \n", configMap.GetName(), configMap.GetNamespace(), err.Error())
}
Expand Down
6 changes: 6 additions & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controllers
import (
"context"
"fmt"
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"

Check failure on line 22 in controllers/suite_test.go

View workflow job for this annotation

GitHub Actions / run-go-linter

File is not `goimports`-ed (goimports)
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -72,6 +73,7 @@ var (
cfg *rest.Config
k8sClient client.Client
k8sClientFromManager client.Client
k8sClientSet *clientset.Clientset
k8sManager manager.Manager
testEnv *envtest.Environment
ctx context.Context
Expand Down Expand Up @@ -156,6 +158,10 @@ var _ = SynchronizedBeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

k8sClientSet, err = clientset.NewForConfig(cfg)
Expect(err).NotTo(HaveOccurred())
Expect(k8sClientSet).NotTo(BeNil())

k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme.Scheme,
Metrics: server.Options{BindAddress: "0"},
Expand Down

0 comments on commit a9f02c3

Please sign in to comment.