Skip to content
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

Prevent the creation of multiple servers per machine #58

Merged
merged 14 commits into from
Jan 5, 2024
Merged
Changes from 1 commit
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
17 changes: 14 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/GDATASoftwareAG/cluster-api-provider-ionoscloud/internal/context"
"github.com/GDATASoftwareAG/cluster-api-provider-ionoscloud/internal/ionos"
"os"
"sigs.k8s.io/controller-runtime/pkg/client"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
Expand Down Expand Up @@ -71,9 +72,19 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
/* if we retrieve IONOSCloudMachine from the cache we occasionally get outdated data,
which leads to the creation of multiple servers for a single IONOSCloudMachine,
because we check ProviderID to decide if we need to create a new server*/
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: []client.Object{
&infrastructurev1alpha1.IONOSCloudMachine{},
},
},
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "2606507e.cluster.x-k8s.io",
Expand Down
Loading