[comment]: # ( Copyright Contributors to the Open Cluster Management project )Table of Contents
All contributions to the repository must be submitted under the terms of the Apache Public License 2.0.
By contributing to this project, you agree to the Developer Certificate of Origin (DCO). This document was created by the Linux Kernel community and is a simple statement that you, as a contributor, have the legal right to make the contribution. See the DCO file for details.
- Submit an issue describing your proposed change to the repository in question. The repository owners will respond to your issue promptly.
- Fork the desired repository, then develop and test your code changes.
- Submit a pull request.
Anyone can comment on issues and submit reviews for pull requests. In order to be assigned an issue or pull request, you can leave a /assign <your Github ID>
comment on the issue or pull request.
- Go 1.17
- The project tries to follow the following grammar for the commands:
clusteradm <cmd> [subcmd] [flags]
- Each cmd/subcmd are in a package, the code is split in 3 files: The cmd.go which creates the cobra command, the options.go which defines the different option parameters for the command and the the exec.go which contains the code to execute the command.
- Each command must support the flag
--dry-run
. - The command uses klog V2 as logging package. All messages must be using
klog.V(x)
, in rare exceptionklog.Error
andklog.Warning
can be used.
- Some commands needs resources files, in the project uses the
Go 1.17
go:embed
functionality to store the resources files. - Each command package contains its own resources in the scenario package. The scenario package contains one go file which provides the
go:embed
embed.FS
files.
- The main provides a cmdutil.Factory which can be leveraged to get different clients and also the *rest.Config. The factory can be passed to the cobra.Command and then save in the Options.
kubeClient, err := o.factory.KubernetesClientSet()
config, err := f.ToRESTConfig()
- If the unit test needs files to be executed, these files are stored under the pair
<verb>/<noun>/test/unit
. A total coverage is shown when runningmake test
. For the time being, thecmd.go
andclient.go
are excluded from the total coverage. - The
make test
is part of the PR acceptance and it is launched by PROW.
- The project use
make test-e2e
to run e2e tests, this will deploy kind cluster and run a set of tests for clusteradm commands. A prerequisite is that Docker is already running. - We have a README indicating the way to write e2e tests.
- The
make test-e2e
is part of the PR acceptance and it is launched using git-actions.