3.1 KiB
cng
cng is a CLI tool that supports setting up and deploying Cloud Native GitLab builds
using the official GitLab Chart.
Usage
cng is internal gem so it is not published to rubygems. Run cng by prefixing commands with
bundle exec within its directory.
$ bundle exec cng
Commands:
cng create [SUBCOMMAND] # Manage deployment related object creation
cng destroy [SUBCOMMAND] # Manage deployment related object cleanup
cng doctor # Validate presence of all required system dependencies
cng help [COMMAND] # Describe available commands or one specific command
cng log [SUBCOMMAND] # Manage deployment related logs
cng version # Print cng orchestrator version
Add new deployments
The main feature cng is to programmatically manage different deployment type configurations and setup. To implement new deployment configuration:
- Add a new subcommand method to the
Deploymentclass. This allows you to to define your own input arguments and documentation. - Define a configuration class based on the
Baseconfiguration class. You can implement:pre-deploymentsetup: optional setup steps that are executed before installing theGitLabinstance.post-deploymentsetup: optional setup steps that are executed after instance ofGitLabhas been installed.helmvalues: set of values to apply during installation.
- Define a cleanup class based on the
Basecleanup class. Implement a single method that deletes all objects created bypre-deploymentandpost-deploymentsetup.
All different options for GitLab deployment on Kubernetes cluster are described in GitLab Helm chart documentation page.
Tips
kubectl context
cng CLI uses kubectl and Helm to perform all kubernetes-related
operations. When running a deployment, current context
is always used. If non-default arguments are used when running the deployment, make sure current context points to the cluster where the deployment should be executed.
Shell integration
To make cng globally available in your shell without the need to run the commands from a specific folder and prefixed with bundle exec, add the following
function to your shell's configuration file (for example,.zshrc or .bash_profile):
function cng() {
(cd $PATH_TO_GITLAB_REPO/gems/gitlab-cng && BUNDLE_AUTO_INSTALL=true bundle exec cng "$@")
}
Troubleshooting
Because cng tool essentially wraps helm upgrade --install command, official Troubleshooting the GitLab chart guide can be used for troubleshooting deployment failures.