mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
refactor: init certs with certs renewer directly (#3853)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
2866c06d95
commit
ec2bf3b6da
2 changed files with 4 additions and 13 deletions
|
@ -343,7 +343,10 @@ func main() {
|
|||
|
||||
registerWrapperRetry := common.RetryFunc(time.Second, webhookRegistrationTimeout, webhookCfg.Register, "failed to register webhook", setupLog)
|
||||
registerWebhookConfigurations := func() {
|
||||
certManager.InitTLSPemPair()
|
||||
if _, err := certRenewer.InitTLSPemPair(); err != nil {
|
||||
setupLog.Error(err, "tls initialization error")
|
||||
os.Exit(1)
|
||||
}
|
||||
waitForCacheSync(stopCh, kyvernoInformer, kubeInformer, kubeKyvernoInformer)
|
||||
|
||||
// validate the ConfigMap format
|
||||
|
|
|
@ -18,10 +18,6 @@ type Controller interface {
|
|||
// Run starts the certManager
|
||||
Run(stopCh <-chan struct{})
|
||||
|
||||
// InitTLSPemPair initializes the TLSPemPair
|
||||
// it should be invoked by the leader
|
||||
InitTLSPemPair()
|
||||
|
||||
// GetTLSPemPair gets the existing TLSPemPair from the secret
|
||||
GetTLSPemPair() (*tls.PemPair, error)
|
||||
}
|
||||
|
@ -63,14 +59,6 @@ func (m *controller) updateSecretFunc(oldObj interface{}, newObj interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func (m *controller) InitTLSPemPair() {
|
||||
_, err := m.renewer.InitTLSPemPair()
|
||||
if err != nil {
|
||||
logger.Error(err, "initialization error")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *controller) GetTLSPemPair() (*tls.PemPair, error) {
|
||||
secret, err := m.secretLister.Secrets(config.KyvernoNamespace).Get(m.renewer.GenerateTLSPairSecretName())
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue