Skip to content

fix: healthz/metrics port args kimup-controller #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading