Skip to content

Commit

Permalink
Merge pull request #58 from GDATASoftwareAG/fix_creation
Browse files Browse the repository at this point in the history
Prevent the creation of multiple servers per machine
  • Loading branch information
Mattes83 authored Jan 5, 2024
2 parents 634f609 + 8b26f67 commit cd59855
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion 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 @@ -72,7 +73,17 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Scheme: scheme,
/* 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{},
},
},
},
Metrics: metricsserver.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
Expand Down

0 comments on commit cd59855

Please sign in to comment.