Make the validity period of cert configurable
Signed-off-by: lonelyCZ <chengzhe@zju.edu.cn>
This commit is contained in:
parent
4641e88fd2
commit
680b05264a
|
@ -8,6 +8,7 @@ import (
|
|||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
|
||||
"github.com/karmada-io/karmada/pkg/karmadactl/cmdinit/cert"
|
||||
"github.com/karmada-io/karmada/pkg/karmadactl/cmdinit/kubernetes"
|
||||
"github.com/karmada-io/karmada/pkg/karmadactl/util"
|
||||
"github.com/karmada-io/karmada/pkg/version"
|
||||
|
@ -102,6 +103,7 @@ func NewCmdInit(parentCommand string) *cobra.Command {
|
|||
// cert
|
||||
flags.StringVar(&opts.ExternalIP, "cert-external-ip", "", "the external IP of Karmada certificate (e.g 192.168.1.2,172.16.1.2)")
|
||||
flags.StringVar(&opts.ExternalDNS, "cert-external-dns", "", "the external DNS of Karmada certificate (e.g localhost,localhost.com)")
|
||||
flags.DurationVar(&opts.CertValidity, "cert-validity-period", cert.Duration365d, "the validity period of Karmada certificate (e.g 8760h0m0s, that is 365 days)")
|
||||
// Kubernetes
|
||||
flags.StringVarP(&opts.Namespace, "namespace", "n", "karmada-system", "Kubernetes namespace")
|
||||
flags.StringVar(&opts.StorageClassesName, "storage-classes-name", "", "Kubernetes StorageClasses Name")
|
||||
|
|
|
@ -121,6 +121,7 @@ type CommandInitOption struct {
|
|||
CRDs string
|
||||
ExternalIP string
|
||||
ExternalDNS string
|
||||
CertValidity time.Duration
|
||||
KubeClientSet kubernetes.Interface
|
||||
CertAndKeyFileData map[string][]byte
|
||||
RestConfig *rest.Config
|
||||
|
@ -218,7 +219,7 @@ func initializeDirectory(path string) error {
|
|||
|
||||
// genCerts create ca etcd karmada cert
|
||||
func (i *CommandInitOption) genCerts() error {
|
||||
notAfter := time.Now().Add(cert.Duration365d).UTC()
|
||||
notAfter := time.Now().Add(i.CertValidity).UTC()
|
||||
|
||||
etcdServerCertDNS := []string{
|
||||
"localhost",
|
||||
|
|
Loading…
Reference in New Issue