objects

package
v0.0.0-...-841f565 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildIngressRule

func BuildIngressRule(host, serviceName, path string, servicePort int32) v1.IngressRule

BuildIngressRule returns a constructed ingress rule from a host, service name, and service port

func BuildVolumeClaimsTemplate

func BuildVolumeClaimsTemplate(opts []PersistentVolumeOptions) *[]corev1.PersistentVolumeClaim

BuildVolumeClaimsTemplate returns a pointer to a slice of PVCs - for use with stateful sets

func ClusterRole

func ClusterRole(opts RoleOptions) *rbacv1.ClusterRole

ClusterRole returns a pointer to a cluster role

func ClusterRoleBinding

func ClusterRoleBinding(opts RoleBindingOptions) *rbacv1.ClusterRoleBinding

ClusterRoleBinding returns a pointer to a cluster role binding

func ConfigMap

func ConfigMap(opts ConfigMapOptions) *corev1.ConfigMap

ConfigMap returns a pointer to a config map object

func Container

func Container(opts ContainerOptions) *corev1.Container

Container returns a pointer to a container object

func CronJob

func CronJob(opts CronJobOptions) *batchv1beta1.CronJob

CronJob returns a pointer to a cron job object

func CustomResourceDefinition

func CustomResourceDefinition(opts CustomResourceDefinitionOptions) *v1.CustomResourceDefinition

CustomResourceDefinition returns a pointer to a custom resource definition object

func DaemonSet

func DaemonSet(opts DaemonSetOptions) *appsv1.DaemonSet

DaemonSet returns a pointer to a daemon set object

func Deployment

func Deployment(opts DeploymentOptions) *appsv1.Deployment

Deployment returns a pointer to a deployment object

func Ingress

func Ingress(opts IngressOptions) *v1.Ingress

Ingress returns a pointer to an ingress object

func Job

func Job(opts JobOptions) *batchv1.Job

Job returns a pointer to a job object

func PersistentVolumeClaim

func PersistentVolumeClaim(opts PersistentVolumeOptions) *corev1.PersistentVolumeClaim

PersistentVolumeClaim returns a pointer to a persistent volume claim

func PodDisruptionBudget

PodDisruptionBudget returns a pointer to a pod disruption budget

func PodTemplate

func PodTemplate(opts PodTemplateOptions) *corev1.PodTemplateSpec

PodTemplate returns a pointer to a pod template spec object

func Probe

func Probe(opts ProbeOptions) v1.Probe

Probe returns a k8s Probe object

func Role

func Role(opts RoleOptions) *rbacv1.Role

Role returns a pointer to a role

func RoleBinding

func RoleBinding(opts RoleBindingOptions) *rbacv1.RoleBinding

RoleBinding returns a pointer to a role binding

func Service

func Service(opts ServiceOptions) *corev1.Service

Service returns a pointer to a service object

func ServiceAccount

func ServiceAccount(opts ServiceAccountOptions) *corev1.ServiceAccount

ServiceAccount returns a pointer to a service account

func StatefulSet

func StatefulSet(opts StatefulSetOptions) *appsv1.StatefulSet

StatefulSet returns a pointer to a stateful set

Types

type ConfigMapOptions

type ConfigMapOptions struct {
	Name   string
	Labels map[string]string
	Data   map[string]string
}

ConfigMapOptions represents fields that can be passed in to create a config map

type ContainerOptions

type ContainerOptions struct {
	Name            string
	Image           string
	Command         []string
	Env             []corev1.EnvVar
	Args            []string
	Ports           []corev1.ContainerPort
	EnvFrom         []corev1.EnvFromSource
	VolumeMounts    []corev1.VolumeMount
	Resources       corev1.ResourceRequirements
	ImagePullPolicy corev1.PullPolicy
	SecurityContext corev1.SecurityContext
	Lifecycle       corev1.Lifecycle
	LivenessProbe   corev1.Probe
	ReadinessProbe  corev1.Probe
	WorkingDir      string
}

ContainerOptions represents fields that can be passed in to create a container

type CronJobOptions

type CronJobOptions struct {
	Name              string
	Labels            map[string]string
	Annotations       map[string]string
	JobTemplate       batchv1beta1.JobTemplateSpec
	ConcurrencyPolicy batchv1beta1.ConcurrencyPolicy
}

CronJobOptions represents fields that can be passed in to create a cron job

type CustomResourceDefinitionOptions

type CustomResourceDefinitionOptions struct {
	Name        string
	Labels      map[string]string
	Annotations map[string]string
	Kind        string
	Group       string
	Plural      string
	Scope       v1.ResourceScope
}

