func newCertificateSecret(suffix string, caCert *x509.Certificate, caKey *rsa.PrivateKey, cr *argoprojv1a1.ArgoCD) (*corev1.Secret, error) {
	secret := argoutil.NewTLSSecret(cr.ObjectMeta, suffix)

	key, err := argoutil.NewPrivateKey()
	if err != nil {
		return nil, err
	}

	cfg := &tlsutil.CertConfig{
		CertName:     secret.Name,
		CertType:     tlsutil.ClientAndServingCert,
		CommonName:   secret.Name,
		Organization: []string{cr.ObjectMeta.Namespace},
	}

	dnsNames := []string{
		cr.ObjectMeta.Name,
		nameWithSuffix("grpc", cr),
		fmt.Sprintf("%s.%s.svc.cluster.local", cr.ObjectMeta.Name, cr.ObjectMeta.Namespace),
	}

	if cr.Spec.Grafana.Enabled {
		dnsNames = append(dnsNames, getGrafanaHost(cr))
	}
	if cr.Spec.Prometheus.Enabled {
		dnsNames = append(dnsNames, getPrometheusHost(cr))
	}

	cert, err := argoutil.NewSignedCertificate(cfg, dnsNames, key, caCert, caKey)
	if err != nil {
		return nil, err
	}

	secret.Data = map[string][]byte{
		corev1.TLSCertKey:       argoutil.EncodeCertificatePEM(cert),
		corev1.TLSPrivateKeyKey: argoutil.EncodePrivateKeyPEM(key),
	}

	return secret, nil
}
// newCertificateSecret creates a new secret using the given name suffix for the given TLS certificate.
newCertificateSecret creates a new secret using the given name suffix for the given TLS certificate.
// newCertificateSecret creates a new secret using the given name suffix for the given TLS certificate .
func newCertificateSecret(suffix string, caCert *x509.Certificate, caKey *rsa.PrivateKey, cr *argoprojv1a1.ArgoCD) (*corev1.Secret, error) {
	secret := argoutil.NewTLSSecret(cr.ObjectMeta, suffix)
	key, err := argoutil.NewPrivateKey()
	if err != nil {
		return nil, err
	}
	cfg := &tlsutil.CertConfig{
		CertName:     secret.Name,
		CertType:     tlsutil.ClientAndServingCert,
		CommonName:   secret.Name,
		Organization: []string{cr.ObjectMeta.Namespace},
	}
	dnsNames := []string{
		cr.ObjectMeta.Name,
		nameWithSuffix("grpc", cr),
		fmt.Sprintf("%s.%s.svc.cluster.local", cr.ObjectMeta.Name, cr.ObjectMeta.Namespace),
	}
	if cr.Spec.Grafana.Enabled {
		dnsNames = append(dnsNames, getGrafanaHost(cr))
	}
	if cr.Spec.Prometheus.Enabled {
		dnsNames = append(dnsNames, getPrometheusHost(cr))
	}
	cert, err := argoutil.NewSignedCertificate(cfg, dnsNames, key, caCert, caKey)
	if err != nil {
		return nil, err
	}
	secret.Data = map[string][]byte{
		corev1.TLSCertKey:       argoutil.EncodeCertificatePEM(cert),
		corev1.TLSPrivateKeyKey: argoutil.EncodePrivateKeyPEM(key),
	}
	return secret, nil
}
func newCertificateSecret ( suffix string , caCert * x509 . Certificate , caKey * rsa . PrivateKey , cr * argoprojv1a1 . ArgoCD ) ( * corev1 . Secret , error ) { secret := argoutil . NewTLSSecret ( cr . ObjectMeta , suffix ) key , err := argoutil . NewPrivateKey ( ) if err != nil { return nil , err } cfg := & tlsutil . CertConfig { CertName : secret . Name , CertType : tlsutil . ClientAndServingCert , CommonName : secret . Name , Organization : [ ] string { cr . ObjectMeta . Namespace } , } dnsNames := [ ] string { cr . ObjectMeta . Name , nameWithSuffix ( " " , cr ) , fmt . Sprintf ( " " , cr . ObjectMeta . Name , cr . ObjectMeta . Namespace ) , } if cr . Spec . Grafana . Enabled { dnsNames = append ( dnsNames , getGrafanaHost ( cr ) ) } if cr . Spec . Prometheus . Enabled { dnsNames = append ( dnsNames , getPrometheusHost ( cr ) ) } cert , err := argoutil . NewSignedCertificate ( cfg , dnsNames , key , caCert , caKey ) if err != nil { return nil , err } secret . Data = map [ string ] [ ] byte { corev1 . TLSCertKey : argoutil . EncodeCertificatePEM ( cert ) , corev1 . TLSPrivateKeyKey : argoutil . EncodePrivateKeyPEM ( key ) , } return secret , nil }
newCertificateSecret creates a new secret using the given name suffix for the given TLS certificate.
newCertificateSecret creates a new secret using the given name suffix for the given TLS certificate .