kuberesource

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceMeshIngressEgress sets the service mesh mode to ingress and egress.
	ServiceMeshIngressEgress serviceMeshMode = "service-mesh-ingress-egress"
	// ServiceMeshDisabled disables the service mesh.
	ServiceMeshDisabled serviceMeshMode = "service-mesh-disabled"
)

Variables

This section is empty.

Functions

func AddInitializer

func AddInitializer(
	resource any,
	initializer *applycorev1.ContainerApplyConfiguration,
) (res any, retErr error)

AddInitializer adds an initializer and its shared volume to the resource.

If the resource does not contain a PodSpec, this function does nothing. This function is idempotent.

func AddLoadBalancers

func AddLoadBalancers(resources []any) []any

AddLoadBalancers adds a load balancer to each Service resource.

func AddLogging

func AddLogging(resources []any, level string) []any

AddLogging modifies Contrast Coordinators among the resources to enable debug logging.

func AddPortForwarders

func AddPortForwarders(resources []any) []any

AddPortForwarders adds a port-forwarder for each Service resource.

func AddServiceMesh

func AddServiceMesh(
	resource any,
	serviceMeshProxy *applycorev1.ContainerApplyConfiguration,
) (res any, retErr error)

AddServiceMesh adds a service mesh proxy to the resource with the proxy configuration given in the object annotations.

If the resource does not contain a PodSpec, this function does nothing. This function is idempotent.

func CoordinatorBundle added in v0.7.0

func CoordinatorBundle() []any

CoordinatorBundle returns the Coordinator and a matching Service.

func Emojivoto

func Emojivoto(smMode serviceMeshMode) []any

Emojivoto returns resources for deploying Emojivoto application.

func EncodeResources

func EncodeResources(resources ...any) ([]byte, error)

EncodeResources encodes a list of apply configurations into a single YAML document.

func EncodeUnstructured

func EncodeUnstructured(resources []*unstructured.Unstructured) ([]byte, error)

EncodeUnstructured encodes a list of unstructured resources into a single YAML document.

func GenpolicyRegressionTests added in v0.8.0

func GenpolicyRegressionTests() map[string]*applyappsv1.DeploymentApplyConfiguration

GenpolicyRegressionTests returns deployments for regression testing genpolicy.

func GetDEnts

func GetDEnts() ([]any, error)

GetDEnts returns a set of resources for testing getdents entry limits.

func ImageReplacementsFromFile

func ImageReplacementsFromFile(file io.Reader) (map[string]string, error)

ImageReplacementsFromFile parses the containerlookup file into a map.

The file is expected to contain newline-separated pairs of images and their intended replacement, separated by an = sign. Empty lines and lines starting with the pound character are ignored. This file is populated by container image build rules in the justfile.

func Initializer

Initializer creates a new InitializerConfig.

func MapPodSpec

MapPodSpec applies a function to a PodSpec in a Kubernetes resource.

func MapPodSpecWithMeta added in v0.7.0

MapPodSpecWithMeta applies a function to a PodSpec in a Kubernetes resource, and its corresponding object metadata.

func Namespace

Namespace creates a new NamespaceConfig.

func NewEnvVar

func NewEnvVar(name, value string) *applycorev1.EnvVarApplyConfiguration

NewEnvVar creates a new EnvVarApplyConfiguration from name and value.

func OpenSSL

func OpenSSL() []any

OpenSSL returns a set of resources for testing with OpenSSL.

func Overhead

Overhead creates a new OverheadApplyConfiguration.

func PatchCoordinatorMetrics added in v0.7.0

func PatchCoordinatorMetrics(resources []any, port int32) []any

PatchCoordinatorMetrics enables Coordinator metrics on the specified port.

func PatchImages

func PatchImages(resources []any, replacements map[string]string) []any

PatchImages replaces images in a set of resources.

func PatchNamespaces

func PatchNamespaces(resources []any, namespace string) []any

PatchNamespaces replaces namespaces in a set of resources.

func PatchServiceMeshAdminInterface added in v0.7.0

func PatchServiceMeshAdminInterface(resources []any, port int32) []any

PatchServiceMeshAdminInterface activates the admin interface on the specified port for all Service Mesh components in a set of resources.

func PortForwarderForService

PortForwarderForService creates a Pod that forwards network traffic to the given service.

