-
Notifications
You must be signed in to change notification settings - Fork 11
[CLOUDP-332196] Move kubectl-mongodb
plugin to cmd
dir for atomic releases
#271
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
base: master
Are you sure you want to change the base?
Conversation
198327f
to
de60a3e
Compare
…ster This commit moves the source code of mongodb kubectl plugin from `public/tools/multicluster` to `cmd` directory. This is to align with how go code that ships a CLI is structured. The command/subcommand building logic is moved to the `cmd` directory and and rest of the logic The command/subcommand building logic is moved to the `cmd` directory and and rest of the logic is moved to the new package `pkg/kubectl-mongodb`. This commit also moves the `.goreleaser.yaml` to the root of the project because kubectl plugin is now at the root of the project.
de60a3e
to
02b94d0
Compare
1. Since most of our evergreen config files are in root of the repo and now that kubectl plugin is also moved to `cmd/` it makes sense to move the evergreen config file to the root of repo with correct name. 2. Change the goreleaser config file to version 1. We upgraded it temporarily to version 2 but CI complains that only version 1 is supported.
94fab09
to
1884f19
Compare
The evergreen function `build_multi_cluster_binary` is used to build the `kubectl-mongodb` plugin. And this function gets used in the main `.evergreen.yml` file to build the `kubectl-mongodb` binary. Since we moved the location of the source files for `kubectl-mongodb` plugin as part of [PR](#271), this PR makes respective changes in the evergreen function so that it can properly build the `kubectl-mongodb` plugin from the new location.
Thanks for very well documented PR! Some general notes:
|
Thank you for the feedback @MaciejKaras.
Right, we knew think is going to happen and I have raised the change as part of the other PR #275 which is based on this PR, to make things easy to review. I will work on other comments. |
kubectl-mongodb
plugin to cmd
dir for atomic releaseskubectl-mongodb
plugin to cmd
dir for atomic releases
…to correct kubectl-mongodb root
Since we moved the code of `kubectl-mongodb` plugin to `cmd/` we needed to move the licenses files to the new location. This commit does that.
@MaciejKaras can you please have a look into this PR again? |
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.
The refactor looks really good!
Please also check and update old multicluster
usages in other files. Examples I found:
mongodb-kubernetes/.dockerignore
Line 57 in 12d1b90
!/public/tools/multicluster/go.mod Line 6 in 896db65
public/tools/multicluster/vendor mongodb-kubernetes/.evergreen-functions.yml
Line 667 in 0f58ef3
files: [ "src/github.com/mongodb/mongodb-kubernetes/*.suite", "src/github.com/mongodb/mongodb-kubernetes/public/tools/multicluster/*.suite", "src/github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/*.suite" ] mongodb-kubernetes/public/samples/multi-cluster-cli-gitops/README.md
Lines 15 to 22 in ccf22c8
### Build the multi-cluster CLI image You can build a minimal image containing the CLI executable using the `Dockerfile` [provided in this repo](./../../tools/multicluster/Dockerfile). ``` shell git clone https://github.com/mongodb/mongodb-kubernetes cd mongodb-kubernetes/public/tools/multicluster docker build . -t "your-registry/multi-cluster-cli:latest" docker push "your-registry/multi-cluster-cli:latest" ```
Summary
In the efforts towards atomic releases this PR tries to move the
kubectl-mongodb
plugin code from the directorypublic/tools/multicluster
to the root of the projectcmd/
. This is to align the project with how other Go based projects are structured.Apart from that this PR also moves the
.goreleaser.yaml
for thekubectl-mongodb
plugin frompublic/tools/multicluster/.goreleaser.yaml
directory to the root of the repo. This is also done in order to align how.goreleaser.yaml
is kept in other Go based opensource projects.This PR also moves the evergreen file that releases
kubectl-mongodb
plugin from the locationpublic/.evergreen.yml
to the root of the repo and is renamed to.evergreen-kubectlplugin.yml
. This is to make sure the evergreen files are kept at the same location, i.e. the root of the repo.Note on LICENSE-THIRD-PARTY
The licenses that are used by the third party go libraries that we use in our kubectl plugin, are documented in public docs at this link.
When we generated the file (
LICENSE-THIRD-PARTY
) after moving the kubectl-mongodb code tocmd/
directory, we can only see a new package added, that issigs.k8s.io/yaml/goyaml
this seems to be part of the modulesigs.k8s.io/yaml
which was already part of theLICENSE-THIRD-PARTY
, that's why we don't need to re-publish the docs for third party licenses.To generate the
LICENSE-THIRD-PARTY
,make precommit
can be run after setting env varexport MDB_UPDATE_LICENSES=true
.This PR also fixes https://jira.mongodb.org/browse/CLOUDP-332234
Proof of Work
Run goreleaser command locally and verify the binaries that are generated in the
dist
directory that they output the correct subcommands.Testing via evergreen:
Since we are experiencing some issues while testing the entire release process I am planning to merge this PR to master and then would test the release from master.
Jira: https://jira.mongodb.org/browse/CLOUDP-332196
Checklist
Reminder (Please remove this when merging)