func (r *ReconcileArgoCD) reconcileClusterTLSSecret(cr *argoprojv1a1.ArgoCD) error {
	secret := argoutil.NewTLSSecret(cr.ObjectMeta, "tls")
	if argoutil.IsObjectFound(r.client, cr.Namespace, secret.Name, secret) {
		return nil // Secret found, do nothing
	}

	caSecret := argoutil.NewSecretWithSuffix(cr.ObjectMeta, "ca")
	caSecret, err := argoutil.FetchSecret(r.client, cr.ObjectMeta, caSecret.Name)
	if err != nil {
		return err
	}

	caCert, err := argoutil.ParsePEMEncodedCert(caSecret.Data[corev1.TLSCertKey])
	if err != nil {
		return err
	}

	caKey, err := argoutil.ParsePEMEncodedPrivateKey(caSecret.Data[corev1.TLSPrivateKeyKey])
	if err != nil {
		return err
	}

	secret, err = newCertificateSecret("tls", caCert, caKey, cr)
	if err != nil {
		return err
	}

	if err := controllerutil.SetControllerReference(cr, secret, r.scheme); err != nil {
		return err
	}

	return r.client.Create(context.TODO(), secret)
}
// reconcileClusterTLSSecret ensures the TLS Secret is created for the ArgoCD cluster.
reconcileClusterTLSSecret ensures the TLS Secret is created for the ArgoCD cluster.
// reconcileClusterTLSSecret ensures the TLS Secret is created for the ArgoCD cluster .
func (r *ReconcileArgoCD) reconcileClusterTLSSecret(cr *argoprojv1a1.ArgoCD) error {
	secret := argoutil.NewTLSSecret(cr.ObjectMeta, "tls")
	if argoutil.IsObjectFound(r.client, cr.Namespace, secret.Name, secret) {
		return nil 
	}
	caSecret := argoutil.NewSecretWithSuffix(cr.ObjectMeta, "ca")
	caSecret, err := argoutil.FetchSecret(r.client, cr.ObjectMeta, caSecret.Name)
	if err != nil {
		return err
	}
	caCert, err := argoutil.ParsePEMEncodedCert(caSecret.Data[corev1.TLSCertKey])
	if err != nil {
		return err
	}
	caKey, err := argoutil.ParsePEMEncodedPrivateKey(caSecret.Data[corev1.TLSPrivateKeyKey])
	if err != nil {
		return err
	}
	secret, err = newCertificateSecret("tls", caCert, caKey, cr)
	if err != nil {
		return err
	}
	if err := controllerutil.SetControllerReference(cr, secret, r.scheme); err != nil {
		return err
	}
	return r.client.Create(context.TODO(), secret)
}
func ( r * ReconcileArgoCD ) reconcileClusterTLSSecret ( cr * argoprojv1a1 . ArgoCD ) error { secret := argoutil . NewTLSSecret ( cr . ObjectMeta , " " ) if argoutil . IsObjectFound ( r . client , cr . Namespace , secret . Name , secret ) { return nil } caSecret := argoutil . NewSecretWithSuffix ( cr . ObjectMeta , " " ) caSecret , err := argoutil . FetchSecret ( r . client , cr . ObjectMeta , caSecret . Name ) if err != nil { return err } caCert , err := argoutil . ParsePEMEncodedCert ( caSecret . Data [ corev1 . TLSCertKey ] ) if err != nil { return err } caKey , err := argoutil . ParsePEMEncodedPrivateKey ( caSecret . Data [ corev1 . TLSPrivateKeyKey ] ) if err != nil { return err } secret , err = newCertificateSecret ( " " , caCert , caKey , cr ) if err != nil { return err } if err := controllerutil . SetControllerReference ( cr , secret , r . scheme ) ; err != nil { return err } return r . client . Create ( context . TODO ( ) , secret ) }
reconcileClusterTLSSecret ensures the TLS Secret is created for the ArgoCD cluster.
reconcileClusterTLSSecret ensures the TLS Secret is created for the ArgoCD cluster .
// Secret found, do nothing