-
Notifications
You must be signed in to change notification settings - Fork 13
[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
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" ```
Hi @Julien-Ben, |
Thank you @MaciejKaras. |
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.
Great work 👏
…ngodb` (#280) # Summary Since we [moved](#271) the code for kubectl plugin to the dir `cmd/`, we also need to move the Dockerfile there. This PR does the same and moves the Dockerfile to the `cmd/kubectl-mongodb` dir. ## Proof of Work Go to the root of the repo and run the below command to build the image ```bash ~/work/opensource/mongodb-kubernetes (move-kplugin-dockerfile*) » docker build -t viveksinghggits/mongodb-mc-plugin:0.0.1 . -f cmd/kubectl-mongodb/Dockerfile vivek.s@M-HYXVRF7WDG [+] Building 11.5s (10/10) FINISHED docker:desktop-linux => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 309B 0.0s => [internal] load metadata for docker.io/library/golang:1.24 0.7s => [internal] load .dockerignore 0.0s => => transferring context: 1.16kB 0.0s => [builder 1/4] FROM docker.io/library/golang:1.24@sha256:14fd8a55e59a560704e5fc44970b301d00d344e45d6b914dda228e09f359a088 0.0s => => resolve docker.io/library/golang:1.24@sha256:14fd8a55e59a560704e5fc44970b301d00d344e45d6b914dda228e09f359a088 0.0s => [internal] load build context 0.1s => => transferring context: 172.97kB 0.1s => CACHED [builder 2/4] WORKDIR /go/src 0.0s => [builder 3/4] ADD . . 0.2s => [builder 4/4] RUN CGO_ENABLED=0 go build -a -buildvcs=false -o /go/bin/mongodb-multicluster 10.4s => CACHED [stage-1 1/1] COPY --from=builder /go/bin/mongodb-multicluster /go/bin/mongodb-multicluster 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => exporting manifest sha256:f0d3ef2864de3f81ec287382c66a76897419bddb5337a4e2fb9b56b7e3ca14dc 0.0s => => exporting config sha256:ce9089ec4e89d1b2c2b3dd5edeb4053eaae95c62a3182e7c015dd4d63ecf6be2 0.0s => => exporting attestation manifest sha256:19f49f2aebd733e6a259441c81d0fef424c6af4fadf6f86e8032e77b7f1f3d51 0.0s => => exporting manifest list sha256:1574999c4354dbe1915980c0baf9aab438cbc59c7b909e34bf73b84ec98945e9 0.0s => => naming to docker.io/viveksinghggits/mongodb-mc-plugin:0.0.1 0.0s => => unpacking to docker.io/viveksinghggits/mongodb-mc-plugin:0.0.1 0.0s ``` ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you checked for release_note changes?
# Summary As part of [the PR](#271) we moved the kubectl-mongodb code from `public/tools/multicluster` to `cmd/kubectl-mongodb`. This PR, tries to move the license file from `public/tools/multicluster` to `cmd/kubectl-mongodb`. The next [PR](#281) in this chain are going to actually remove the `public/tools` directory entirely. ## Proof of Work NA ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you checked for release_note changes?
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)