provisioner

package
v0.0.0-...-851abc6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 69 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyEKSEndpoint      = "eks_endpoint"
	KeyEKSCAData        = "eks_certificate_authority_data"
	KeyEKSOIDCIssuerURL = "eks_oidc_issuer_url"
)

Variables

View Source
var (
	// ErrProviderNotSupported is the error returned from porvisioners if
	// they don't support the cluster provider defined.
	ErrProviderNotSupported = errors.New("unsupported provider type")
)

Functions

This section is empty.

Types

type AWSNodePoolProvisioner

type AWSNodePoolProvisioner struct {
	NodePoolTemplateRenderer
	// contains filtered or unexported fields
}

AWSNodePoolProvisioner is a node provisioner able to provision node pools in AWS via cloudformation. TODO: move AWS specific implementation to a separate file/package.

func (*AWSNodePoolProvisioner) Provision

func (p *AWSNodePoolProvisioner) Provision(ctx context.Context, nodePools []*api.NodePool, values map[string]interface{}) error

Provision provisions node pools of the cluster.

func (*AWSNodePoolProvisioner) Reconcile

Reconcile finds all orphaned node pool stacks and decommission the node pools by scaling them down gracefully and deleting the corresponding stacks.

type AZInfo

type AZInfo struct {
	// contains filtered or unexported fields
}

AZInfo tracks information about available AZs based on explicit restrictions or available subnets

func (*AZInfo) AvailabilityZones

func (info *AZInfo) AvailabilityZones() []string

AvailabilityZones returns a list of available AZs

func (*AZInfo) RestrictAZs

func (info *AZInfo) RestrictAZs(availableAZs []string) *AZInfo

RestrictAZs returns a new AZInfo that is restricted to provided AZs

func (*AZInfo) SubnetIPv6CIDRs

func (info *AZInfo) SubnetIPv6CIDRs() []string

SubnetIPv6CIDRs returns a list of available subnet IPV6 CIDRs.

func (*AZInfo) SubnetsByAZ

func (info *AZInfo) SubnetsByAZ() map[string]string

Subnets returns a map of AZ->subnet that also contains an entry for the virtual '*' AZ TODO drop the *

type Applier

type Applier interface {
	Apply(path string) error
}

Applier defines an interface which given a path can apply manifests to a kubernetes cluster.

type CreationHook

type CreationHook interface {
	// Execute performs updates used by a provisioner during cluster
	// creation.
	Execute(
		adapter awsInterface,
		cluster *api.Cluster,
	) (
		*HookResponse,
		error,
	)
}

CreationHook is an interface that provisioners can use while provisioning a cluster.

This is useful for example to pass additional configuration only known at a later stage of provisioning. For example, when provisioning an EKS cluster, the provisioner only knows what is the API Server URL after applying the initial CloudFormation.

func NewZalandoEKSCreationHook

func NewZalandoEKSCreationHook(
	clusterRegistry registry.Registry,
) CreationHook

NewZalandoEKSCreationHook returns a new hook for EKS cluster provisioning, configured to use the given cluster registry.

type EKSClusterDetails

type EKSClusterDetails struct {
	Endpoint             string
	CertificateAuthority string
	OIDCIssuerURL        string
	ServiceCIDR          string
}

EKSClusterDetails contains details of an EKS cluster that are only available after creation.

type FilesRenderer

type FilesRenderer struct {
	// contains filtered or unexported fields
}

func (*FilesRenderer) RenderAndUploadFiles

func (f *FilesRenderer) RenderAndUploadFiles(
	values map[string]interface{},
	bucketName string,
	kmsKey string,
) (string, error)

type HookResponse

type HookResponse struct {
	APIServerURL string
	CAData       []byte
	ServiceCIDR  string
}

HookResponse contain configuration parameters that a provisioner can use at a later stage.

type HostPort

type HostPort struct {
	Host string
	Port string
}

type KarpenterNodePoolProvisioner

type KarpenterNodePoolProvisioner struct {
	NodePoolTemplateRenderer
	*kubernetes.KubeCTLRunner
	// contains filtered or unexported fields
}

func (*KarpenterNodePoolProvisioner) Provision

func (p *KarpenterNodePoolProvisioner) Provision(ctx context.Context, nodePools []*api.NodePool, values map[string]interface{}) error

func (*KarpenterNodePoolProvisioner) Reconcile

type KeyResponse

type KeyResponse struct {
	Keys []map[string]string `json:"keys"`
}

type NodePoolProvisioner

type NodePoolProvisioner interface {
	Provision(ctx context.Context, nodePools []*api.NodePool, values map[string]interface{}) error
	Reconcile(ctx context.Context, updater updatestrategy.UpdateStrategy) error
}

NodePoolProvisioner is able to provision node pools for a cluster.

type NodePoolTemplateRenderer

type NodePoolTemplateRenderer struct {
	// contains filtered or unexported fields
}

type Options

type Options struct {
	DryRun          bool
	ApplyOnly       bool
	UpdateStrategy  config.UpdateStrategy
	RemoveVolumes   bool
	ManageEtcdStack bool
	Hook            CreationHook
}

Options is the options that can be passed to a provisioner when initialized.

type PortRange