CustomResourceDefinitionOptions represents fields that can be passed in to create a custom resource definition

type DaemonSetOptions

type DaemonSetOptions struct {
	Name           string
	PodTemplate    corev1.PodTemplateSpec
	Annotations    map[string]string
	Selector       map[string]string
	Labels         map[string]string
	UpdateStrategy appsv1.DaemonSetUpdateStrategy
}

DaemonSetOptions represents fields that can be passed in to create a daemon set

type DeploymentOptions

type DeploymentOptions struct {
	Name        string
	Replicas    *int32
	PodTemplate corev1.PodTemplateSpec
	Annotations map[string]string
}

DeploymentOptions represents fields that can be passed in to create a deployment

type ExecAction

type ExecAction struct {
	// Command is the command line to execute inside the container, the working directory for the
	// command  is root ('/') in the container's filesystem. The command is simply exec'd, it is
	// not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use
	// a shell, you need to explicitly call out to that shell.
	// Exit status of 0 is treated as live/healthy and non-zero is unhealthy.
	// +optional
	Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"`
}

ExecAction describes a "run in container" action.

type HTTPGetAction

type HTTPGetAction struct {
	// Path to access on the HTTP server.
	// +optional
	Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"`
	// Name or number of the port to access on the container.
	// Number must be in the range 1 to 65535.
	// Name must be an IANA_SVC_NAME.
	Port int32 `json:"port" protobuf:"bytes,2,opt,name=port"`
	// Host name to connect to, defaults to the pod IP. You probably want to set
	// "Host" in httpHeaders instead.
	// +optional
	Host string `json:"host,omitempty" protobuf:"bytes,3,opt,name=host"`
	// Scheme to use for connecting to the host.
	// Defaults to HTTP.
	// +optional
	Scheme URIScheme `json:"scheme,omitempty" protobuf:"bytes,4,opt,name=scheme,casttype=URIScheme"`
	// Custom headers to set in the request. HTTP allows repeated headers.
	// +optional
	HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty" protobuf:"bytes,5,rep,name=httpHeaders"`
}

HTTPGetAction describes an action based on HTTP Get requests.

type HTTPHeader

type HTTPHeader struct {
	// The header field name
	Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
	// The header field value
	Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}

HTTPHeader describes a custom header to be used in HTTP probes

type Handler

type Handler struct {
	// One and only one of the following should be specified.
	// Exec specifies the action to take.
	// +optional
	Exec *ExecAction `json:"exec,omitempty" protobuf:"bytes,1,opt,name=exec"`
	// HTTPGet specifies the http request to perform.
	// +optional
	HTTPGet *HTTPGetAction `json:"httpGet,omitempty" protobuf:"bytes,2,opt,name=httpGet"`
	// TCPSocket specifies an action involving a TCP port.
	// TCP hooks not yet supported
	// TODO: implement a realistic TCP lifecycle hook
	// +optional
	TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty" protobuf:"bytes,3,opt,name=tcpSocket"`
}

Handler defines a specific action that should be taken TODO: pass structured data to these actions, and document that data here.

type IngressOptions

type IngressOptions struct {
	Name               string            `json:"name"`
	Rules              []v1.IngressRule  `json:"rules"`
	TLS                []v1.IngressTLS   `json:"tls,omitempty"`
	Annotations        map[string]string `json:"annotations,omitempty"`
	GoogleGlobalIPName string            `json:"googleGlobalIPName,omitempty"`
}

IngressOptions represents fields that can be passed in to create an ingress

type JobOptions

type JobOptions struct {
	Name                  string
	Labels                map[string]string
	Annotations           map[string]string
	PodTemplate           corev1.PodTemplateSpec
	BackoffLimit          *int32
	ActiveDeadlineSeconds *int64
}

JobOptions represents fields that can be passed in to create a job

type Manifest

type Manifest struct {
	CoreList v1.List
}

Manifest represents a container for runtime objects that can be encoded into a valid Kubernetes manifest

func (*Manifest) Append

func (m *Manifest) Append(objects ...runtime.Object)

Append adds a runtime object to a Manifest

func (*Manifest) Serialize

func (m *Manifest) Serialize(stream io.Writer) error

Serialize encodes items in a manifest and writes them to a designated writer

type NamespaceOptions

type NamespaceOptions struct {
	Name   string
	Labels map[string]string
}

NamespaceOptions represents fields that can be passed in to create a namespace

type PersistentVolumeOptions

type PersistentVolumeOptions struct {
	Name        string
	AccessModes []corev1.PersistentVolumeAccessMode
	Storage     string
	Annotations map[string]string
}

