Skip to content

Commit fd25bf7

Browse files
authored
Revert "initial (#2562)" (#2630)
This reverts commit 8ccea5a.
1 parent 5060cae commit fd25bf7

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

cmd/catalogd/main.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import (
3737
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3838
"k8s.io/client-go/metadata"
3939
_ "k8s.io/client-go/plugin/pkg/client/auth"
40-
"k8s.io/client-go/rest"
41-
"k8s.io/client-go/tools/clientcmd"
4240
"k8s.io/klog/v2"
4341
"k8s.io/utils/ptr"
4442
ctrl "sigs.k8s.io/controller-runtime"
@@ -97,7 +95,6 @@ type config struct {
9795
webhookPort int
9896
pullCasDir string
9997
globalPullSecret string
100-
kubeconfig string
10198
// Generated config
10299
globalPullSecretKey *k8stypes.NamespacedName
103100
}
@@ -139,7 +136,6 @@ func init() {
139136
flags.IntVar(&cfg.webhookPort, "webhook-server-port", 9443, "Webhook server port")
140137
flags.StringVar(&cfg.pullCasDir, "pull-cas-dir", "", "The directory of TLS certificate authorities to use for verifying HTTPS connections to image registries.")
141138
flags.StringVar(&cfg.globalPullSecret, "global-pull-secret", "", "Global pull secret (<namespace>/<name>)")
142-
flags.StringVar(&cfg.kubeconfig, "kubeconfig", "", "Path to kubeconfig file for API server access. Uses in-cluster config if empty.")
143139

144140
// adds version subcommand
145141
catalogdCmd.AddCommand(versionCommand)
@@ -277,20 +273,8 @@ func run(ctx context.Context) error {
277273
return err
278274
}
279275

280-
// Create manager with kubeconfig support for non-default kubeconfig
281-
var restConfig *rest.Config
282-
if cfg.kubeconfig != "" {
283-
setupLog.Info("loading kubeconfig from file", "path", cfg.kubeconfig)
284-
restConfig, err = clientcmd.BuildConfigFromFlags("", cfg.kubeconfig)
285-
if err != nil {
286-
setupLog.Error(err, "unable to load kubeconfig")
287-
return err
288-
}
289-
} else {
290-
restConfig = ctrl.GetConfigOrDie()
291-
}
292-
293-
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
276+
// Create manager
277+
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
294278
Scheme: scheme,
295279
Metrics: metricsServerOptions,
296280
PprofBindAddress: cfg.pprofAddr,

cmd/operator-controller/main.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ import (
4141
"k8s.io/client-go/discovery/cached/memory"
4242
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
4343
_ "k8s.io/client-go/plugin/pkg/client/auth"
44-
"k8s.io/client-go/rest"
45-
"k8s.io/client-go/tools/clientcmd"
4644
"k8s.io/klog/v2"
4745
"k8s.io/utils/ptr"
4846
"pkg.package-operator.run/boxcutter/managedcache"
@@ -107,7 +105,6 @@ type config struct {
107105
catalogdCasDir string
108106
pullCasDir string
109107
globalPullSecret string
110-
kubeconfig string
111108
}
112109

113110
type reconcilerConfigurator interface {
@@ -187,7 +184,6 @@ func init() {
187184
flags.StringVar(&cfg.cachePath, "cache-path", "/var/cache", "The local directory path used for filesystem based caching")
188185
flags.StringVar(&cfg.systemNamespace, "system-namespace", "", "Configures the namespace that gets used to deploy system resources.")
189186
flags.StringVar(&cfg.globalPullSecret, "global-pull-secret", "", "The <namespace>/<name> of the global pull secret that is going to be used to pull bundle images.")
190-
flags.StringVar(&cfg.kubeconfig, "kubeconfig", "", "Path to kubeconfig file for API server access. Uses in-cluster config if empty.")
191187

192188
//adds version sub command
193189
operatorControllerCmd.AddCommand(versionCommand)
@@ -329,18 +325,7 @@ func run() error {
329325
"Metrics will not be served since the TLS certificate and key file are not provided.")
330326
}
331327

332-
// Load REST config with kubeconfig support for non-default kubeconfig
333-
var restConfig *rest.Config
334-
if cfg.kubeconfig != "" {
335-
setupLog.Info("loading kubeconfig from file", "path", cfg.kubeconfig)
336-
restConfig, err = clientcmd.BuildConfigFromFlags("", cfg.kubeconfig)
337-
if err != nil {
338-
setupLog.Error(err, "unable to load kubeconfig")
339-
return err
340-
}
341-
} else {
342-
restConfig = ctrl.GetConfigOrDie()
343-
}
328+
restConfig := ctrl.GetConfigOrDie()
344329
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
345330
Scheme: scheme.Scheme,
346331
Metrics: metricsServerOptions,

0 commit comments

Comments
 (0)