Skip to content

Conversation

@bdimcheff
Copy link
Contributor

The gitlab api has a "managed" field to disable cluster management features when adding a kubernetes cluster. This implements that field. Default is true if you don't supply it.

This can only be toggled at cluster creation time, so changes will delete and readd the integration.

https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project

This also upgrades go-gitlab to an unreleased version that includes this field, which may be problematic.

I've run this fork for a few days successfully, and it has behaved as I expect it to.

@roidelapluie
Copy link
Collaborator

I would love to see more test coverage.

@ghost ghost added the documentation label May 24, 2019
@bdimcheff
Copy link
Contributor Author

@roidelapluie me too - I took a look and didn't see anything that was easy for me to base my tests off of. This field has similar semantics to "enabled", which is also untested. It is only usable in AddClusterOptions because it can only be set on create. Its value isn't exposed via the API, so there's no way to check if it was set properly. If there's another test from a different module that I should look at for ideas, let me know. I'm happy to try to write a test, I just couldn't figure out how to write a useful one.

@matejvelikonja
Copy link
Contributor

@bdimcheff you are correct. this is impossible to test. I had the same issues with enabled flag.

You cannot event read the value, so you cannot test if it changed correctly.

@matejvelikonja
Copy link
Contributor

matejvelikonja commented Jun 5, 2019

BTW: i suggest you remove the vendor update commit, update will be covered by #143

@bdimcheff
Copy link
Contributor Author

@matejvelikonja will do, thanks. Should I rebase it out or do you avoid force pushes to feature branches?

@ghost ghost added size/XL and removed size/M labels Jun 5, 2019
@bdimcheff
Copy link
Contributor Author

ok this is just a single commit on top of #143 now so the diff should be nice once that's merged.


* `enabled` - (Optional, boolean) Determines if cluster is active or not. Defaults to `true`.

* `managed` - (Optional, boolean) Determines if cluster is managed by gitlab or not. Defaults to `true`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make a comment that we can not read that value in the doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do. FYI: enabled works this way too, so I'll add it there too.

ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"enabled", "kubernetes_token"},
ImportStateVerifyIgnore: []string{"enabled", "kubernetes_token", "managed"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

how hard is it to add a test that creates a cluster managed and one unmanaged, even if we can not read the status?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I added a test but I'm not sure it really tests much

bdimcheff added 3 commits June 7, 2019 10:52
The gitlab api has a "managed" field to disable cluster management features when adding a kubernetes cluster. This implements that field. Default is true if you don't supply it.

This can only be toggled at cluster creation time, so changes will delete and readd the integration.

https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project
@ghost ghost added size/XS and removed size/XL labels Jun 7, 2019
@ghost ghost added size/S and removed size/XS labels Jun 7, 2019
@roidelapluie roidelapluie merged commit 469d355 into gitlabhq:master Jun 11, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

3 participants