Run kops-controller server on non-leaders as well

This commit is contained in:
John Gardiner Myers 2023-01-14 10:20:04 -08:00
parent f4780157b5
commit 775ed65820
1 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ import (
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/secrets"
"k8s.io/kops/util/pkg/vfs"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
type Server struct {
@ -55,6 +56,8 @@ type Server struct {
configBase vfs.Path
}
var _ manager.LeaderElectionRunnable = &Server{}
func NewServer(opt *config.Options, verifier bootstrap.Verifier) (*Server, error) {
server := &http.Server{
Addr: opt.Server.Listen,
@ -90,6 +93,10 @@ func NewServer(opt *config.Options, verifier bootstrap.Verifier) (*Server, error
return s, nil
}
func (s *Server) NeedLeaderElection() bool {
return false
}
func (s *Server) Start(ctx context.Context) error {
var err error
s.keystore, s.keypairIDs, err = newKeystore(s.opt.Server.CABasePath, s.opt.Server.SigningCAs)