-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(argocd_cluster): use cluster list api to avoid 403 issues with cluster get api at cluster read time #399
fix(argocd_cluster): use cluster list api to avoid 403 issues with cluster get api at cluster read time #399
Conversation
d2ffd2a
to
d5d059c
Compare
…uster get api at cluster read time Signed-off-by: Hugo HARS <[email protected]>
d5d059c
to
ca58239
Compare
@onematchfox PR is ready to be reviewed :) |
any chance to have this released as new version of the provider? This seems to be a blocker when using the provider with recent ArgoCD versions |
This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
... |
This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
... |
This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
... |
This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
... |
This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
. |
@@ -53,6 +56,7 @@ func resourceArgoCDClusterCreate(ctx context.Context, d *schema.ResourceData, me | |||
return errorToDiagnostics(fmt.Sprintf("failed to list existing clusters when creating cluster %s", cluster.Server), err) | |||
} | |||
|
|||
// Here we will filter ourselves on the list so that we are backward compatible for argo-cd server with version < v2.8.0 (see coment above) |
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.
Do we need backward compat to versions below 2.8? That is outside of our promise, no?
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.
As mentioned In my review I don't think we need that compat, but since it's already coded in a way that doesn't harm we should leave it as is so far.
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.
LGTM, I like the way it was implemented for backwards-compatibility, although I don't think we need to implement backwards-compatibility to unsupported Argo CD versions in other places, it's already there so we should give it a go ;).
@onematchfox anything needed from your side? |
Signed-off-by: Marco Maurer (-Kilchhofer) <[email protected]>
Signed-off-by: Nathanael Liechti <[email protected]>
This PR fixes #266
Coded it with below comment in mind, meaning it is backward compatible: #266 (comment)
Get
as usual first (legacy code)PermissionDenied
error (i.e.403
) the fix is triggered (in a backward compatible way for servers <v2.8
, see below)In that case a call is issued to the
List
api, reusing some code used for create cluster existence checks (that already uses thisList
api). Noe that this code is able to filter the cluster in the resulting list if not yet done by the ArgoCD server (servers filtering onList
api does not work if <v2.8
, see comments in linked issue and/or in the code ccomments)Also added a non-regression test to validate a server-side deletion of the cluster triggers the fix.