Skip to content

Commit

Permalink
Rename Decade to Century
Browse files Browse the repository at this point in the history
We had an issue [1] with long expiration so I noticed the name was wrong

[1] rh-ecosystem-edge/recert#167
  • Loading branch information
omertuc committed Oct 10, 2024
1 parent d308fd2 commit 8d05bf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 8d05bf0

Please sign in to comment.