runtime

package
v0.0.0-...-fbbe22e Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Codecs is a codec factory for the default scheme, including core and our custom types.

Functions

func Decode

func Decode(manifest string) runtime.Object

Decode JSON or YAML resource manifest to a new typed struct.

func GroupVersionKind

func GroupVersionKind(o runtime.Object) schema.GroupVersionKind

GroupVersionKind deduces the Kind from the Go type.

func ID

func ID(o runtime.Object) string

ID returns a human-readable identifier for the object, for debugging and tests.

func Initialize

func Initialize(o runtime.Object, namespace, name string, visitors ...func(o runtime.Object))

Initialize sets name, namespace and type metadata deduced from Go type.

func Labels

func Labels(o runtime.Object) map[string]string

Labels returns the labels map for object, guaratneed to be non-nil.

func Meta

func Meta(o runtime.Object) metav1.Object

Meta interface to get/set object metadata. Panics if o is not a metav1.Object, e.g. if it is a List type.

func NamespacedName

func NamespacedName(o client.Object) types.NamespacedName

NamespacedName returns the namespaced name of an object.

func NewClusterRole

func NewClusterRole(name string, rules ...rbacv1.PolicyRule) *rbacv1.ClusterRole

NewClusterRole returns a role with namespace, names, rules

func NewClusterRoleBinding

func NewClusterRoleBinding(name string, roleRef rbacv1.RoleRef, subjects ...rbacv1.Subject) *rbacv1.ClusterRoleBinding

NewClusterRoleBinding returns a role with namespace, names, rules

func NewConfigMap

func NewConfigMap(namespace, name string, data map[string]string, visitors ...func(o runtime.Object)) *corev1.ConfigMap

NewConfigMap returns a corev1.ConfigMap with namespace, name and data.

func NewContainer

func NewContainer(name string, image string, pullPolicy corev1.PullPolicy, resources *corev1.ResourceRequirements) *corev1.Container

NewContainer stubs an instance of a corev1.Container

func NewDaemonSet

func NewDaemonSet(namespace, name string, visitors ...func(o runtime.Object)) *appsv1.DaemonSet

NewDaemonSet returns a daemon set.

func NewDeployment

func NewDeployment(namespace, name string, visitors ...func(o runtime.Object)) *appsv1.Deployment

NewDeployment returns a deployment

func NewLogFileMetricExporter

func NewLogFileMetricExporter(namespace, name string) *loggingv1alpha1.LogFileMetricExporter

Returns a new default LogFileMetricExporter

func NewNamespace

func NewNamespace(name string) *corev1.Namespace

NewNamespace returns a corev1.Namespace with name.

func NewPod

func NewPod(namespace, name string, containers ...corev1.Container) *corev1.Pod

NewPod returns a corev1.Pod with namespace, name, containers.

func NewPolicyRule

func NewPolicyRule(apiGroups, resources, resourceNames, verbs []string) rbacv1.PolicyRule

NewPolicyRule stubs policy rule

func NewPolicyRules

func NewPolicyRules(rules ...rbacv1.PolicyRule) []rbacv1.PolicyRule

NewPolicyRules stubs policy rules

func NewPriorityClass

func NewPriorityClass(name string, priorityValue int32, globalDefault bool, description string) *scheduling.PriorityClass

NewPriorityClass is a constructor to create a PriorityClass

func NewPrometheusRule

func NewPrometheusRule(namespace, ruleName string) *monitoringv1.PrometheusRule

func NewPrometheusRuleSpecFrom

func NewPrometheusRuleSpecFrom(groups string) (*monitoringv1.PrometheusRuleSpec, error)

func NewRole

func NewRole(namespace, name string, rules ...rbacv1.PolicyRule) *rbacv1.Role

NewRole returns a role with namespace, names, rules

func NewRoleBinding

func NewRoleBinding(namespace, name string, roleRef rbacv1.RoleRef, subjects ...rbacv1.Subject) *rbacv1.RoleBinding

NewRoleBinding returns a role with namespace, names, rules

func NewRoute

func NewRoute(namespace, name, service, port string) *openshiftv1.Route

NewRoute returns an openshift.io/v1.Route with namespace and name to port on service.

func NewSecret

func NewSecret(namespace, name string, data map[string][]byte, visitors ...func(o runtime.Object)) *corev1.Secret

NewSecret returns a corev1.Secret with namespace and name.

func NewService

func NewService(namespace, name string, visitors ...func(o runtime.Object)) *corev1.Service

NewService returns a corev1.Service with namespace and name.

func NewServiceAccount

