Documentation
¶
Index ¶
Constants ¶
const ( // ContainerScope is the Oauth2 scope required for interaction with the GKE API ContainerScope = "https://www.googleapis.com/auth/cloud-platform" // TokenURL is the Oauth2 token exchange URL for Google accounts TokenURL = "https://accounts.google.com/o/oauth2/token" )
Variables ¶
This section is empty.
Functions ¶
func GetContainerService ¶
func GetContainerService(email string, pk PrivateKey) (*container.Service, error)
GetContainerService creates a GKE client by creating an OAuth2 capable HTTP client from the given JWT credentials, then creating a new container client with that HTTP client
Types ¶
type ClusterLister ¶
type ClusterLister interface { // List lists all of the clusters in the given project and zone List(projectID, zone string) (*container.ListClustersResponse, error) }
ClusterLister is an interface interface for listing GKE clusters. It has an adapter for the standard *(google.golang.org/api/container/v1).Service as well as a fake implementation, to be used in unit tests. Use this as a parameter in your funcs so that they can be more easily unit tested
type FakeClusterLister ¶
type FakeClusterLister struct { Resp *container.ListClustersResponse Err error }
FakeClusterLister is a ClusterLister implementation for use in unit tests
func (FakeClusterLister) List ¶
func (f FakeClusterLister) List(projectID, zone string) (*container.ListClustersResponse, error)
List is the ClusterLister interface implementation. It just returns f.Resp, f.Err
type GKEClusterLister ¶
type GKEClusterLister struct {
// contains filtered or unexported fields
}
GKEClusterLister is a ClusterLister implementation that uses the GKE Go SDK to list clusters on a live GKE cluster
func NewGKEClusterLister ¶
func NewGKEClusterLister(svc *container.Service) *GKEClusterLister
NewGKEClusterLister creates a new GKEClusterLister configured to use the given client. See GetContainerService for how to create a new client.
func (*GKEClusterLister) List ¶
func (g *GKEClusterLister) List(projectID, zone string) (*container.ListClustersResponse, error)
List is the ClusterLister interface implementation
type PrivateKey ¶
type PrivateKey string
PrivateKey is the type for a JWT private key
func (PrivateKey) Bytes ¶
func (p PrivateKey) Bytes() []byte
Bytes is a convenience function for []byte(p.String())
func (PrivateKey) String ¶
func (p PrivateKey) String() string
String is the fmt.Stringer interface implementation