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: Introduces Server-Side Apply as sync option #9711

Merged
merged 9 commits into from Aug 5, 2022

Conversation

leoluz
Copy link
Collaborator

@leoluz leoluz commented Jun 17, 2022

This PR implements the Server-Side Apply proposal.

Achieved goals:

Fix #2267
Fix #2268

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Signed-off-by: Leonardo Luz Almeida leonardo_almeida@intuit.com

@leoluz leoluz added this to the v2.5 milestone Jun 17, 2022
@leoluz leoluz requested a review from crenshaw-dev June 17, 2022 18:32
@codecov
Copy link

codecov bot commented Jun 17, 2022

Codecov Report

Merging #9711 (7310dd3) into master (02db022) will increase coverage by 0.09%.
The diff coverage is 41.17%.

@@            Coverage Diff             @@
##           master    #9711      +/-   ##
==========================================
+ Coverage   45.87%   45.96%   +0.09%     
==========================================
  Files         227      226       -1     
  Lines       27373    27382       +9     
==========================================
+ Hits        12556    12586      +30     
+ Misses      13113    13086      -27     
- Partials     1704     1710       +6     
Impacted Files Coverage Δ
cmd/argocd/commands/app.go 20.32% <0.00%> (-0.06%) ⬇️
controller/sync.go 56.09% <ø> (ø)
util/argo/managedfields/managed_fields.go 67.27% <ø> (+25.22%) ⬆️
controller/state.go 73.89% <33.33%> (-0.33%) ⬇️
util/argo/diff/diff.go 52.41% <60.00%> (+0.20%) ⬆️
util/db/gpgkeys.go 77.14% <0.00%> (-1.97%) ⬇️
util/gpg/gpg.go 66.96% <0.00%> (-1.25%) ⬇️
util/oidc/oidc.go 57.70% <0.00%> (+1.58%) ⬆️
pkg/apis/application/v1alpha1/app_project_types.go 59.61% <0.00%> (+5.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@EppO EppO mentioned this pull request Jun 20, 2022
10 tasks
@leoluz leoluz marked this pull request as draft June 22, 2022 17:30
@leoluz leoluz marked this pull request as ready for review June 30, 2022 21:50
@yeya24
Copy link
Contributor

yeya24 commented Jul 4, 2022

I enabled server side apply at the app level right now like below:

  syncPolicy:
    automated:
      prune: true
    syncOptions:
    - ServerSideApply=true

I also tried our service port case mentioned in #8812 (comment) but unfortunately, it doesn't work and threw error during diff phase. The error is:

image

Hopefully, the error would be helpful for you to troubleshoot. Thanks for the great work so far!

@leoluz
Copy link
Collaborator Author

leoluz commented Jul 25, 2022

I also tried our service port case mentioned in #8812 (comment) but unfortunately, it doesn't work and threw error during diff phase. The error is:

image

Hopefully, the error would be helpful for you to troubleshoot. Thanks for the great work so far!

Hi @yeya24, I created a test with your service example as part of argoproj/gitops-engine#418 and the test is passing. From the error message, it seems that there is something duplicated in your ports list. Can you please double check if you have duplicated ports with the same name?

@yeya24
Copy link
Contributor

yeya24 commented Jul 25, 2022

#8812 (comment)

I was using the same manifest but I still got this error. No duplicate port name.

apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  ports:
  - name: rtmpk
    port: 1986
    protocol: UDP
    targetPort: 1986
  - name: rtmp
    port: 1935
    targetPort: 1935
  - name: rtmpq
    port: 1935
    protocol: UDP
    targetPort: 1935
  - name: https
    port: 443
    targetPort: 443
  - name: http3
    port: 443
    protocol: UDP
    targetPort: 443

@leoluz
Copy link
Collaborator Author

leoluz commented Jul 25, 2022

I was using the same manifest but I still got this error. No duplicate port name.

Can you pls try applying this manifest and provide me the results?

apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  ports:
  - name: rtmpk
    port: 1986
    protocol: UDP
    targetPort: 1986
  - name: rtmp
    port: 1935
    protocol: TCP
    targetPort: 1935
  - name: rtmpq
    port: 1935
    protocol: UDP
    targetPort: 1935
  - name: https
    port: 443
    protocol: TCP
    targetPort: 443
  - name: http3
    port: 443
    protocol: UDP
    targetPort: 443

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@leoluz
Copy link
Collaborator Author

leoluz commented Jul 26, 2022

@yeya24 I rebased this branch with master, deployed locally and tested with #8812 (comment) and confirm that its working as expected. Can you please try again with this updated branch?

Btw, added an additional unit test to validate this exact case:
argoproj/gitops-engine@a956f80

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
go.mod Outdated
@@ -253,6 +253,9 @@ require (
)

replace (
// TODO release gitops-engine and remove the line bellow
github.com/argoproj/gitops-engine => github.com/leoluz/gitops-engine v0.4.1-0.20220725160058-77142a1d6e59

Choose a reason for hiding this comment

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

This can be updated now right? argoproj/gitops-engine#418

quite excited for this thanks for the awesome work @leoluz

Copy link
Collaborator Author

@leoluz leoluz Aug 3, 2022

Choose a reason for hiding this comment

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

@FabioAntunes Tks!
I just updated this branch to point to gitops-engine master.
It would be awesome if you can give this a try and provide us feedback.

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@crenshaw-dev crenshaw-dev merged commit 22a3b02 into argoproj:master Aug 5, 2022
@leoluz leoluz deleted the feat-ssa branch August 6, 2022 00:33
ashutosh16 pushed a commit to ashutosh16/argo-cd that referenced this pull request Aug 11, 2022
* feat: Introduces Server-Side Apply as sync option

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* add docs

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Implement the structured-merge diff when ssa is enabled

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* update gitops-engine

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* update gitops-engine

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* go mod tidy

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Add server-side apply option to the UI

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* update gitops-engine to master

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* fix live default values

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants