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

feat: bump Argo CD version to 2.2.2 #532

Merged
merged 2 commits into from
Jan 7, 2022
Merged

feat: bump Argo CD version to 2.2.2 #532

merged 2 commits into from
Jan 7, 2022

Conversation

iam-veeramalla
Copy link
Collaborator

Signed-off-by: iam-veeramalla abhishek.veeramalla@gmail.com

What type of PR is this?

/kind enhancement

What does this PR do / why we need it:
upgrades Argo CD to v2.2.2

Have you updated the necessary documentation?
NA

How to test changes / Special notes to the reviewer:

@chetan-rns
Copy link
Collaborator

@iam-veeramalla Should we update the CRDs for Application and AppProject?

@iam-veeramalla
Copy link
Collaborator Author

@iam-veeramalla Should we update the CRDs for Application and AppProject?

Thats a good one. Let me go and check :)

@wtam2018
Copy link
Collaborator

wtam2018 commented Jan 4, 2022

Please update.
build/util/Dockerfile
docs/reference/argocd.md
go.mod/go.sum

Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
@@ -680,15 +680,17 @@ func (r *ReconcileArgoCD) reconcileSSHKnownHosts(cr *argoprojv1a1.ArgoCD) error
// reconcileTLSCerts will ensure that the ArgoCD TLS Certs ConfigMap is present.
func (r *ReconcileArgoCD) reconcileTLSCerts(cr *argoprojv1a1.ArgoCD) error {
cm := newConfigMapWithName(common.ArgoCDTLSCertsConfigMapName, cr)
cm.Data = getInitialTLSCerts(cr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are the changes in configmap.go coming from?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are changes to reconciler logic. What amount of testing does it come with?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am equally surprised. I dont know why this unit test was failing.

The issue is coming from isObjectFound method but I dont see any changes made.

return !apierrors.IsNotFound(FetchObject(client, namespace, name, obj))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To be honest there is no change in the logic. It's mostly refactoring. So according to me no additional testing is needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Which unit test was failing?
The change of logic/behavior is that now it only sets controller owner reference when object does not exist (or when a new cm is created).

Copy link
Collaborator Author

@iam-veeramalla iam-veeramalla Jan 7, 2022

Choose a reason for hiding this comment

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

This is the failing unit test

TestReconcileArgoCD_reconcileTLSCerts_withUpdate

However, I figured out the root cause of the issue.

The reconciliation logic for reconcileTLSCerts currently works like this.

  1. creates a configmap object.
  2. gets the tls certificates from the Argo CD CR and updates the configmap object.
  3. it uses argoutil.IsObjectFound method to identify the existence of argocd-tls-certs-cm configmap in the kubernetes cluster.
  4. If the object exists, it updates the existing configmap with the tls certificates.

While this looks good,
The latest version of controller-runtime overrides the object instead of updating.
Please refer to the below PR.
kubernetes-sigs/controller-runtime#1651

So, we need to slightly modify the steps and verify the existence of configmap first.

Copy link
Collaborator Author

@iam-veeramalla iam-veeramalla Jan 7, 2022

Choose a reason for hiding this comment

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

The change of logic/behavior is that now it only sets controller owner reference when object does not exist (or when a new cm is created).

That makes sense as existing objects(configmaps) would already have the owner reference set.

Copy link
Collaborator

@wtam2018 wtam2018 Jan 7, 2022

Choose a reason for hiding this comment

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

kubernetes-sigs/controller-runtime#1651 is a fix to the fake client. The question is that is the current reconciler not doing the right thing and needs to be changed? If the fix to the fake client only affects testing, the failing test should be fixed.

@@ -962,6 +962,11 @@ func (r *ReconcileArgoCD) reconcileRepoDeployment(cr *argoprojv1a1.ArgoCD) error
desiredImage := getRepoServerContainerImage(cr)
if actualImage != desiredImage {
existing.Spec.Template.Spec.Containers[0].Image = desiredImage
if existing.Spec.Template.ObjectMeta.Labels == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this change also made due to a failing test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, It is made to fix the failing test. I will try to investigate more on what was the reason for unit test failure tomorrow and get back.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can only suspect it has something to do with the kubernetes client version update to 1.22.2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

However, I figured out the root cause of the issue.
The latest version of controller-runtime overrides the object instead of updating.

Please refer to the below PR.
kubernetes-sigs/controller-runtime#1651

@wtam2018 wtam2018 self-requested a review January 7, 2022 16:01
Copy link
Collaborator

@wtam2018 wtam2018 left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @iam-veeramalla

@wtam2018 wtam2018 merged commit d5c43dc into argoproj-labs:master Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants