api

package
v0.8.32 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

Package v1alpha1 implements the v1alpha1 apiVersion of ctlptl's cluster configuration

Borrows the approach of clientcmd/api and KIND, maintaining an API similar to other Kubernetes APIs without pulling in the API machinery.

+k8s:deepcopy-gen=package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	TypeMeta `yaml:",inline"`

	// The cluster name. Pulled from .kube/config.
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// The name of the tool used to create this cluster.
	Product string `json:"product,omitempty" yaml:"product,omitempty"`

	// Make sure that the cluster has access to at least this many
	// CPUs. This is mostly helpful for ensuring that your Docker Desktop
	// VM has enough CPU. If ctlptl can't guarantee this many
	// CPU, it will return an error.
	MinCPUs int `json:"minCPUs,omitempty" yaml:"minCPUs,omitempty"`

	// The name of a registry.
	//
	// If the registry doesn't exist, ctlptl will create one with this name.
	//
	// The registry can be configured by creating a `kind: Registry` config file.
	//
	// Not supported on all cluster products.
	Registry string `json:"registry,omitempty" yaml:"registry,omitempty"`

	// The desired version of Kubernetes to run.
	//
	// Examples:
	// v1.19.1
	// v1.14.0
	// Must start with 'v' and contain a major, minor, and patch version.
	//
	// Not all cluster products allow you to customize this.
	KubernetesVersion string `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`

	// The Kind cluster config. Only applicable for clusters with product: kind.
	//
	// Full documentation at:
	// https://pkg.go.dev/sigs.k8s.io/kind/pkg/apis/config/v1alpha4#Cluster
	//
	// Properties of this config may be overridden by properties of the ctlptl
	// Cluster config. For example, the name field of the top-level Cluster object
	// wins over one specified in the Kind config.
	KindV1Alpha4Cluster *v1alpha4.Cluster `json:"kindV1Alpha4Cluster,omitempty" yaml:"kindV1Alpha4Cluster,omitempty"`

	// The Minikube cluster config. Only applicable for clusters with product: minikube.
	Minikube *MinikubeCluster `json:"minikube,omitempty" yaml:"minikube,omitempty"`

	// The K3D cluster config. Only applicable for clusters with product: k3d.
	K3D *K3DCluster `json:"k3d,omitempty" yaml:"k3d,omitempty"`

	// Most recently observed status of the cluster.
	// Populated by the system.
	// Read-only.
	Status ClusterStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

Cluster contains cluster configuration. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Cluster) DeepCopy

func (in *Cluster) DeepCopy() *Cluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.

func (*Cluster) DeepCopyInto

func (in *Cluster) DeepCopyInto(out *Cluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Cluster) DeepCopyObject

func (in *Cluster) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Cluster) GetObjectKind

func (obj *Cluster) GetObjectKind() schema.ObjectKind

func (*Cluster) GetObjectMeta added in v0.8.22

func (c *Cluster) GetObjectMeta() metav1.Object

func (*Cluster) GroupVersionKind

func (obj *Cluster) GroupVersionKind() schema.GroupVersionKind

func (*Cluster) SetGroupVersionKind

func (obj *Cluster) SetGroupVersionKind(gvk schema.GroupVersionKind)

type ClusterList

type ClusterList struct {
	TypeMeta `json:",inline"`

	// List of clusters.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
	Items []Cluster `json:"items" protobuf:"bytes,2,rep,name=items"`
}

ClusterList is a list of Clusters. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterList) DeepCopy

func (in *ClusterList) DeepCopy() *ClusterList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList.

func (*ClusterList) DeepCopyInto

func (in *ClusterList) DeepCopyInto(out *ClusterList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterList) DeepCopyObject

func (in *ClusterList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*ClusterList) GetObjectKind

func (obj *ClusterList) GetObjectKind() schema.ObjectKind

func (*ClusterList) GroupVersionKind

func (obj *ClusterList) GroupVersionKind() schema.GroupVersionKind

func (*ClusterList) SetGroupVersionKind

func (obj *ClusterList) SetGroupVersionKind(gvk schema.GroupVersionKind)

type ClusterStatus

