Skip to content

Commit

Permalink
fix: healthz/metrics port args kimup-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
azrod committed Nov 7, 2024
1 parent 1b10ca3 commit 2bdc27a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- '-X github.com/orange-cloudavenue/kube-image-updater/internal/models/models.Version={{.Tag}}'
- '-X github.com/orange-cloudavenue/kube-image-updater/internal/models.Version={{.Tag}}'

dockers:
# * KIMUP
Expand Down
1 change: 0 additions & 1 deletion cmd/kimup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func init() {
metrics.Rules()
metrics.Registry()

// TODO add namespace scope
// Flag "loglevel" is set in log package
flag.Parse()
}
Expand Down
6 changes: 2 additions & 4 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ func main() {

ctrl.SetLogger(logrusr.New(log.GetLogger()))

webhook := webhook.NewServer(webhook.Options{Port: models.MutatorDefaultPort})

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
Expand All @@ -99,7 +97,7 @@ func main() {
}(),
LeaderElection: enableLeaderElection,
LeaderElectionID: "71be4586.kimup.cloudavenue.io",
WebhookServer: webhook,
WebhookServer: webhook.NewServer(webhook.Options{Port: models.MutatorDefaultPort}),
})
if err != nil {
log.WithError(err).Error("unable to start manager")
Expand Down Expand Up @@ -178,7 +176,7 @@ func main() {
c <- syscall.SIGINT
}

log.Info("Starting operator")
log.WithField("version", models.Version).Info("Starting kimup operator", models.Version)
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
log.WithError(err).Error(err, "problem running manager")
c <- syscall.SIGINT
Expand Down
5 changes: 2 additions & 3 deletions internal/controller/resources_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func buildKimupArgs(extra v1alpha1.KimupExtraSpec) (args []string) {

// set the healthz port
healthzPort := extra.Healthz.Port
if healthzPort != 0 {
if healthzPort == 0 {
healthzPort = models.HealthzDefaultPort
}
args = append(args, fmt.Sprintf("--%s=%d", models.HealthzPortFlagName, healthzPort))
Expand All @@ -43,7 +43,7 @@ func buildKimupArgs(extra v1alpha1.KimupExtraSpec) (args []string) {

// set the metrics port
metricsPort := extra.Metrics.Port
if metricsPort != 0 {
if metricsPort == 0 {
metricsPort = models.MetricsDefaultPort
}

Expand All @@ -58,7 +58,6 @@ func buildKimupArgs(extra v1alpha1.KimupExtraSpec) (args []string) {
args = append(args, fmt.Sprintf("--%s=%s", models.MetricsPathFlagName, metricsPath))
}

// TODO
args = append(args, fmt.Sprintf("--%s=%s", models.LogLevelFlagName, extra.LogLevel))

return args
Expand Down
4 changes: 2 additions & 2 deletions manifests/operator/webhook-certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
namespace: kimup-operator
spec:
dnsNames:
- mutator.kimup-operator.svc
- mutator.kimup-operator.svc.cluster.local
- kimup-operator.kimup-operator.svc
- kimup-operator.kimup-operator.svc.cluster.local
secretName: kimup-webhook-serving-cert
issuerRef:
kind: Issuer
Expand Down

0 comments on commit 2bdc27a

Please sign in to comment.