func NewServiceAccount(namespace, name string) *corev1.ServiceAccount

NewServiceAccount returns a corev1.ServiceAccount with namespace and name.

func NewServiceMonitor

func NewServiceMonitor(namespace, name string) *monitoringv1.ServiceMonitor

func NewSubject

func NewSubject(kind, name string) rbacv1.Subject

NewSubject stubs a new subject

func NewSubjects

func NewSubjects(subjects ...rbacv1.Subject) []rbacv1.Subject

NewSubjects stubs subjects

func Selectors

func Selectors(instanceName, component, name string) map[string]string

func ServiceDomainName

func ServiceDomainName(o runtime.Object) string

ServiceDomainName returns "name.namespace.svc".

func SetCommonLabels

func SetCommonLabels(object runtime.Object, name, instanceName, component string)

SetCommonLabels initialize given object labels with K8s Common labels These are recommended labels. They make it easier to manage applications but aren't required for any core tooling. https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels

func SvcClusterLocal

func SvcClusterLocal(namespace, name string) string

SvcClusterLocal returns the svc.cluster.local hostname for name and namespace.

Types

type ConfigMapBuilder

type ConfigMapBuilder struct {
	ConfigMap *corev1.ConfigMap
}

func NewConfigMapBuilder

func NewConfigMapBuilder(cm *corev1.ConfigMap) *ConfigMapBuilder

func (*ConfigMapBuilder) Add

func (builder *ConfigMapBuilder) Add(key, value string) *ConfigMapBuilder

func (*ConfigMapBuilder) AddAnnotation

func (builder *ConfigMapBuilder) AddAnnotation(key, value string) *ConfigMapBuilder

func (*ConfigMapBuilder) AddLabel

func (builder *ConfigMapBuilder) AddLabel(key, value string) *ConfigMapBuilder

type ContainerBuilder

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

func (*ContainerBuilder) AddContainerPort

func (builder *ContainerBuilder) AddContainerPort(name string, port int32) *ContainerBuilder

func (*ContainerBuilder) AddEnvVar

func (builder *ContainerBuilder) AddEnvVar(name, value string) *ContainerBuilder

func (*ContainerBuilder) AddEnvVarFromFieldRef

func (builder *ContainerBuilder) AddEnvVarFromFieldRef(name, fieldRef string) *ContainerBuilder

func (*ContainerBuilder) AddRunAsUser

func (builder *ContainerBuilder) AddRunAsUser(uid int64) *ContainerBuilder

func (*ContainerBuilder) AddVolumeMount

func (builder *ContainerBuilder) AddVolumeMount(name, path, subPath string, readonly bool) *ContainerBuilder

func (*ContainerBuilder) End

func (builder *ContainerBuilder) End() *PodBuilder

func (*ContainerBuilder) ResourceRequirements

func (builder *ContainerBuilder) ResourceRequirements(resources corev1.ResourceRequirements) *ContainerBuilder

func (*ContainerBuilder) Update

func (builder *ContainerBuilder) Update() *PodBuilder

func (*ContainerBuilder) WithCmd

func (builder *ContainerBuilder) WithCmd(cmdAgrgs []string) *ContainerBuilder

func (*ContainerBuilder) WithCmdArgs

func (builder *ContainerBuilder) WithCmdArgs(cmdArgs []string) *ContainerBuilder

func (*ContainerBuilder) WithImage

func (builder *ContainerBuilder) WithImage(image string) *ContainerBuilder

func (*ContainerBuilder) WithImagePullPolicy

func (builder *ContainerBuilder) WithImagePullPolicy(policy corev1.PullPolicy) *ContainerBuilder

func (*ContainerBuilder) WithPodSecurity

func (builder *ContainerBuilder) WithPodSecurity() *ContainerBuilder

func (*ContainerBuilder) WithPrivilege

func (builder *ContainerBuilder) WithPrivilege() *ContainerBuilder

type DaemonSetBuilder

type DaemonSetBuilder struct {
	DaemonSet *apps.DaemonSet
}

func NewDaemonSetBuilder

func NewDaemonSetBuilder(ds *apps.DaemonSet) *DaemonSetBuilder

func (*DaemonSetBuilder) WithPodSpec

func (builder *DaemonSetBuilder) WithPodSpec(podSpec core.PodSpec) *DaemonSetBuilder

func (*DaemonSetBuilder) WithSelector

func (builder *DaemonSetBuilder) WithSelector(selector map[string]string) *DaemonSetBuilder

func (*DaemonSetBuilder) WithTemplateAnnotations

func (builder *DaemonSetBuilder) WithTemplateAnnotations(annotations map[string]string) *DaemonSetBuilder

