diff --git a/pkg/interceptors/server/server.go b/pkg/interceptors/server/server.go index f5a154a6c..7a75fe859 100644 --- a/pkg/interceptors/server/server.go +++ b/pkg/interceptors/server/server.go @@ -33,7 +33,7 @@ import ( ) const ( - Decade = 100 * 365 * 24 * time.Hour + Century = 100 * 365 * 24 * time.Hour interceptorTLSSecretKey = "INTERCEPTOR_TLS_SECRET_NAME" interceptorTLSSvcKey = "INTERCEPTOR_TLS_SVC_NAME" ) @@ -159,7 +159,7 @@ func (is *Server) ExecuteInterceptor(r *http.Request) ([]byte, error) { } func CreateAndValidateCerts(ctx context.Context, coreV1Interface corev1.CoreV1Interface, logger *zap.SugaredLogger, service *Server, tc triggersv1alpha1.TriggersV1alpha1Interface) { - serverCert, caCert, err := createCerts(ctx, coreV1Interface, time.Now().Add(Decade), logger, false) + serverCert, caCert, err := createCerts(ctx, coreV1Interface, time.Now().Add(Century), logger, false) if err != nil { return } @@ -278,7 +278,7 @@ func (is *Server) checkCertValidity(ctx context.Context, serverCert, caCert []by if _, err := cert.Verify(opts); err != nil { logger.Errorf("failed to verify certificate: %v", err.Error()) - serverCertNew, caCertNew, err := createCerts(ctx, coreV1Interface, time.Now().Add(Decade), logger, true) + serverCertNew, caCertNew, err := createCerts(ctx, coreV1Interface, time.Now().Add(Century), logger, true) if err != nil { logger.Errorf("failed to create certs %v", err) } diff --git a/pkg/interceptors/server/server_test.go b/pkg/interceptors/server/server_test.go index 154f6fc85..a5bc108bb 100644 --- a/pkg/interceptors/server/server_test.go +++ b/pkg/interceptors/server/server_test.go @@ -212,7 +212,7 @@ func Test_SecretNotExist(t *testing.T) { logger := zaptest.NewLogger(t) ctx, _ := test.SetupFakeContext(t) clientSet := fakekubeclient.Get(ctx).CoreV1() - _, _, err := createCerts(ctx, clientSet, time.Now().Add(Decade), logger.Sugar(), false) + _, _, err := createCerts(ctx, clientSet, time.Now().Add(Century), logger.Sugar(), false) if err != nil && !strings.Contains(err.Error(), "not found") { t.Error(err) } @@ -241,7 +241,7 @@ func createSecret(t *testing.T, noAfter time.Time, certExpire bool) (v1.CoreV1In } func Test_CreateSecret(t *testing.T) { - _, sCert, caCert, err := createSecret(t, time.Now().Add(Decade), true) + _, sCert, caCert, err := createSecret(t, time.Now().Add(Century), true) if err != nil { t.Error(err) }