Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code-refactoring: add secrets controller #1017

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1caabde
fix: don't set phase to available during host reconciliation (#918)
jaideepr97 Jul 20, 2023
4d09aca
update owners file (#953)
reginapizza Jul 26, 2023
45f3597
Move to only adding two roles for managed namespaces (#954)
selrahal Jul 26, 2023
c7cfa8c
feat: expose operator metrics (#928)
jaideepr97 Aug 1, 2023
89825db
add build.os config for readthedocs (#967)
reginapizza Aug 17, 2023
11299b7
setup 0.8.0 (#966)
reginapizza Aug 21, 2023
b25858d
feat: Add conversion webhook for ArgoCD v1alpha1 to v1beta1 migration…
svghadi Aug 21, 2023
c658019
chore(deps): bump pygments from 2.7.4 to 2.15.0 in /docs (#950)
dependabot[bot] Aug 22, 2023
e49612a
feat: upgrade RH-SSO from 7.5 to 7.6 (#977)
iam-veeramalla Aug 28, 2023
e624a26
refactor: Remove dead code (#979)
svghadi Aug 29, 2023
e928c0e
Replace ArgoCD v1alpha1 references with v1beta1 (#975)
svghadi Aug 29, 2023
380207e
refactor: Remove deprecated .spec.resourceCustomizations (#973)
svghadi Aug 30, 2023
f2f9fb4
upgrade ArgoCD version to 2.8.2 and update the CRDs (#984)
ishitasequeira Aug 30, 2023
8ddbce3
chore: Update ArgoCD v1alpha1 deprecation message (#988)
svghadi Sep 4, 2023
297702f
Add support for tls self signed certs in AppSet Gitlab SCM Provider (…
ishitasequeira Sep 6, 2023
64d5bb2
chore(deps): bump github.com/argoproj/argo-cd/v2 from 2.8.2 to 2.8.3 …
dependabot[bot] Sep 11, 2023
91bf131
feat: pick up argo cd v2.8.3 (#993)
iam-veeramalla Sep 11, 2023
cd7a54b
fix: replace deprecated syntax in kustomization.yaml (#1000)
minchao Sep 25, 2023
aa6ab4e
Missing syntax-highlighting, toggle button for screen mode in argocd-…
surajyadav1108 Sep 25, 2023
75d6cf4
fix: keycloak probes failure and intermittent perforamance issues (#1…
iam-veeramalla Sep 26, 2023
43417be
resolve all merge conflicts
jaideepr97 Sep 27, 2023
7c12e38
fix broken references and update v1beta1 references
jaideepr97 Sep 27, 2023
cf82e5d
update missed references to argoproj
jaideepr97 Sep 27, 2023
520cdca
revert v1beta1 alias to argoproj
jaideepr97 Sep 27, 2023
7d22415
update more v1beta1 references to argoproj
jaideepr97 Sep 27, 2023
7d8f070
add argoprojv1alpha1 alias to v1alpha1 for naming consistency
jaideepr97 Sep 27, 2023
97c92d8
address review comments
jaideepr97 Sep 28, 2023
6768922
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Sep 28, 2023
a65b5ec
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Oct 5, 2023
6a9f6e8
add secrets controller
jaideepr97 Oct 10, 2023
00b7fe3
Merge branch 'operator-redesign' of github.com:argoproj-labs/argocd-o…
jaideepr97 Oct 10, 2023
069d50c
restore argo-cd crd
jaideepr97 Oct 10, 2023
3c86bce
fix argo-cd crd
jaideepr97 Oct 10, 2023
d730cdd
update tests
jaideepr97 Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions common/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const (
// ArgoCDRBACConfigMapName is the upstream hard-coded RBAC ConfigMap name.
ArgoCDRBACConfigMapName = "argocd-rbac-cm"

// ArgoCDSecretName is the upstream hard-coded ArgoCD Secret name.
ArgoCDSecretName = "argocd-secret"

// ArgoCDTLSCertsConfigMapName is the upstream hard-coded TLS certificate data ConfigMap name.
ArgoCDTLSCertsConfigMapName = "argocd-tls-certs-cm"

Expand All @@ -50,6 +47,12 @@ const (
// ArgoCDCASuffix is the name suffix for ArgoCD CA resources.
ArgoCDCASuffix = "ca"

// ArgoCDGRPCSuffix is the name suffix for ArgoCD GRPC resources.
ArgoCDGRPCSuffix = "grpc"

// ArgoCDTLSSuffix is the name suffix for ArgoCD TLS resources.
ArgoCDTLSSuffix = "tls"

// ArgoCDGrafanaConfigMapSuffix is the default suffix for the Grafana configuration ConfigMap.
ArgoCDGrafanaConfigMapSuffix = "grafana-config"

Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19260,4 +19260,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
23 changes: 23 additions & 0 deletions controllers/argocd/argocdcommon/argohelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/pkg/util"
"github.com/sethvargo/go-password/password"
)

func GetArgoContainerImage(cr *argoproj.ArgoCD) string {
Expand All @@ -27,3 +28,25 @@ func GetArgoContainerImage(cr *argoproj.ArgoCD) string {

return util.CombineImageTag(img, tag)
}

// GenerateArgoAdminPassword will generate and return the admin password for Argo CD.
func GenerateArgoAdminPassword() ([]byte, error) {
pass, err := password.Generate(
common.ArgoCDDefaultAdminPasswordLength,
common.ArgoCDDefaultAdminPasswordNumDigits,
common.ArgoCDDefaultAdminPasswordNumSymbols,
false, false)

return []byte(pass), err
}

// GenerateArgoServerKey will generate and return the server signature key for session validation.
func GenerateArgoServerSessionKey() ([]byte, error) {
pass, err := password.Generate(
common.ArgoCDDefaultServerSessionKeyLength,
common.ArgoCDDefaultServerSessionKeyNumDigits,
common.ArgoCDDefaultServerSessionKeyNumSymbols,
false, false)

return []byte(pass), err
}
12 changes: 12 additions & 0 deletions controllers/argocd/argocdcommon/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ func UpdateIfChanged(existingVal, desiredVal interface{}, extraAction func(), ch
*changed = true
}
}

func UpdateIfChangedSlice(existingVal, desiredVal interface{}, extraAction func(), changed *bool) (interface{}, interface{}) {
if !reflect.DeepEqual(existingVal, desiredVal) {
existingVal = desiredVal
if extraAction != nil {
extraAction()
}
*changed = true
}

return existingVal, desiredVal
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why desiredVal is needed in the returnn?

}
2 changes: 1 addition & 1 deletion controllers/argocd/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ func (r *ArgoCDReconciler) triggerDeploymentRollout(deployment *appsv1.Deploymen
return nil
}

deployment.Spec.Template.ObjectMeta.Labels[key] = nowNano()
deployment.Spec.Template.ObjectMeta.Labels[key] = util.NowNano()
return r.Client.Update(context.TODO(), deployment)
}

Expand Down
9 changes: 5 additions & 4 deletions controllers/argocd/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/controllers/argocd/secret"
"github.com/argoproj-labs/argocd-operator/pkg/util"
)

Expand Down Expand Up @@ -150,7 +151,7 @@ func (r *ArgoCDReconciler) reconcileArgoServerIngress(cr *argoproj.ArgoCD) error
Hosts: []string{
getArgoServerHost(cr),
},
SecretName: common.ArgoCDSecretName,
SecretName: secret.ArgoCDSecretName,
},
}

Expand Down Expand Up @@ -225,7 +226,7 @@ func (r *ArgoCDReconciler) reconcileArgoServerGRPCIngress(cr *argoproj.ArgoCD) e
Hosts: []string{
getArgoServerGRPCHost(cr),
},
SecretName: common.ArgoCDSecretName,
SecretName: secret.ArgoCDSecretName,
},
}

Expand Down Expand Up @@ -302,7 +303,7 @@ func (r *ArgoCDReconciler) reconcileGrafanaIngress(cr *argoproj.ArgoCD) error {
cr.Name,
getGrafanaHost(cr),
},
SecretName: common.ArgoCDSecretName,
SecretName: secret.ArgoCDSecretName,
},
}

Expand Down Expand Up @@ -376,7 +377,7 @@ func (r *ArgoCDReconciler) reconcilePrometheusIngress(cr *argoproj.ArgoCD) error
ingress.Spec.TLS = []networkingv1.IngressTLS{
{
Hosts: []string{cr.Name},
SecretName: common.ArgoCDSecretName,
SecretName: secret.ArgoCDSecretName,
},
}

Expand Down
3 changes: 2 additions & 1 deletion controllers/argocd/keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/controllers/argocd/secret"
"github.com/argoproj-labs/argocd-operator/pkg/cluster"
util "github.com/argoproj-labs/argocd-operator/pkg/util"
"github.com/argoproj-labs/argocd-operator/pkg/workloads"
Expand Down Expand Up @@ -1060,7 +1061,7 @@ func (r *ArgoCDReconciler) updateArgoCDConfiguration(cr *argoproj.ArgoCD, kRoute
// Update the ArgoCD client secret for OIDC in argocd-secret.
argoCDSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: common.ArgoCDSecretName,
Name: secret.ArgoCDSecretName,
Namespace: cr.Namespace,
},
}
Expand Down
Loading
Loading