Port forwarders are named "port-forwarder-SVCNAME" and forward the first port in the ServiceSpec.

func Probe

Probe creates a new ProbeApplyConfiguration.

func ResourcesToUnstructured

func ResourcesToUnstructured(resources []any) ([]*unstructured.Unstructured, error)

ResourcesToUnstructured converts a list of resources into a list of unstructured resources.

func Runtime

func Runtime(platform platforms.Platform) ([]any, error)

Runtime returns a set of resources for registering and installing the runtime.

func Scheduling

Scheduling creates a new SchedulingApplyConfiguration.

func ServiceForDeployment

ServiceForDeployment creates a service for a deployment by exposing the configured ports of the deployment's first container.

func ServiceForStatefulSet added in v0.7.0

ServiceForStatefulSet creates a service for a StatefulSet by exposing the configured ports of the first container.

func ServiceMeshProxy

func ServiceMeshProxy() *applycorev1.ContainerApplyConfiguration

ServiceMeshProxy creates a new service mesh proxy sidecar container.

func TCPSocketAction

TCPSocketAction creates a new TCPSocketActionApplyConfiguration.

func UnmarshalApplyConfigurations

func UnmarshalApplyConfigurations(data []byte) ([]any, error)

UnmarshalApplyConfigurations unmarshals a YAML document into a list of ApplyConfigurations.

Types

type ContainerConfig

type ContainerConfig struct {
	*applycorev1.ContainerApplyConfiguration
}

ContainerConfig wraps applycorev1.ContainerApplyConfiguration.

func Container

func Container() *ContainerConfig

Container creates a new ContainerConfig.

type ContainerPortConfig

type ContainerPortConfig struct {
	*applycorev1.ContainerPortApplyConfiguration
}

ContainerPortConfig wraps applycorev1.ContainerPortApplyConfiguration.

func ContainerPort

func ContainerPort() *ContainerPortConfig

ContainerPort creates a new ContainerPortConfig.

type CoordinatorConfig

type CoordinatorConfig struct {
	*applyappsv1.StatefulSetApplyConfiguration
}

CoordinatorConfig wraps applyappsv1.DeploymentApplyConfiguration for a coordinator.

func Coordinator

func Coordinator(namespace string) *CoordinatorConfig

Coordinator constructs a new CoordinatorConfig.

func (*CoordinatorConfig) WithImage

func (c *CoordinatorConfig) WithImage(image string) *CoordinatorConfig

WithImage sets the image of the coordinator.

type DaemonSetConfig

type DaemonSetConfig struct {
	*applyappsv1.DaemonSetApplyConfiguration
}

DaemonSetConfig wraps applyappsv1.DaemonSetApplyConfiguration.

func DaemonSet

func DaemonSet(name, namespace string) *DaemonSetConfig

DaemonSet creates a new DaemonSetConfig.

type DaemonSetSpecConfig

type DaemonSetSpecConfig struct {
	*applyappsv1.DaemonSetSpecApplyConfiguration
}

DaemonSetSpecConfig wraps applyappsv1.DaemonSetSpecApplyConfiguration.

func DaemonSetSpec

func DaemonSetSpec() *DaemonSetSpecConfig

DaemonSetSpec creates a new DaemonSetSpecConfig.

type DeploymentConfig

type DeploymentConfig struct {
	*applyappsv1.DeploymentApplyConfiguration
}

DeploymentConfig wraps applyappsv1.DeploymentApplyConfiguration.

func Deployment

func Deployment(name, namespace string) *DeploymentConfig

Deployment creates a new DeploymentConfig.

type DeploymentSpecConfig

type DeploymentSpecConfig struct {
	*applyappsv1.DeploymentSpecApplyConfiguration
}

DeploymentSpecConfig wraps applyappsv1.DeploymentSpecApplyConfiguration.

func DeploymentSpec

func DeploymentSpec() *DeploymentSpecConfig

DeploymentSpec creates a new DeploymentSpecConfig.

type EmptyDirVolumeSourceConfig

type EmptyDirVolumeSourceConfig struct {
	*applycorev1.EmptyDirVolumeSourceApplyConfiguration
}

EmptyDirVolumeSourceConfig wraps applycorev1.EmptyDirVolumeSourceApplyConfiguration.

func EmptyDirVolumeSource

func EmptyDirVolumeSource() *EmptyDirVolumeSourceConfig

