-
Notifications
You must be signed in to change notification settings - Fork 273
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
k8sClient get resources across all namespaces (#601) #854
k8sClient get resources across all namespaces (#601) #854
Conversation
Great! Maybe you can consider reusing the |
It does make sense to wanting to align the functionality to ArgoCD itself. AIU is effectively following that featureset, as we're seeing here with the 'app in any namespace' feature. If we go for this approach, a fair amount of change is needed;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jortkoopmans @wd I was thinking about keeping this PR focused on fixing the currently broken apps-in-any-namespace feature and adding wildcard support in a separate PR. WDYT?
I reviewed and tested the PR in regards to fixing the currently broken apps-in-any-namespace feature and changes look good. However, the unit tests still need to be fixed.
@ishitasequeira I'm good with that. I'm just trying to bring information from Argo here. |
@wd, It's a good callout for sure and something which can be looked into as a next step forward for the feature. @jortkoopmans, let me know if you need any help in fixing the unit tests. |
- Modify ks8Client functions to always get Application resources across all namespaces - Add required RBAC permissions Signed-off-by: Jort Koopmans <[email protected]>
6c9e2ee
to
4902053
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #854 +/- ##
==========================================
+ Coverage 75.53% 75.94% +0.41%
==========================================
Files 31 31
Lines 3151 3184 +33
==========================================
+ Hits 2380 2418 +38
+ Misses 636 633 -3
+ Partials 135 133 -2 ☔ View full report in Codecov by Sentry. |
Fix UpdateSpec to handle partial updates without specified appNamespace Fix tests to work with Applications across namespaces Signed-off-by: Jort Koopmans <[email protected]>
2748faa
to
d440337
Compare
- Error wrapping for improved reporting in higher-lvl code - Change UpdateSpec retry to stop trying, with exponential backoff - Add and enhance tests. Improve code coverage. Signed-off-by: Jort Koopmans <[email protected]>
Thank you for the feedback and guidance @wd @ishitasequeira . It turned out that some of the functions strictly require a namespace to be provided, I have modified several functions to deal with this correctly (and introduce some helper functions). Specifically:
For my use case, I only need AIU to monitor the Applications (ListApplications) across namespaces, since I use it exclusively to overwrite the sha256 image hashes (and not Get or Update the Application spec). This is probably why it worked for me previously (?). Subsequently I refactored and extended some of the tests. But feel free to amend or change this. Lastly, while testing I noticed that retrying on conflict is perpetual, I implemented maxRetries and exponential backoff to resolve that. |
I see that we have related efforts between this PR and #831 , based on different solution directions. Just noting it here so it can be taken into account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jortkoopmans left some comments
@jannfis @chengfang @pasha-codefresh any concerns on this approach?
} | ||
|
||
// Retrieve the application in the specified namespace | ||
return client.kubeClient.ApplicationsClientset.ArgoprojV1alpha1().Applications(app.Namespace).Get(ctx, app.Name, v1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to retrieve the application again, as it should be already retrieved as part of appList, err := client.ListApplications("")
?
if overrideRetries, ok := os.LookupEnv("OVERRIDE_MAX_RETRIES"); ok { | ||
var retries int | ||
if _, err := fmt.Sscanf(overrideRetries, "%d", &retries); err == nil { | ||
maxRetries = retries | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jortkoopmans did you get a chance to look at the comments?
Signed-off-by: Ishita Sequeira <[email protected]>
Signed-off-by: Ishita Sequeira <[email protected]>
Sorry for my late response, but thank you @ishitasequeira and @chengfang for pushing this forward. It could be that I need to modify some of the ignore rules for argo-cd itself to avoid fights between them, but previously it worked. Outlining my configuration just for clarity:
Logs of 2 (redacted) update cycles (this goes on indefinitely):
The tree(/parent) App has these settings:
The leaf app with the helm chart in it has:
Unfortunately the same happens when using the now merged code on master (which includes some refactoring, nice work!), for my particular use case. |
…goproj-labs#854) Signed-off-by: Jort Koopmans <[email protected]> Signed-off-by: Tchoupinax <[email protected]>
Signed-off-by: Ishita Sequeira <[email protected]> Signed-off-by: Tchoupinax <[email protected]>
Work in progress. Updating Applications using this branch works for me, when the RBAC permissions are configured. (#601)
However, there are several considerations;