factory

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const HostnameLabel = "kubernetes.io/hostname"
View Source
const LabelPrefix = "hexagon.hanapedia.link"
View Source
const METRICS_PORT_NAME = "metrics"

Variables

View Source
var AppLabel = fmt.Sprintf("%v/app", LabelPrefix)
View Source
var ServiceUnitVariantLabel = fmt.Sprintf("%v/variant", LabelPrefix)

Functions

func GetConfigMapVolume

func GetConfigMapVolume(key string, arg *ConfigMapVolumeArgs) corev1.Volume

GetConfigMapVolume creates the cofigmap volume entry

func NewConfigMap

func NewConfigMap(args *ConfigMapArgs) corev1.ConfigMap

NewConfigMap create config map

func NewContainer

func NewContainer(args *DeploymentArgs) []corev1.Container

NewContainer create container

func NewContainerPort

func NewContainerPort(ports map[string]int32) []corev1.ContainerPort

NewContainerPort create container port slice

func NewDeployment

func NewDeployment(args *DeploymentArgs) appsv1.Deployment

NewDeployment create Deployment

func NewDeploymentSpec

func NewDeploymentSpec(args *DeploymentArgs) appsv1.DeploymentSpec

NewDeploymentSpec create deployment specs

func NewKafkaTopic

func NewKafkaTopic(args *KafkaTopicArgs) crd.KafkaTopic

NewKafkaTopic creates kafka topic custom resource defined by strimzi.io

func NewLabelSelector

func NewLabelSelector(matchLabels map[string]string) *metav1.LabelSelector

NewLabelSelector create lable selector

func NewLocalObjectReference

func NewLocalObjectReference(name string) *corev1.LocalObjectReference

NewLocalObjectReference create lable selector

func NewNamespace

func NewNamespace(args *NamespaceArgs) corev1.Namespace

NewNamespace create type namespace kubernetes objects.

func NewNetworkChaos

func NewNetworkChaos(args *NetworkChaosArgs) crd.NetworkChaos

NewNetworkChaos create type network chaos kubernetes custom resource objects for chaos-mesh.

func NewNetworkChaosSpec

func NewNetworkChaosSpec(args *NetworkChaosArgs) crd.NetworkChaosSpec

NewNetworkChaosSpec create type namespace kubernetes objects.

func NewObjectMeta

func NewObjectMeta(options ObjectMetaOptions) metav1.ObjectMeta

NewObjectMeta object meta data with name and namespace

func NewPodSpec

func NewPodSpec(args *DeploymentArgs) corev1.PodSpec

NewPodSpec create pod spec

func NewPodTemplate

func NewPodTemplate(args *DeploymentArgs) corev1.PodTemplateSpec

NewPodTemplate create pod template

func NewReadinessProbe added in v1.0.14

func NewReadinessProbe(args *DeploymentArgs) *corev1.Probe

TODO: parameterize magic number

func NewSerivce

func NewSerivce(args *ServiceArgs) corev1.Service

NewSerivce create new service api object

func NewServiceMonitor added in v1.0.10

func NewServiceMonitor(args *ServiceMonitorArgs) promv1.ServiceMonitor

NewServiceMonitor creates ServiceMonitor Custom Resource defined by github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring

func NewServicePort

func NewServicePort(ports map[string]int32) []corev1.ServicePort

NewServicePort create service port slice

func NewTopologySpreadConstraint added in v1.0.10

func NewTopologySpreadConstraint(args *DeploymentArgs) []corev1.TopologySpreadConstraint

TODO: parameterize magic number

func NewTypeMeta

func NewTypeMeta(kind string, apiVersion string) metav1.TypeMeta

NewTypeMeta create type meta for all kubernetes objects.

func NewVolume

func NewVolume(configVolumeArgs *ConfigMapVolumeArgs) []corev1.Volume

NewVolume create volume

func NewVolumeMount

func NewVolumeMount(volumes map[string]string) []corev1.VolumeMount

NewVolumeMount create container port slice

Types

type ConfigMapArgs

type ConfigMapArgs struct {
	Name      string
	Namespace string
	Data      map[string]string
}

type ConfigMapVolumeArgs

type ConfigMapVolumeArgs struct {
	Name  string
	Items map[string]string
}

type DeploymentArgs

type DeploymentArgs struct {
	Name                           string
	Namespace                      string
	Annotations                    map[string]string
	Image                          string
	Replicas                       int32
	Resource                       *corev1.ResourceRequirements
	Ports                          map[string]int32
	VolumeMounts                   map[string]string
	Envs                           []corev1.EnvVar
	ConfigVolume                   *ConfigMapVolumeArgs
	EnableTopologySpreadConstraint bool
	DisableReadinessProbe          bool
	ReadinessProbePort             intstr.IntOrString
}

type KafkaTopicArgs

type KafkaTopicArgs struct {
	Topic       string
	ClusterName string
	Namespace   string
	Partitions  int32
	Replicas    int32
}

type NamespaceArgs

type NamespaceArgs struct {
	Name        string
	Annotations map[string]string
}

type NetworkChaosArgs

type NetworkChaosArgs struct {
	Name            string
	Namespace       string
	TargetNamespace string
	Selector        map[string]string
	Duration        string
	Latency         string
	Jitter          string
}

type ObjectMetaOptions

type ObjectMetaOptions struct {
	Name        string
	Namespace   string
	Labels      map[string]string
	Annotations map[string]string
}

type ServiceArgs

type ServiceArgs struct {
	Name      string
	Namespace string
	// ports are assumed to use TCP
	// ports are mapped to same target port
	Ports map[string]int32
}

type ServiceMonitorArgs added in v1.0.10

type ServiceMonitorArgs struct {
	Name      string
	Namespace string
}

type ServiceUnitVariantValues added in v1.0.10

type ServiceUnitVariantValues float64
const (
	STATELESS ServiceUnitVariantValues = iota
	STATEFULL
	LOAD_GENERATOR
)

func (ServiceUnitVariantValues) AsString added in v1.0.10

func (suvv ServiceUnitVariantValues) AsString() string

Jump to

Keyboard shortcuts

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