type ClusterStatus struct {
	// When the cluster was first created.
	CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`

	// Local registry status documented on the cluster itself.
	LocalRegistryHosting *localregistry.LocalRegistryHostingV1 `json:"localRegistryHosting,omitempty" yaml:"localRegistryHosting,omitempty"`

	// The number of CPU. Only applicable to local clusters.
	CPUs int `json:"cpus,omitempty" yaml:"cpus,omitempty"`

	// Whether this is the current cluster in `kubectl`
	Current bool `json:"current,omitempty" yaml:"current,omitempty"`

	// The version of Kubernetes currently running.
	//
	// Reported by the Kubernetes API. May contain a build tag.
	//
	// Examples:
	// v1.19.1
	// v1.18.10-gke.601
	// v1.19.3-34+fa32ff1c160058
	KubernetesVersion string `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`

	// Populated when we encounter an error reading the cluster status.
	Error string `json:"error,omitempty"`
}

func (*ClusterStatus) DeepCopy

func (in *ClusterStatus) DeepCopy() *ClusterStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.

func (*ClusterStatus) DeepCopyInto

func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type K3DCluster added in v0.8.13

type K3DCluster struct {
	// K3D's own cluster config format, v1alpha5.
	//
	// Documentation: https://k3d.io/v5.6.0/usage/configfile/
	//
	// Uses this schema: https://github.com/k3d-io/k3d/blob/v5.6.0/pkg/config/v1alpha5/types.go
	V1Alpha5Simple *k3dv1alpha5.SimpleConfig `json:"v1alpha5Simple,omitempty" yaml:"v1alpha5Simple,omitempty"`

	// K3D's own cluster config format, v1alpha4.
	//
	// Documentation: https://k3d.io/v5.4.6/usage/configfile/
	//
	// Uses this schema: https://github.com/k3d-io/k3d/blob/v5.4.6/pkg/config/v1alpha4/types.go
	V1Alpha4Simple *k3dv1alpha4.SimpleConfig `json:"v1alpha4Simple,omitempty" yaml:"v1alpha4Simple,omitempty"`
}

K3DCluster describes k3d-specific options for starting a cluster.

Prefer setting features on the ClusterSpec rather than on the K3dCluster object when possible.

ctlptl's logic for diffing clusters and applying changes is less robust for cluster-specific configs.

func (*K3DCluster) DeepCopy added in v0.8.13

func (in *K3DCluster) DeepCopy() *K3DCluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new K3DCluster.

func (*K3DCluster) DeepCopyInto added in v0.8.13

func (in *K3DCluster) DeepCopyInto(out *K3DCluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MinikubeCluster added in v0.7.1

type MinikubeCluster struct {
	// The container runtime of the cluster. Defaults to containerd.
	ContainerRuntime string `json:"containerRuntime,omitempty" yaml:"containerRuntime,omitempty"`

	// Extra config options passed directly to Minikube's --extra-config flags.
	// When not set, we will default to starting minikube with these configs:
	//
	// kubelet.max-pods=500
	ExtraConfigs []string `json:"extraConfigs,omitempty" yaml:"extraConfigs,omitempty"`

	// Unstructured flags to pass to minikube on `minikube start`.
	// These flags will be passed before all tilt-determined flags.
	StartFlags []string `json:"startFlags,omitempty" yaml:"startFlags,omitempty"`
}

MinikubeCluster describes minikube-specific options for starting a cluster.

Options in this struct, when possible, should match the flags to `minikube start`.

Prefer setting features on the ClusterSpec rather than on the MinikubeCluster object when possible. For example, this object doesn't have a `kubernetesVersion` field, because it's supported by ClusterSpec.

ctlptl's logic for diffing clusters and applying changes is less robust for cluster-specific config flags.

func (*MinikubeCluster) DeepCopy added in v0.7.1

func (in *MinikubeCluster) DeepCopy() *MinikubeCluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinikubeCluster.

func (*MinikubeCluster) DeepCopyInto added in v0.7.1

func (in *MinikubeCluster) DeepCopyInto(out *MinikubeCluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Registry

type Registry struct {
	TypeMeta `yaml:",inline"`

	// The registry name. Get/set from the Docker container name.
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// The host IPv4 address to bind the container to.
	ListenAddress string `json:"listenAddress,omitempty" yaml:"listenAddress,omitempty"`

	// The desired host port. Set to 0 to choose a random port,
	// or to preserve the existing port.
	Port int `json:"port,omitempty" yaml:"port,omitempty"`

	// Labels that must be attached to the running registry.
	//
	// If you change the set of labels, the registry must be stopped and
	// restarted.
	//
	// Important for K3d, which will only connect to registries
	// that are tagged "app: k3d".
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

	// Environment vars to use for registry container (optional).
	//
	// Can be used to change some parameters likes REGISTRY_HTTP_ADDR, REGISTRY_PROXY_REMOTEURL
	Env []string `json:"env,omitempty" yaml:"env,omitempty"`

	// Image to use for registry container (optional).
	//
	// Can be used to provide an alternate image or use a different registry
	// than Docker Hub.
	//
	// Defaults to `docker.io/library/registry:2`.
	Image string `json:"image,omitempty" yaml:"image,omitempty"`

	// Most recently observed status of the registry.
	// Populated by the system.
	// Read-only.
	Status RegistryStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

Cluster contains registry configuration.

Currently designed for local registries on the host machine, but may eventually expand to support remote registries.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Registry) DeepCopy

func (in *Registry) DeepCopy() *Registry

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Registry.

func (*Registry) DeepCopyInto

func (in *Registry) DeepCopyInto(out *Registry)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Registry) DeepCopyObject

func (in *Registry) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Registry) GetObjectKind

func (obj *Registry) GetObjectKind() schema.ObjectKind

func (*Registry) GetObjectMeta added in v0.8.22

func (r *Registry) GetObjectMeta() metav1.Object

func (*Registry) GroupVersionKind

func (obj *Registry) GroupVersionKind() schema.GroupVersionKind

func (*Registry) SetGroupVersionKind

func (obj *Registry) SetGroupVersionKind(gvk schema.GroupVersionKind)

type RegistryList

type RegistryList struct {
	TypeMeta `json:",inline"`

	// List of registrys.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
	Items []Registry `json:"items" protobuf:"bytes,2,rep,name=items"`
}

RegistryList is a list of Registrys. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*RegistryList) DeepCopy

func (in *RegistryList) DeepCopy() *RegistryList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryList.

func (*RegistryList) DeepCopyInto

func (in *RegistryList) DeepCopyInto(out *RegistryList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RegistryList) DeepCopyObject

func (in *RegistryList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*RegistryList) GetObjectKind

func (obj *RegistryList) GetObjectKind() schema.ObjectKind

func (*RegistryList) GroupVersionKind

func (obj *RegistryList) GroupVersionKind() schema.GroupVersionKind

func (*RegistryList) SetGroupVersionKind

func (obj *RegistryList) SetGroupVersionKind(gvk schema.GroupVersionKind)

type RegistryStatus

type RegistryStatus struct {
	// When the registry was first created.
	CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`

	// The IPv4 address for the bridge network.
	IPAddress string `json:"ipAddress,omitempty" yaml:"ipAddress,omitempty"`

	// The public IPv4 address that the registry is listening on on the host machine.
	ListenAddress string `json:"listenAddress,omitempty" yaml:"listenAddress,omitempty"`

	// The public port that the registry is listening on on the host machine.
	HostPort int `json:"hostPort,omitempty" yaml:"hostPort,omitempty"`

	// The private port that the registry is listening on inside the registry network.
	//
	// We try to make this not configurable, because there's no real reason not
	// to use the default registry port 5000.
	ContainerPort int `json:"containerPort,omitempty" yaml:"containerPort,omitempty"`

	// Networks that the registry container is connected to.
	Networks []string `json:"networks,omitempty" yaml:"networks,omitempty"`

	// The ID of the container in Docker.
	ContainerID string `json:"containerId,omitempty" yaml:"containerId,omitempty"`

	// Current health status of the registry container.
	// Reflects underlying ContainerState.Status
	// https://github.com/moby/moby/blob/v20.10.3/api/types/types.go#L314
	State string

	// Labels attached to the running container.
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

	// Env attached to the running container.
	Env []string `json:"env,omitempty" yaml:"env,omitempty"`

	// Image for the running container.
	Image string `json:"image,omitempty" yaml:"image,omitempty"`
}

func (*RegistryStatus) DeepCopy

func (in *RegistryStatus) DeepCopy() *RegistryStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryStatus.

func (*RegistryStatus) DeepCopyInto

func (in *RegistryStatus) DeepCopyInto(out *RegistryStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TypeMeta

type TypeMeta struct {
	Kind       string `json:"kind,omitempty" yaml:"kind,omitempty"`
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
}

TypeMeta partially copies apimachinery/pkg/apis/meta/v1.TypeMeta No need for a direct dependence; the fields are stable.

func (*TypeMeta) DeepCopy

func (in *TypeMeta) DeepCopy() *TypeMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypeMeta.

func (*TypeMeta) DeepCopyInto

func (in *TypeMeta) DeepCopyInto(out *TypeMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis
Package k3dv1alpha4 implements the v1alpha4 apiVersion of k3d's config file.
Package k3dv1alpha4 implements the v1alpha4 apiVersion of k3d's config file.
Package k3dv1alpha5 implements the v1alpha4 apiVersion of k3d's config file.
Package k3dv1alpha5 implements the v1alpha4 apiVersion of k3d's config file.

Jump to

Keyboard shortcuts

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