Init kubebuilder tutorial

This commit is contained in:
Nicolas CARON
2024-06-07 13:44:17 +02:00
parent 795d6f256c
commit 1da5f03e8e
21 changed files with 6 additions and 652 deletions

View File

@@ -33,9 +33,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
webappv1 "git.coopgo.io/ncaron/operator-test/api/v1"
"git.coopgo.io/ncaron/operator-test/internal/controller"
// +kubebuilder:scaffold:imports
)
@@ -47,7 +44,6 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(webappv1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}
@@ -105,7 +101,7 @@ func main() {
WebhookServer: webhookServer,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "cc89aa66.localhost",
LeaderElectionID: "80807133.tutorial.kubebuilder.io",
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
// when the Manager ends. This requires the binary to immediately end when the
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
@@ -123,13 +119,6 @@ func main() {
os.Exit(1)
}
if err = (&controller.OperatorReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Operator")
os.Exit(1)
}
// +kubebuilder:scaffold:builder
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {