Skip to content

Commit

Permalink
Create metrics service only when running in k8s cluster (#444)
Browse files Browse the repository at this point in the history
* Create metrics service only when running in k8s cluster

Signed-off-by: Pavol Loffay <[email protected]>

* use if style

Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay authored May 28, 2019
1 parent 18d5077 commit 5c61e4e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/cmd/start/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ func start(cmd *cobra.Command, args []string) {
}

// Create Service object to expose the metrics port.
var operatorService *corev1.Service
if operatorService, err = metrics.ExposeMetricsPort(ctx, viper.GetInt32("metrics-port")); err != nil {
log.Fatal(err)
} else if err = setOwnerReference(operatorService); err != nil {
operatorService, err := metrics.ExposeMetricsPort(ctx, viper.GetInt32("metrics-port"))
if err != nil {
log.Fatal(err)
} else if operatorService != nil {
if err := setOwnerReference(operatorService); err != nil {
log.Fatal(err)
}
}

// Start the Cmd
Expand Down

0 comments on commit 5c61e4e

Please sign in to comment.