spegel-org / spegel

Stateless cluster local OCI registry mirror.
MIT License
1.17k stars 65 forks source link

Is it possible to create two p2p clusters in one k8s cluster by configuring different LeaderElectionName and LeaderElectionNamespace #599

Open sunnoy opened 1 week ago

sunnoy commented 1 week ago

K8s clusters are distributed in multiple regions. Each region has a p2p cluster. Can it be distinguished by the following parameters?

type BootstrapConfig struct {
    BootstrapKind           string `arg:"--bootstrap-kind,env:BOOTSTRAP_KIND" help:"Kind of bootsrapper to use."`
    HTTPBootstrapAddr       string `arg:"--http-bootstrap-addr,env:HTTP_BOOTSTRAP_ADDR" help:"Address to serve for HTTP bootstrap."`
    HTTPBootstrapPeer       string `arg:"--http-bootstrap-peer,env:HTTP_BOOTSTRAP_PEER" help:"Peer to HTTP bootstrap with."`
    KubeconfigPath          string `arg:"--kubeconfig-path,env:KUBECONFIG_PATH" help:"Path to the kubeconfig file."`
    LeaderElectionName      string `arg:"--leader-election-name,env:LEADER_ELECTION_NAME" default:"spegel-leader-election" help:"Name of leader election."`
    LeaderElectionNamespace string `arg:"--leader-election-namespace,env:LEADER_ELECTION_NAMESPACE" default:"spegel" help:"Kubernetes namespace to write leader election data."`
}

LeaderElectionName and LeaderElectionNamespace

phillebaba commented 1 week ago

We have discussed this before as a method of dealing with multi region deployments. It should be possible even though we never got confirmation that it worked. Have a look at the example in this comment.

https://github.com/spegel-org/spegel/issues/461#issuecomment-2083792421

If you could verify that this solves your problems we should document it.