diff --git a/cmd/cainjector/app/start.go b/cmd/cainjector/app/start.go index 0880e642c..86e5d7544 100644 --- a/cmd/cainjector/app/start.go +++ b/cmd/cainjector/app/start.go @@ -39,6 +39,7 @@ import ( "github.com/jetstack/cert-manager/pkg/util/profiling" ) +// InjectorControllerOptions is a struct having injector controller options values type InjectorControllerOptions struct { Namespace string LeaderElect bool @@ -60,6 +61,7 @@ type InjectorControllerOptions struct { log logr.Logger } +// AddFlags adds the various flags for injector controller options func (o *InjectorControllerOptions) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&o.Namespace, "namespace", "", ""+ "If set, this limits the scope of cainjector to a single namespace. "+ @@ -88,6 +90,7 @@ func (o *InjectorControllerOptions) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&o.PprofAddr, "profiler-address", cmdutil.DefaultProfilerAddr, "Address of the Go profiler (pprof) if enabled. This should never be exposed on a public interface.") } +// NewInjectorControllerOptions returns a new InjectorControllerOptions func NewInjectorControllerOptions(out, errOut io.Writer) *InjectorControllerOptions { o := &InjectorControllerOptions{ StdOut: out, diff --git a/cmd/ctl/pkg/create/create.go b/cmd/ctl/pkg/create/create.go index b81e0bccc..5a062ca42 100644 --- a/cmd/ctl/pkg/create/create.go +++ b/cmd/ctl/pkg/create/create.go @@ -32,7 +32,7 @@ func NewCmdCreate(ctx context.Context, ioStreams genericclioptions.IOStreams) *c return cmds } -// Create a bare Create Command, without any subcommands +// NewCmdCreateBare creates a bare Create Command, without any subcommands func NewCmdCreateBare() *cobra.Command { return &cobra.Command{ Use: "create", diff --git a/cmd/ctl/pkg/factory/validargs.go b/cmd/ctl/pkg/factory/validargs.go index 9fd6b9e86..48b1d1a18 100644 --- a/cmd/ctl/pkg/factory/validargs.go +++ b/cmd/ctl/pkg/factory/validargs.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// ValidArgsCertificates returns a cobra ValidArgsFunction for listing Certificates. +// ValidArgsListCertificates returns a cobra ValidArgsFunction for listing Certificates. func ValidArgsListCertificates(ctx context.Context, factory **Factory) func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { if len(args) > 0 { @@ -49,7 +49,7 @@ func ValidArgsListCertificates(ctx context.Context, factory **Factory) func(_ *c } } -// ValidArgsSecrets returns a cobra ValidArgsFunction for listing Secrets. +// ValidArgsListSecrets returns a cobra ValidArgsFunction for listing Secrets. func ValidArgsListSecrets(ctx context.Context, factory **Factory) func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { if len(args) > 0 { @@ -75,7 +75,7 @@ func ValidArgsListSecrets(ctx context.Context, factory **Factory) func(_ *cobra. } } -// ValidArgsCertificateSigningRequests returns a cobra ValidArgsFunction for +// ValidArgsListCertificateSigningRequests returns a cobra ValidArgsFunction for // listing CertificateSigningRequests. func ValidArgsListCertificateSigningRequests(ctx context.Context, factory **Factory) func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { @@ -102,7 +102,7 @@ func ValidArgsListCertificateSigningRequests(ctx context.Context, factory **Fact } } -// ValidArgsCertificateRequests returns a cobra ValidArgsFunction for listing +// ValidArgsListCertificateRequests returns a cobra ValidArgsFunction for listing // CertificateRequests. func ValidArgsListCertificateRequests(ctx context.Context, factory **Factory) func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { return func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { diff --git a/pkg/api/util/kube.go b/pkg/api/util/kube.go index b23a0bf37..abab8f234 100644 --- a/pkg/api/util/kube.go +++ b/pkg/api/util/kube.go @@ -78,7 +78,7 @@ func KubeKeyUsageStrings(usage x509.KeyUsage) []certificatesv1.KeyUsage { return usageStr } -// ExtKeyUsageStrings returns the certificatesv1.KeyUsage and "unknown" if not found +// KubeExtKeyUsageStrings returns the certificatesv1.KeyUsage and "unknown" if not found func KubeExtKeyUsageStrings(usage []x509.ExtKeyUsage) []certificatesv1.KeyUsage { var usageStr []certificatesv1.KeyUsage diff --git a/pkg/apis/certmanager/v1/types.go b/pkg/apis/certmanager/v1/types.go index dcff5a37a..dc3ce3e2a 100644 --- a/pkg/apis/certmanager/v1/types.go +++ b/pkg/apis/certmanager/v1/types.go @@ -57,15 +57,15 @@ const ( ) const ( - // issuerNameAnnotation can be used to override the issuer specified on the - // created Certificate resource. + // IngressIssuerNameAnnotationKey holds the issuerNameAnnotation value which can be + // used to override the issuer specified on the created Certificate resource. IngressIssuerNameAnnotationKey = "cert-manager.io/issuer" - // clusterIssuerNameAnnotation can be used to override the issuer specified on the - // created Certificate resource. The Certificate will reference the - // specified *ClusterIssuer* instead of normal issuer. + // IngressClusterIssuerNameAnnotationKey holds the clusterIssuerNameAnnotation value which + // can be used to override the issuer specified on the created Certificate resource. The Certificate + // will reference the specified *ClusterIssuer* instead of normal issuer. IngressClusterIssuerNameAnnotationKey = "cert-manager.io/cluster-issuer" - // acmeIssuerHTTP01IngressClassAnnotation can be used to override the http01 ingressClass - // if the challenge type is set to http01 + // IngressACMEIssuerHTTP01IngressClassAnnotationKey holds the acmeIssuerHTTP01IngressClassAnnotation value + // which can be used to override the http01 ingressClass if the challenge type is set to http01 IngressACMEIssuerHTTP01IngressClassAnnotationKey = "acme.cert-manager.io/http01-ingress-class" // IngressClassAnnotationKey picks a specific "class" for the Ingress. The @@ -110,7 +110,7 @@ const ( // as namespace/name. The certificate is expected to have the is-serving-for annotations. WantInjectAnnotation = "cert-manager.io/inject-ca-from" - // WantInjectAPIServerCAAnnotation, if set to "true", will make the cainjector + // WantInjectAPIServerCAAnnotation will - if set to "true" - make the cainjector // inject the CA certificate for the Kubernetes apiserver into the resource. // It discovers the apiserver's CA by inspecting the service account credentials // mounted into the cainjector pod. diff --git a/pkg/controller/certificatesigningrequests/selfsigned/selfsigned.go b/pkg/controller/certificatesigningrequests/selfsigned/selfsigned.go index a4963b846..3d35cb97b 100644 --- a/pkg/controller/certificatesigningrequests/selfsigned/selfsigned.go +++ b/pkg/controller/certificatesigningrequests/selfsigned/selfsigned.go @@ -44,6 +44,7 @@ import ( ) const ( + // CSRControllerName holds the controller name CSRControllerName = "certificatesigningrequests-issuer-selfsigned" ) @@ -72,6 +73,7 @@ func init() { }) } +// NewSelfSigned returns a new instance of SelfSigned type func NewSelfSigned(ctx *controllerpkg.Context) *SelfSigned { return &SelfSigned{ issuerOptions: ctx.IssuerOptions, diff --git a/pkg/issuer/acme/dns/clouddns/clouddns.go b/pkg/issuer/acme/dns/clouddns/clouddns.go index 2f4c6f339..353c3b587 100644 --- a/pkg/issuer/acme/dns/clouddns/clouddns.go +++ b/pkg/issuer/acme/dns/clouddns/clouddns.go @@ -36,6 +36,7 @@ type DNSProvider struct { log logr.Logger } +// NewDNSProvider returns a new DNSProvider Instance with configuration func NewDNSProvider(project string, saBytes []byte, dns01Nameservers []string, ambient bool, hostedZoneName string) (*DNSProvider, error) { // project is a required field if project == "" { diff --git a/pkg/issuer/vault/vault.go b/pkg/issuer/vault/vault.go index 17642e41f..ff2196e6c 100644 --- a/pkg/issuer/vault/vault.go +++ b/pkg/issuer/vault/vault.go @@ -25,6 +25,7 @@ import ( "github.com/jetstack/cert-manager/pkg/issuer" ) +// Vault Issuer for the certificate authority of Vault type Vault struct { *controller.Context issuer v1.GenericIssuer @@ -37,6 +38,7 @@ type Vault struct { resourceNamespace string } +// NewVault returns a new Vault func NewVault(ctx *controller.Context, issuer v1.GenericIssuer) (issuer.Interface, error) { secretsLister := ctx.KubeSharedInformerFactory.Core().V1().Secrets().Lister() diff --git a/pkg/util/pki/kube.go b/pkg/util/pki/kube.go index 86d44dbc0..5ba4bc04b 100644 --- a/pkg/util/pki/kube.go +++ b/pkg/util/pki/kube.go @@ -68,6 +68,7 @@ func DurationFromCertificateSigningRequest(csr *certificatesv1.CertificateSignin return duration, nil } +// BuildKeyUsagesKube returns a key usage and extended key usage of the x509 certificate func BuildKeyUsagesKube(usages []certificatesv1.KeyUsage) (x509.KeyUsage, []x509.ExtKeyUsage, error) { var unk []certificatesv1.KeyUsage if len(usages) == 0 {