Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Decade to Century #1773

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/interceptors/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/interceptors/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down