Skip to content

Commit

Permalink
Fix default certificate validity
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinliu24 committed Jun 11, 2024
1 parent a9d3251 commit ca222ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
- --webhook-server-name={{ template "admission-webhook.name" . }}-validating
- --webhook-names={{ template "controller-manager-admission-webhook.name" . }}-service,{{ template "autoscaler-admission-webhook.name" . }}-service
- --certificate-dir=/tmp/k8s-webhook-server/serving-certs
- --certificate-validity=5
- --certificate-validity=1
- --secret-namespace={{ template "nebula-operator.namespace" . }}
- --secret-name={{ template "admission-webhook.name" . }}-secret
- --kube-domain={{ default "cluster.local" .Values.kubernetesClusterDomain }}
Expand Down
4 changes: 2 additions & 2 deletions cmd/certificate-generator/app/certificate-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ func Run(ctx context.Context, opts *options.Options) error {
}

func rotateCertificate(clientset *kubernetes.Clientset, opts *options.Options) error {
//opts.CertValidity = opts.CertValidity * 24 * 60
opts.CertValidity = opts.CertValidity * 24 * 60

klog.Infof("Starting cert rotation cron job for webhook [%v/%v]", opts.WebhookNamespace, opts.WebhookServerName)
c := cron.New()
// rotate cert 1 hour before expiration date
c.AddFunc(fmt.Sprintf("@every %vm", opts.CertValidity-1), func() {
c.AddFunc(fmt.Sprintf("@every %vm", opts.CertValidity-60), func() {
err := doCertRotation(clientset, opts)
if err != nil {
klog.Errorf("Error rotating certificate for webhook [%v/%v]: %v", opts.WebhookNamespace, opts.WebhookServerName, err)
Expand Down

0 comments on commit ca222ec

Please sign in to comment.