EmptyDirVolumeSource creates a new EmptyDirVolumeSourceConfig.

func (*EmptyDirVolumeSourceConfig) Inner

Inner returns the inner applycorev1.EmptyDirVolumeSourceApplyConfiguration.

type EnvVarConfig

type EnvVarConfig struct {
	*applycorev1.EnvVarApplyConfiguration
}

EnvVarConfig wraps applycorev1.EnvVarApplyConfiguration.

func EnvVar

func EnvVar() *EnvVarConfig

EnvVar creates a new EnvVarConfig.

type HostPathVolumeSourceConfig

type HostPathVolumeSourceConfig struct {
	*applycorev1.HostPathVolumeSourceApplyConfiguration
}

HostPathVolumeSourceConfig wraps applycorev1.HostPathVolumeSourceApplyConfiguration.

func HostPathVolumeSource

func HostPathVolumeSource() *HostPathVolumeSourceConfig

HostPathVolumeSource creates a new HostPathVolumeSourceConfig.

func (*HostPathVolumeSourceConfig) Inner

Inner returns the inner applycorev1.HostPathVolumeSourceApplyConfiguration.

type LabelSelectorConfig

type LabelSelectorConfig struct {
	*applymetav1.LabelSelectorApplyConfiguration
}

LabelSelectorConfig wraps applymetav1.LabelSelectorApplyConfiguration.

func LabelSelector

func LabelSelector() *LabelSelectorConfig

LabelSelector creates a new LabelSelectorConfig.

type NamespaceConfig

type NamespaceConfig struct {
	*applycorev1.NamespaceApplyConfiguration
}

NamespaceConfig wraps applycorev1.NamespaceApplyConfiguration.

type NodeInstallerConfig

type NodeInstallerConfig struct {
	*applyappsv1.DaemonSetApplyConfiguration
}

NodeInstallerConfig wraps a DaemonSetApplyConfiguration for a node installer.

func NodeInstaller

func NodeInstaller(namespace string, platform platforms.Platform) (*NodeInstallerConfig, error)

NodeInstaller constructs a node installer daemon set.

type PodConfig

type PodConfig struct {
	*applycorev1.PodApplyConfiguration
}

PodConfig wraps applyappsv1.PodApplyConfiguration.

func Pod

func Pod(name, namespace string) *PodConfig

Pod creates a new PodConfig.

type PodSpecConfig

type PodSpecConfig struct {
	*applycorev1.PodSpecApplyConfiguration
}

PodSpecConfig wraps applycorev1.PodSpecApplyConfiguration.

func PodSpec

func PodSpec() *PodSpecConfig

PodSpec creates a new PodSpecConfig.

type PodTemplateSpecConfig

type PodTemplateSpecConfig struct {
	*applycorev1.PodTemplateSpecApplyConfiguration
}

PodTemplateSpecConfig wraps applycorev1.PodTemplateSpecApplyConfiguration.

func PodTemplateSpec

func PodTemplateSpec() *PodTemplateSpecConfig

PodTemplateSpec creates a new PodTemplateSpecConfig.

type PortForwarderConfig

type PortForwarderConfig struct {
	*applycorev1.PodApplyConfiguration
}

PortForwarderConfig wraps a PodApplyConfiguration for a port forwarder.

func PortForwarder

func PortForwarder(name, namespace string) *PortForwarderConfig

PortForwarder constructs a port forwarder pod.

func (*PortForwarderConfig) WithForwardTarget

func (p *PortForwarderConfig) WithForwardTarget(host string, port int32) *PortForwarderConfig

WithForwardTarget sets the target host and port to forward to.

func (*PortForwarderConfig) WithListenPort

func (p *PortForwarderConfig) WithListenPort(port int32) *PortForwarderConfig

WithListenPort sets the port to listen on.

type ResourceRequirementsConfig

type ResourceRequirementsConfig struct {
	*applycorev1.ResourceRequirementsApplyConfiguration
}

ResourceRequirementsConfig wraps applycorev1.ResourceRequirementsApplyConfiguration.

func ResourceRequirements

func ResourceRequirements() *ResourceRequirementsConfig

ResourceRequirements creates a new ResourceRequirementsConfig.

func (*ResourceRequirementsConfig) WithCPURequest

WithCPURequest sets the CPU request of the ResourceRequirements.

func (*ResourceRequirementsConfig) WithMemoryLimitAndRequest

