diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 282508b1d..a7d4bcda7 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -22,17 +22,13 @@ import ( "fmt" "os" "path/filepath" - "time" "github.com/spf13/pflag" "go.uber.org/zap/zapcore" apiextensionsv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1" k8slabels "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" - "k8s.io/apimachinery/pkg/types" - corev1client "k8s.io/client-go/kubernetes/typed/core/v1" _ "k8s.io/client-go/plugin/pkg/client/auth" - "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" crcache "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" @@ -46,7 +42,6 @@ import ( ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1" "github.com/operator-framework/operator-controller/internal/action" - "github.com/operator-framework/operator-controller/internal/authentication" "github.com/operator-framework/operator-controller/internal/catalogmetadata/cache" catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client" "github.com/operator-framework/operator-controller/internal/controllers" @@ -163,34 +158,9 @@ func main() { ext := obj.(*ocv1alpha1.ClusterExtension) return ext.Spec.InstallNamespace, nil }) - coreClient, err := corev1client.NewForConfig(mgr.GetConfig()) - if err != nil { - setupLog.Error(err, "unable to create core client") - os.Exit(1) - } - tokenGetter := authentication.NewTokenGetter(coreClient, authentication.WithExpirationDuration(1*time.Hour)) - - restConfigMapper := func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) { - cExt, ok := o.(*ocv1alpha1.ClusterExtension) - if !ok { - return c, nil - } - namespacedName := types.NamespacedName{ - Name: cExt.Spec.ServiceAccount.Name, - Namespace: cExt.Spec.InstallNamespace, - } - token, err := tokenGetter.Get(ctx, namespacedName) - if err != nil { - return nil, fmt.Errorf("failed to extract SA token, %w", err) - } - tempConfig := rest.AnonymousClientConfig(c) - tempConfig.BearerToken = token - return tempConfig, nil - } cfgGetter, err := helmclient.NewActionConfigGetter(mgr.GetConfig(), mgr.GetRESTMapper(), helmclient.StorageNamespaceMapper(installNamespaceMapper), helmclient.ClientNamespaceMapper(installNamespaceMapper), - helmclient.RestConfigMapper(restConfigMapper), ) if err != nil { setupLog.Error(err, "unable to config for creating helm client") diff --git a/config/base/rbac/role.yaml b/config/base/rbac/role.yaml index 0130a1662..3d36de44e 100644 --- a/config/base/rbac/role.yaml +++ b/config/base/rbac/role.yaml @@ -5,11 +5,11 @@ metadata: name: manager-role rules: - apiGroups: - - apiextensions.k8s.io + - '*' resources: - - customresourcedefinitions + - '*' verbs: - - get + - '*' - apiGroups: - catalogd.operatorframework.io resources: @@ -36,12 +36,6 @@ rules: - patch - update - watch -- apiGroups: - - "" - resources: - - serviceaccounts/token - verbs: - - create - apiGroups: - olm.operatorframework.io resources: @@ -49,8 +43,6 @@ rules: verbs: - get - list - - patch - - update - watch - apiGroups: - olm.operatorframework.io diff --git a/config/samples/olm_v1alpha1_clusterextension.yaml b/config/samples/olm_v1alpha1_clusterextension.yaml index b66c75ac0..475f3eeaf 100644 --- a/config/samples/olm_v1alpha1_clusterextension.yaml +++ b/config/samples/olm_v1alpha1_clusterextension.yaml @@ -7,4 +7,4 @@ spec: packageName: argocd-operator version: 0.6.0 serviceAccount: - name: default + name: argocd-installer diff --git a/hack/test/pre-upgrade-setup.sh b/hack/test/pre-upgrade-setup.sh index ebd1bf4c5..937b38370 100755 --- a/hack/test/pre-upgrade-setup.sh +++ b/hack/test/pre-upgrade-setup.sh @@ -33,42 +33,6 @@ spec: insecureSkipTLSVerify: true EOF -kubectl apply -f - <