Skip to content

Commit

Permalink
refectoring: remove deprecated function
Browse files Browse the repository at this point in the history
Signed-off-by: Youngjun <yj.yoo@okestro.com>
  • Loading branch information
yj-yoo committed Apr 22, 2024
1 parent a9166a8 commit df16526
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 0 additions & 6 deletions pkg/controller/certificaterequests/ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

k8sErrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/cert-manager/cert-manager/internal/controller/feature"
internalinformers "github.com/cert-manager/cert-manager/internal/informers"
apiutil "github.com/cert-manager/cert-manager/pkg/api/util"
cmapi "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
Expand All @@ -34,7 +33,6 @@ import (
issuerpkg "github.com/cert-manager/cert-manager/pkg/issuer"
logf "github.com/cert-manager/cert-manager/pkg/logs"
cmerrors "github.com/cert-manager/cert-manager/pkg/util/errors"
utilfeature "github.com/cert-manager/cert-manager/pkg/util/feature"
"github.com/cert-manager/cert-manager/pkg/util/kube"
"github.com/cert-manager/cert-manager/pkg/util/pki"
)
Expand Down Expand Up @@ -72,10 +70,6 @@ func NewCA(ctx *controllerpkg.Context) certificaterequests.Issuer {
secretsLister: ctx.KubeSharedInformerFactory.Secrets().Lister(),
reporter: crutil.NewReporter(ctx.Clock, ctx.Recorder),
templateGenerator: func(cr *cmapi.CertificateRequest) (*x509.Certificate, error) {
if !utilfeature.DefaultMutableFeatureGate.Enabled(feature.DisallowInsecureCSRUsageDefinition) {
return pki.DeprecatedCertificateTemplateFromCertificateRequestAndAllowInsecureCSRUsageDefinition(cr)
}

return pki.CertificateTemplateFromCertificateRequest(cr)
},
signingFn: pki.SignCSRTemplate,
Expand Down
8 changes: 1 addition & 7 deletions pkg/controller/certificaterequests/selfsigned/selfsigned.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"

"github.com/cert-manager/cert-manager/internal/controller/feature"
internalinformers "github.com/cert-manager/cert-manager/internal/informers"
apiutil "github.com/cert-manager/cert-manager/pkg/api/util"
cmapi "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
Expand All @@ -39,7 +38,6 @@ import (
"github.com/cert-manager/cert-manager/pkg/issuer"
logf "github.com/cert-manager/cert-manager/pkg/logs"
cmerrors "github.com/cert-manager/cert-manager/pkg/util/errors"
utilfeature "github.com/cert-manager/cert-manager/pkg/util/feature"
"github.com/cert-manager/cert-manager/pkg/util/kube"
"github.com/cert-manager/cert-manager/pkg/util/pki"
"github.com/go-logr/logr"
Expand Down Expand Up @@ -150,11 +148,7 @@ func (s *SelfSigned) Sign(ctx context.Context, cr *cmapi.CertificateRequest, iss
}

var template *x509.Certificate
if !utilfeature.DefaultMutableFeatureGate.Enabled(feature.DisallowInsecureCSRUsageDefinition) {
template, err = pki.DeprecatedCertificateTemplateFromCertificateRequestAndAllowInsecureCSRUsageDefinition(cr)
} else {
template, err = pki.CertificateTemplateFromCertificateRequest(cr)
}
template, err = pki.CertificateTemplateFromCertificateRequest(cr)
if err != nil {
message := "Error generating certificate template"
s.reporter.Failed(cr, err, "ErrorGenerating", message)
Expand Down

0 comments on commit df16526

Please sign in to comment.