WithMemoryLimitAndRequest sets the memory limit and request of the ResourceRequirements.

func (*ResourceRequirementsConfig) WithMemoryRequest

WithMemoryRequest sets the memory request of the ResourceRequirements.

type RuntimeClassConfig

type RuntimeClassConfig struct {
	*applynodev1.RuntimeClassApplyConfiguration
}

RuntimeClassConfig wraps applypodsv1.RuntimeClassApplyConfiguration for a runtime class.

func ContrastRuntimeClass

func ContrastRuntimeClass() *RuntimeClassConfig

ContrastRuntimeClass creates a new RuntimeClassConfig.

func RuntimeClass

func RuntimeClass(name string) *RuntimeClassConfig

RuntimeClass constructs a new RuntimeClassConfig.

type SecurityContextConfig

type SecurityContextConfig struct {
	*applycorev1.SecurityContextApplyConfiguration
}

SecurityContextConfig wraps applycorev1.SecurityContextApplyConfiguration.

func SecurityContext

func SecurityContext() *SecurityContextConfig

SecurityContext creates a new SecurityContextConfig.

func (*SecurityContextConfig) AddCapabilities

func (s *SecurityContextConfig) AddCapabilities(capabilities ...corev1.Capability) *SecurityContextConfig

AddCapabilities appends the given capabilities to the add list.

func (*SecurityContextConfig) WithPrivileged

func (s *SecurityContextConfig) WithPrivileged(privileged bool) *SecurityContextConfig

WithPrivileged sets the Privileged field in the declarative configuration to the given value.

type ServiceAccountConfig

type ServiceAccountConfig struct {
	*applycorev1.ServiceAccountApplyConfiguration
}

ServiceAccountConfig wraps applycorev1.ServiceAccountApplyConfiguration.

func ServiceAccount

func ServiceAccount(name, namespace string) *ServiceAccountConfig

ServiceAccount creates a new ServiceAccountConfig.

type ServiceConfig

type ServiceConfig struct {
	*applycorev1.ServiceApplyConfiguration
}

ServiceConfig wraps applycorev1.ServiceApplyConfiguration.

func Service

func Service(name, namespace string) *ServiceConfig

Service creates a new ServiceConfig.

type ServicePortConfig

type ServicePortConfig struct {
	*applycorev1.ServicePortApplyConfiguration
}

ServicePortConfig wraps applycorev1.ServicePortApplyConfiguration.

func ServicePort

func ServicePort() *ServicePortConfig

ServicePort creates a new ServicePortConfig.

type ServiceSpecConfig

type ServiceSpecConfig struct {
	*applycorev1.ServiceSpecApplyConfiguration
}

ServiceSpecConfig wraps applycorev1.ServiceSpecApplyConfiguration.

func ServiceSpec

func ServiceSpec() *ServiceSpecConfig

ServiceSpec creates a new ServiceSpecConfig.

type StatefulSetConfig added in v0.7.0

type StatefulSetConfig struct {
	*applyappsv1.StatefulSetApplyConfiguration
}

StatefulSetConfig wraps applyappsv1.StatefulSetApplyConfiguration.

func StatefulSet added in v0.7.0

func StatefulSet(name, namespace string) *StatefulSetConfig

StatefulSet creates a new StatefulSetConfig.

type StatefulSetSpecConfig added in v0.7.0

type StatefulSetSpecConfig struct {
	*applyappsv1.StatefulSetSpecApplyConfiguration
}

StatefulSetSpecConfig wraps applyappsv1.StatefulSetSpecApplyConfiguration.

func StatefulSetSpec added in v0.7.0

func StatefulSetSpec() *StatefulSetSpecConfig

StatefulSetSpec creates a new StatefulSetSpecConfig.

type VolumeConfig

type VolumeConfig struct {
	*applycorev1.VolumeApplyConfiguration
}

VolumeConfig wraps applycorev1.VolumeApplyConfiguration.

func Volume

func Volume() *VolumeConfig

Volume creates a new VolumeConfig.

type VolumeMountConfig

type VolumeMountConfig struct {
	*applycorev1.VolumeMountApplyConfiguration
}

VolumeMountConfig wraps applycorev1.VolumeMountApplyConfiguration.

func VolumeMount

func VolumeMount() *VolumeMountConfig

VolumeMount creates a new VolumeMountConfig.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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