Giter VIP home page Giter VIP logo

krucible-go-client's Introduction

Krucible Go Client

This is the Go client for Krucible, the platform for creating ephemeral Kubernetes clusters optimised for testing and development.

Installation

The Krucible Go client is built using Go modules and thus that is the recommended way of including the Krucible client into your project.

go get github.com/Krucible/krucible-go-client

Usage

To get started, import the krucible package and create a client:

import "github.com/Krucible/krucible-go-client/krucible"

client := krucible.NewClient(krucible.ClientConfig{
	AccountID:    "4ad69a63-bb6c-49a8-9c6f-6a166fb5acff",
	APIKeyId:     "146d98c4-327d-4a2d-b85a-49590246e136",
	APIKeySecret: "0da8afd2911904aa9bad8862a3e7478a",
})

Creating a cluster

You should then be able to create new Krucible clusters with CreateCluster:

cluster, clientset, err := client.CreateCluster(krucible.CreateClusterConfig{
	DisplayName: "my-krucible-cluster",
})

CreateCluster returns a krucible.Cluster struct, containing metadata about your cluster, and a kubernetes.Clientset that is set up to connect to the new cluster.

Getting the cluster expiry time:

fmt.Println(cluster.ExpiresAt)

Listing the pods in the default namespace:

pods, err := clientset.CoreV1().
	Pods("default").
	List(
		context.Background(),
		metav1.ListOptions{},
	)

Getting a cluster

Get existing clusters with GetCluster:

cluster, err = client.GetCluster("51b831d4-a9d6-4489-913e-6df70fcc8ea8")

Here cluster is a krucible.Cluster struct, containing metadata about the cluster.

Getting a cluster clientset

Get a Kubernetes client-go Clientset, configured to connect to a given cluster:

cs, err := client.GetClusterClientset("51b831d4-a9d6-4489-913e-6df70fcc8ea8")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.