func NewEtcdClientCertSecret(e *v1alpha1.EtcdCluster, caSecret *corev1.Secret) (*corev1.Secret, error) {
	cert, key, err := GenerateCertAndKey(CertConfig{
		CommonName:  "root",
		CACert:      caSecret.Data[EtcdCACertName],
		CAKey:       caSecret.Data[EtcdCAKeyName],
		KeyUsage:    x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
		ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
		NotAfter:    time.Now().AddDate(10, 0, 0).UTC(),
	})
	if err != nil {
		return nil, err
	}
	secret := &corev1.Secret{
		ObjectMeta: v1.ObjectMeta{
			Namespace: e.Namespace,
			Name:      NameForEtcdCertSecret(e.Name, EtcdClientCert),
		},
		Data: map[string][]byte{
			EtcdCACertName:     caSecret.Data[EtcdCACertName],
			EtcdClientCertName: cert,
			EtcdClientKeyName:  key,
		},
	}
	controller.SetEtcdOwnerReference(&secret.ObjectMeta, e)

	return secret, nil
}
// NewEtcdClientCertSecret will generate a client certificate for connecting to etcd cluster
NewEtcdClientCertSecret will generate a client certificate for connecting to etcd cluster
// NewEtcdClientCertSecret will generate a client certificate for connecting to etcd cluster
func NewEtcdClientCertSecret(e *v1alpha1.EtcdCluster, caSecret *corev1.Secret) (*corev1.Secret, error) {
	cert, key, err := GenerateCertAndKey(CertConfig{
		CommonName:  "root",
		CACert:      caSecret.Data[EtcdCACertName],
		CAKey:       caSecret.Data[EtcdCAKeyName],
		KeyUsage:    x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
		ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
		NotAfter:    time.Now().AddDate(10, 0, 0).UTC(),
	})
	if err != nil {
		return nil, err
	}
	secret := &corev1.Secret{
		ObjectMeta: v1.ObjectMeta{
			Namespace: e.Namespace,
			Name:      NameForEtcdCertSecret(e.Name, EtcdClientCert),
		},
		Data: map[string][]byte{
			EtcdCACertName:     caSecret.Data[EtcdCACertName],
			EtcdClientCertName: cert,
			EtcdClientKeyName:  key,
		},
	}
	controller.SetEtcdOwnerReference(&secret.ObjectMeta, e)
	return secret, nil
}
func NewEtcdClientCertSecret ( e * v1alpha1 . EtcdCluster , caSecret * corev1 . Secret ) ( * corev1 . Secret , error ) { cert , key , err := GenerateCertAndKey ( CertConfig { CommonName : " " , CACert : caSecret . Data [ EtcdCACertName ] , CAKey : caSecret . Data [ EtcdCAKeyName ] , KeyUsage : x509 . KeyUsageKeyEncipherment | x509 . KeyUsageDigitalSignature , ExtKeyUsage : [ ] x509 . ExtKeyUsage { x509 . ExtKeyUsageClientAuth } , NotAfter : time . Now ( ) . AddDate ( 10 , 0 , 0 ) . UTC ( ) , } ) if err != nil { return nil , err } secret := & corev1 . Secret { ObjectMeta : v1 . ObjectMeta { Namespace : e . Namespace , Name : NameForEtcdCertSecret ( e . Name , EtcdClientCert ) , } , Data : map [ string ] [ ] byte { EtcdCACertName : caSecret . Data [ EtcdCACertName ] , EtcdClientCertName : cert , EtcdClientKeyName : key , } , } controller . SetEtcdOwnerReference ( & secret . ObjectMeta , e ) return secret , nil }
NewEtcdClientCertSecret will generate a client certificate for connecting to etcd cluster
NewEtcdClientCertSecret will generate a client certificate for connecting to etcd cluster