type PortRange struct {
	FromPort, ToPort int
}

type Provider

type Provider struct {
	Issuer                 string   `json:"issuer"`
	AuthURL                string   `json:"authorization_endpoint"`
	JWKSURL                string   `json:"jwks_uri"`
	SupportedResponseTypes []string `json:"response_types_supported"`
	SupportedSubjectTypes  []string `json:"subject_types_supported"`
	AlgorithmsSupported    []string `json:"id_token_signing_alg_values_supported"`
	SupportedClaims        []string `json:"claims_supported"`
}

Provider contains the subset of the OpenID Connect provider metadata needed to request and verify ID Tokens.

type Provisioner

type Provisioner interface {
	Supports(cluster *api.Cluster) bool

	Provision(
		ctx context.Context,
		logger *log.Entry,
		cluster *api.Cluster,
		channelConfig channel.Config,
	) error

	Decommission(
		ctx context.Context,
		logger *log.Entry,
		cluster *api.Cluster,
	) error
}

Provisioner is an interface describing how to provision or decommission clusters.

func NewStdoutProvisioner

func NewStdoutProvisioner() Provisioner

NewStdoutProvisioner creates a new provisioner which prints to stdout instead of doing any actual provsioning.

func NewZalandoAWSProvisioner

func NewZalandoAWSProvisioner(
	execManager *command.ExecManager,
	tokenSource oauth2.TokenSource,
	secretDecrypter decrypter.Decrypter,
	assumedRole string,
	awsConfig *aws.Config,
	options *Options,
) Provisioner

NewZalandoAWSProvisioner returns a new provisioner by passing its location and and IAM role to use.

func NewZalandoEKSProvisioner

func NewZalandoEKSProvisioner(
	execManager *command.ExecManager,
	secretDecrypter decrypter.Decrypter,
	assumedRole string,
	awsConfig *aws.Config,
	options *Options,
) Provisioner

NewZalandoEKSProvisioner returns a new provisioner capable of provisioning EKS clusters by passing its location and and IAM role to use.

type SGIngressRange

type SGIngressRange struct {
	CIDR             string
	FromPort, ToPort int
	Protocol         string
}

type SubnetInfo

type SubnetInfo struct {
	SubnetID        string
	SubnetIPV6CIDRs []string
}

SubnetInfo has information about a subnet.

type ZalandoAWSProvisioner

type ZalandoAWSProvisioner struct {
	// contains filtered or unexported fields
}

func (*ZalandoAWSProvisioner) Decommission

func (z *ZalandoAWSProvisioner) Decommission(
	ctx context.Context,
	logger *log.Entry,
	cluster *api.Cluster,
) error

Decommission decommissions a cluster provisioned in AWS.

func (*ZalandoAWSProvisioner) Deletions

func (p *ZalandoAWSProvisioner) Deletions(
	ctx context.Context,
	logger *log.Entry,
	tokenSource oauth2.TokenSource,
	cluster *api.Cluster,
	deletions []*kubernetes.Resource,
	options *HookResponse,
) error

Deletions deletes the provided kubernetes resources from the cluster.

func (*ZalandoAWSProvisioner) Provision

func (z *ZalandoAWSProvisioner) Provision(
	ctx context.Context,
	logger *log.Entry,
	cluster *api.Cluster,
	channelConfig channel.Config,
) error

func (*ZalandoAWSProvisioner) Supports

func (z *ZalandoAWSProvisioner) Supports(cluster *api.Cluster) bool

type ZalandoEKSCreationHook

type ZalandoEKSCreationHook struct {
	// contains filtered or unexported fields
}

ZalandoEKSCreationHook is a hook specific for EKS cluster provisioning.

func (*ZalandoEKSCreationHook) Execute

func (z *ZalandoEKSCreationHook) Execute(
	adapter awsInterface,
	cluster *api.Cluster,
) (*HookResponse, error)

Execute updates the configuration only known after deploying the first CloudFormation stack.

The method returns the API server URL, the Certificate Authority data, and the subnets. Additionally Execute updates the configured cluster registry with the EKS API Server URL and the Certificate Authority data.

type ZalandoEKSProvisioner

type ZalandoEKSProvisioner struct {
	// contains filtered or unexported fields
}

func (*ZalandoEKSProvisioner) Decommission

func (z *ZalandoEKSProvisioner) Decommission(
	ctx context.Context,
	logger *log.Entry,
	cluster *api.Cluster,
) error

func (*ZalandoEKSProvisioner) Deletions

func (p *ZalandoEKSProvisioner) Deletions(
	ctx context.Context,
	logger *log.Entry,
	tokenSource oauth2.TokenSource,
	cluster *api.Cluster,
	deletions []*kubernetes.Resource,
	options *HookResponse,
) error

Deletions deletes the provided kubernetes resources from the cluster.

func (*ZalandoEKSProvisioner) Provision

func (z *ZalandoEKSProvisioner) Provision(
	ctx context.Context,
	logger *log.Entry,
	cluster *api.Cluster,
	channelConfig channel.Config,
) error

func (*ZalandoEKSProvisioner) Supports

func (z *ZalandoEKSProvisioner) Supports(cluster *api.Cluster) bool

Jump to

Keyboard shortcuts

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