cluster

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cluster contains types and methods for managing clusters connected to the control plane.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCluster = errors.New("no cluster")

ErrNoCluster is the error given when trying to delete a cluster that does not exist in the organization.

Functions

func AgentServiceAccountSecret added in v0.1.15

func AgentServiceAccountSecret(keyData []byte, name, namespace string) *corev1.Secret

AgentServiceAccountSecret takes a service account json and formats it as a k8s secret.

func ApplyAgentYAML

func ApplyAgentYAML(ctx context.Context, applier Applier, options ApplyAgentYAMLOptions) error

ApplyAgentYAML generates all Kubernetes YAML required for an agent installation and returns it within an io.Reader implementation.

func Delete

func Delete(ctx context.Context, httpClient HTTPClient, organization, name string) error

Delete a cluster that is connected to the control plane. Returns ErrNoCluster if the named cluster does not exist in the organization.

Types

type Applier

type Applier interface {
	Apply(ctx context.Context, r io.Reader) error
}

The Applier interface describes types that can Apply a stream of YAML-encoded Kubernetes resources.

type ApplyAgentYAMLOptions

type ApplyAgentYAMLOptions struct {
	Organization   string          // The user's organization
	Name           string          // The name of the cluster
	ServiceAccount *ServiceAccount // The authentication credentials for the agent to use
	ImageRegistry  string          // The image registry for the agent image
}

ApplyAgentYAMLOptions contains options for creating a YAML bundle to install the Jetstack Secure agent

type Cluster

type Cluster struct {
	Name                     string     `json:"cluster"`
	CertInventoryLastUpdated *time.Time `json:"certInventoryLastUpdated,omitempty"`
	IsDemoData               bool       `json:"isDemoData,omitempty"`
}

The Cluster type describes the current state of a cluster connected to the control plane.

func List

func List(ctx context.Context, httpClient HTTPClient, organization string) ([]Cluster, error)

List all clusters connected to the control plane for an organization, ordered by name.

type HTTPClient

type HTTPClient interface {
	Do(ctx context.Context, method, uri string, body, out interface{}) error
}

The HTTPClient interface describes types that perform HTTP requests.

type ServiceAccount

type ServiceAccount struct {
	UserID     string `json:"user_id"`
	UserSecret string `json:"user_secret"`
}

The ServiceAccount type describes the service account used by agent installations to authenticate their requests against the control-plane API.

func CreateServiceAccount

func CreateServiceAccount(ctx context.Context, httpClient HTTPClient, organization, name string) (*ServiceAccount, error)

CreateServiceAccount makes an API call that generates a new service account for a cluster. This service account is used to authenticate uploads used by an agent installation.

Jump to

Keyboard shortcuts

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