func (*DaemonSetBuilder) WithTemplateLabels

func (builder *DaemonSetBuilder) WithTemplateLabels(labels map[string]string) *DaemonSetBuilder

func (*DaemonSetBuilder) WithUpdateStrategy

func (builder *DaemonSetBuilder) WithUpdateStrategy(updateStrategy apps.DaemonSetUpdateStrategy) *DaemonSetBuilder

type DeploymentBuilder

type DeploymentBuilder struct {
	Deployment *apps.Deployment
}

func NewDeploymentBuilder

func NewDeploymentBuilder(ds *apps.Deployment) *DeploymentBuilder

func (*DeploymentBuilder) WithPodSpec

func (builder *DeploymentBuilder) WithPodSpec(podSpec core.PodSpec) *DeploymentBuilder

func (*DeploymentBuilder) WithReplicas

func (builder *DeploymentBuilder) WithReplicas(replicas *int32) *DeploymentBuilder

func (*DeploymentBuilder) WithSelector

func (builder *DeploymentBuilder) WithSelector(selector map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) WithTemplateAnnotations

func (builder *DeploymentBuilder) WithTemplateAnnotations(annotations map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) WithTemplateLabels

func (builder *DeploymentBuilder) WithTemplateLabels(labels map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) WithUpdateStrategy

func (builder *DeploymentBuilder) WithUpdateStrategy(updateStrategy apps.DeploymentStrategy) *DeploymentBuilder

type Object

type Object = runtime.Object

Object is an alias for this central type.

type PodBuilder

type PodBuilder struct {
	Pod *corev1.Pod
}

func NewPodBuilder

func NewPodBuilder(pod *corev1.Pod) *PodBuilder

func (*PodBuilder) AddAnnotation

func (builder *PodBuilder) AddAnnotation(key, value string) *PodBuilder

func (*PodBuilder) AddConfigMapVolume

func (builder *PodBuilder) AddConfigMapVolume(name, configMapName string) *PodBuilder

func (*PodBuilder) AddConfigMapVolumeWithPermissions

func (builder *PodBuilder) AddConfigMapVolumeWithPermissions(name, configMapName string, permissions *int32) *PodBuilder

func (*PodBuilder) AddConfigMapWith

func (builder *PodBuilder) AddConfigMapWith(name, configMapName string, handler func(corev1.Volume) corev1.Volume) *PodBuilder

func (*PodBuilder) AddContainer

func (builder *PodBuilder) AddContainer(name, image string) *ContainerBuilder

func (*PodBuilder) AddEmptyDirVolume

func (builder *PodBuilder) AddEmptyDirVolume(name string) *PodBuilder

func (*PodBuilder) AddHostAlias

func (builder *PodBuilder) AddHostAlias(hostAlias corev1.HostAlias) *PodBuilder

func (*PodBuilder) AddHostPathVolume

func (builder *PodBuilder) AddHostPathVolume(name, path string) *PodBuilder

func (*PodBuilder) AddInitContainer

func (builder *PodBuilder) AddInitContainer(name, image string) *ContainerBuilder

func (*PodBuilder) AddLabels

func (builder *PodBuilder) AddLabels(labels map[string]string) *PodBuilder

func (*PodBuilder) AddSecretVolume

func (builder *PodBuilder) AddSecretVolume(name, secretName string) *PodBuilder

func (*PodBuilder) GetContainer

func (builder *PodBuilder) GetContainer(name string) *ContainerBuilder

func (*PodBuilder) WithLabels

func (builder *PodBuilder) WithLabels(labels map[string]string) *PodBuilder

type PodBuilderVisitor

type PodBuilderVisitor func(builder *PodBuilder) error

PodBuilderVisitor provides the ability to manipulate the PodBuilder with custom logic

type ServiceBuilder

type ServiceBuilder struct {
	Service *corev1.Service
}

func NewServiceBuilder

func NewServiceBuilder(svc *corev1.Service) *ServiceBuilder

func (*ServiceBuilder) AddLabel

func (builder *ServiceBuilder) AddLabel(key, val string) *ServiceBuilder

func (*ServiceBuilder) AddServicePort

func (builder *ServiceBuilder) AddServicePort(port int32, targetPort int) *ServiceBuilder

func (*ServiceBuilder) WithSelector

func (builder *ServiceBuilder) WithSelector(selector map[string]string) *ServiceBuilder

func (*ServiceBuilder) WithServicePort

func (builder *ServiceBuilder) WithServicePort(servicePorts []corev1.ServicePort) *ServiceBuilder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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