kubectl-gitlab

command module
v0.0.0-...-78fdce7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 5 Imported by: 0

README

kubectl-gitlab: A kubectl plugin to manage GitLab cluster associations

Installation

Pre-built binaries
  1. Download the latest binary for your platform:

  2. Rename it to kubectl-gitlab and move it to a folder in your PATH (such as /usr/local/bin) and make sure it is executable (chmod +x kubectl-gitlab)

  3. On macOS, to run the binary for the first time, right-click and press Open and again Open in the subsequent dialog.

Using go-get
GO111MODULE=on go get gitlab.com/hfyngvason/kubectl-gitlab

Make sure $GOPATH/bin is in your path.

Cloning this repository
git clone https://gitlab.com/hfyngvason/kubectl-gitlab.git
cd kubectl-gitlab
go install

Again, make sure $GOPATH/bin is in your path.

Usage

For more detailed usage instructions, run

kubectl gitlab help

In the below examples, $project and $group can be either IDs or paths.

Add existing cluster to GitLab
kubectl gitlab --project $project add
kubectl gitlab --group $group add
kubectl gitlab --instance add

The add command also creates a service account gitlab-admin and a cluster role binding gitlab-admin in the kube-system namespace.

List clusters associated with GitLab
kubectl gitlab --project $project list
kubectl gitlab --group $group list
kubectl gitlab --instance list
Remove cluster association from GitLab
kubectl gitlab --project $project delete $cluster_id
kubectl gitlab --group $group delete $cluster_id
kubectl gitlab --instance delete $cluster_id

Note: This does not delete the service account and role binding created when the cluster was added. You can delete those separately via

kubectl -n kube-system delete clusterrolebinding gitlab-admin
kubectl -n kube-system delete serviceaccount gitlab-admin

Configuration

Authentication

A GitLab API token with the api scope is required, specified as either

  • the environment variable GITLAB_TOKEN, or
  • the flag --gitlab-token
Custom base URL

By default, requests go to https://gitlab.com. You can customize this with

  • the environment variable GITLAB_URL, or
  • the flag --gitlab-url

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL