Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
tremes committed Jul 21, 2021
1 parent 252ef19 commit 6817e82
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/cmd/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,36 @@ func NewGather() *cobra.Command {
func runGather(operator *controller.GatherJob, cfg *controllercmd.ControllerCommandConfig) func(cmd *cobra.Command, args []string) {
return func(cmd *cobra.Command, args []string) {
if configArg := cmd.Flags().Lookup("config").Value.String(); len(configArg) == 0 {
klog.Error("error: --config is required")
klog.Exit("error: --config is required")
}
unstructured, _, _, err := cfg.Config()
if err != nil {
klog.Error(err)
klog.Exit(err)
}
cont, err := config.LoadConfig(operator.Controller, unstructured.Object, config.ToDisconnectedController)
if err != nil {
klog.Error(err)
klog.Exit(err)
}
operator.Controller = cont

var clientConfig *rest.Config
if kubeConfigPath := cmd.Flags().Lookup("kubeconfig").Value.String(); len(kubeConfigPath) > 0 {
kubeConfigBytes, err := ioutil.ReadFile(kubeConfigPath) //nolint: govet
if err != nil {
klog.Error(err)
klog.Exit(err)
}
kubeConfig, err := clientcmd.NewClientConfigFromBytes(kubeConfigBytes)
if err != nil {
klog.Error(err)
klog.Exit(err)
}
clientConfig, err = kubeConfig.ClientConfig()
if err != nil {
klog.Error(err)
klog.Exit(err)
}
} else {
clientConfig, err = rest.InClusterConfig()
if err != nil {
klog.Error(err)
klog.Exit(err)
}
}
protoConfig := rest.CopyConfig(clientConfig)
Expand All @@ -125,17 +125,17 @@ func runOperator(operator *controller.Operator, cfg *controllercmd.ControllerCom
serviceability.StartProfiler()

if configArg := cmd.Flags().Lookup("config").Value.String(); len(configArg) == 0 {
klog.Error("error: --config is required")
klog.Exit("error: --config is required")
}

unstructured, operatorConfig, configBytes, err := cfg.Config()
if err != nil {
klog.Error(err)
klog.Exit(err)
}

startingFileContent, observedFiles, err := cfg.AddDefaultRotationToConfig(operatorConfig, configBytes)
if err != nil {
klog.Error(err)
klog.Exit(err)
}

// if the service CA is rotated, we want to restart
Expand Down

0 comments on commit 6817e82

Please sign in to comment.