Skip to content

A versioned collection of snippets showing how to use client-go

License

Notifications You must be signed in to change notification settings

mhausenblas/using-client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using client-go

A versioned collection of snippets showing how to use client-go. client-go is a bunch of Go packages enabling you to programmatically interact with a Kubernetes cluster.

Quick links | client-go Go docs | client-go repo | 1.7 snippets

Table of Contents:

Prerequisites

Go

The snippets shown here have been tested using Go 1.8 and should also work with Go 1.9 (not tested, yet).

In order to manage dependencies (aka vendoring in Go) we use Go dep. If you don't have Go dep installed yet, simply do the following:

$ go get -u github.com/golang/dep/cmd/dep
$ dep init     # only the first time if no Gopkg.* exist in the project
$ dep ensure   # every time you add/change dependencies

Note that if you're new to Go dep and/or dependency management, you might want to read Using Go dep as a project maintainer before you proceed.

Note also, if you want to contribute a snippet, we're using Bats for testing.

Kubernetes cluster

The snippets assume that you have a Kubernetes cluster running. You can, for example, install Minikube or Minishift to test it locally.

Get snippets

To enjoy all the snippets, do the following now:

$ mkdir -p $GOPATH/src/mhausenblas && cd $GOPATH/src/mhausenblas
$ git clone https://github.com/mhausenblas/using-client-go.git

Kubernetes 1.7

Once you're using one or more of the snippets, that is, you have imports that reference one or more client-go packages, use the following in your Gopkg.toml file. Add it if it doesn't exist, otherwise update it:

[[constraint]]
  name = "k8s.io/client-go"
  version = "v4.0.0"

[[constraint]]
  name = "k8s.io/apimachinery"
  branch = "release-1.7"

After you've updated your Gopkg.toml file, do dep ensure and commit it to your repo.

Now you can move on to the Kubernetes 1.7 snippets.

Kubernetes 1.6

Once you're using one or more of the snippets, that is, you have imports that reference one or more client-go packages, use the following in your Gopkg.toml file. Add it if it doesn't exist, otherwise update it:

[[constraint]]
  name = "k8s.io/client-go"
  version = "v3.0.0"

[[override]]
  name = "k8s.io/apimachinery"
  branch = "release-1.6"

After you've updated your Gopkg.toml file, do dep ensure and commit it to your repo.

Kubernetes 1.5

TBD

Related

Resources available on the Web around the 'using client-go' topic:

Related artifacts and activities:

About

A versioned collection of snippets showing how to use client-go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published