PersistentVolumeOptions represents fields that can be passed in to create a persistent volume/persistent volume claim

type PodDisruptionBudgetOptions

type PodDisruptionBudgetOptions struct {
	Name           string
	MaxUnavailable int32
	Labels         map[string]string
	MatchLabels    map[string]string
	Selector       metav1.LabelSelector
}

PodDisruptionBudgetOptions represents fields that can be passed in to create a pod disruption budget

type PodTemplateOptions

type PodTemplateOptions struct {
	Name                          string
	Containers                    []corev1.Container
	NodeSelector                  map[string]string
	RestartPolicy                 corev1.RestartPolicy
	ServiceAccountName            string
	InitContainers                []corev1.Container
	HostNetworkingEnabled         bool
	Volumes                       []corev1.Volume
	Annotations                   map[string]string
	Labels                        map[string]string
	TerminationGracePeriodSeconds *int64
	Affinity                      corev1.Affinity
	SecurityContext               corev1.PodSecurityContext
}

PodTemplateOptions represents fields that can be passed in to create a pod template spec

type ProbeOptions

type ProbeOptions struct {
	// The action taken to determine the health of a container
	Handler `json:",inline" protobuf:"bytes,1,opt,name=handler"`
	// Number of seconds after the container has started before liveness probes are initiated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	// +optional
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty" protobuf:"varint,2,opt,name=initialDelaySeconds"`
	// Number of seconds after which the probe times out.
	// Defaults to 1 second. Minimum value is 1.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	// +optional
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"`
	// How often (in seconds) to perform the probe.
	// Default to 10 seconds. Minimum value is 1.
	// +optional
	PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"`
	// Minimum consecutive successes for the probe to be considered successful after having failed.
	// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
	// +optional
	SuccessThreshold int32 `json:"successThreshold,omitempty" protobuf:"varint,5,opt,name=successThreshold"`
	// Minimum consecutive failures for the probe to be considered failed after having succeeded.
	// Defaults to 3. Minimum value is 1.
	// +optional
	FailureThreshold int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"`
}

ProbeOptions describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

type RoleBindingOptions

type RoleBindingOptions struct {
	Name     string
	Subjects []rbacv1.Subject
	RoleRef  rbacv1.RoleRef
	Labels   map[string]string
}

type RoleOptions

type RoleOptions struct {
	Name   string
	Rules  []rbacv1.PolicyRule
	Labels map[string]string
}

RoleOptions represents fields that can be passed in to create a role or cluster role

type ServiceAccountOptions

type ServiceAccountOptions struct {
	Name   string
	Labels map[string]string
}

ServiceAccountOptions represents fields that can be passed in to create a service account

type ServiceOptions

type ServiceOptions struct {
	Name                   string
	Ports                  []corev1.ServicePort
	BackendConfig          string // example '{"ports":{"80":"nginx-backend-config"}}'
	Type                   corev1.ServiceType
	Selector               map[string]string
	Labels                 map[string]string
	Annotations            map[string]string
	LoadBalancerIP         string
	ClusterIP              string // Can be set to "None" to create a headless service
	PublishNotReadyAddress bool   // https://kubernetes.io/docs/reference/kubernetes-api/services-resources/service-v1/#ServiceSpec
}

ServiceOptions represents fields that can be passed in to create a service

type StatefulSetOptions

type StatefulSetOptions struct {
	Name                string
	Replicas            int32
	PodTemplate         corev1.PodTemplateSpec
	Annotations         map[string]string
	RestartPolicy       corev1.RestartPolicy
	PVCs                []corev1.PersistentVolumeClaim
	Selector            map[string]string
	Labels              map[string]string
	PodManagementPolicy appsv1.PodManagementPolicyType
}

StatefulSetOptions represents fields that can be passed in to create a stateful set

type TCPSocketAction

type TCPSocketAction struct {
	// Number or name of the port to access on the container.
	// Number must be in the range 1 to 65535.
	// Name must be an IANA_SVC_NAME.
	Port int32 `json:"port" protobuf:"bytes,1,opt,name=port"`
	// Optional: Host name to connect to, defaults to the pod IP.
	// +optional
	Host string `json:"host,omitempty" protobuf:"bytes,2,opt,name=host"`
}

TCPSocketAction describes an action based on opening a socket

type URIScheme

type URIScheme string

URIScheme identifies the scheme used for connection to a host for Get actions

type WebhookOptions

type WebhookOptions struct {
	Name         string
	Labels       map[string]string
	ClientConfig adregv1beta1.WebhookClientConfig
}

WebhookOptions represents fields that can be passed in to create a mutating webhook

Jump to

Keyboard shortcuts

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