common

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceNamePrefixEnv = "RESOURCE_NAME_PREFIX"
	ImagePullSecretEnv    = "IMAGE_PULL_SECRET"
	NSMRegistryServiceEnv = "NSM_REGISTRY_SERVICE"
	LogLevelEnv           = "LOG_LEVEL"
	NspServiceAccountEnv  = "NSP_SERVICE_ACCOUNT"
	FeServiceAccountEnv   = "FE_SERVICE_ACCOUNT"

	Registry        = "registry.nordix.org"
	Organization    = "cloud-native/meridio"
	OrganizationNsm = "cloud-native/nsm"
	Tag             = "latest"

	BusyboxImage = "busybox"
	BusyboxTag   = "1.29"

	SubnetPoolIpv4          = "172.16.0.0/16"
	SubnetPoolIpv6          = "fd00::/48"
	ConduitPrefixLengthIpv4 = "20"
	ConduitPrefixLengthIpv6 = "56"
	NodePrefixLengthIpv4    = "24"
	NodePrefixLengthIpv6    = "64"

	NspPort        = 7778
	NspTargetPort  = 7778
	IpamPort       = 7777
	IpamTargetPort = 7777
	VlanNsePort    = 5003

	IpamSvcName             = "ipam-service"
	NspSvcName              = "nsp-service"
	PodDisruptionBudgetName = "pdb"
	LBName                  = "stateless-lb-frontend"
	ProxyName               = "proxy"
	IpamName                = "ipam"
	NseName                 = "nse-vlan"
	NspName                 = "nsp"
	NspServiceAccountName   = "meridio-sa"
	CMName                  = "meridio-configuration"

	NetworkServiceName = "external-vlan"

	ResourceRequirementKey          = "resource-template"
	ResourceRequirementTemplatePath = "template/resource"
)

Variables

View Source
var (
	LivenessTimer = probeTimer{
					// contains filtered or unexported fields
	}

	ReadinessTimer = probeTimer{
					// contains filtered or unexported fields
	}

	StartUpTimer = probeTimer{
					// contains filtered or unexported fields
	}
)

Functions

func CompileEnvironmentVariables

func CompileEnvironmentVariables(allEnv []corev1.EnvVar, operatorEnv map[string]string) []corev1.EnvVar

func ConfigMapName

func ConfigMapName(trench *meridiov1alpha1.Trench) string

func FEServiceAccountName

func FEServiceAccountName() string

func GetContainerResourceRequirements

func GetContainerResourceRequirements(containerName, templateName string) (*corev1.ResourceRequirements, error)

GetContainerResourceRequirements - Reads and searches template resource requirements for container. (A template resource requirement with param 'templateName' must exist for a match)

func GetDaemonsetModel

func GetDaemonsetModel(f string) (*appsv1.DaemonSet, error)

func GetDeploymentModel

func GetDeploymentModel(f string) (*appsv1.Deployment, error)

func GetExternalInterfaceName

func GetExternalInterfaceName(attractor *meridiov1alpha1.Attractor) string

func GetIPFamily

func GetIPFamily(cr *meridiov1alpha1.Trench) string

func GetImagePullSecrets

func GetImagePullSecrets() []corev1.LocalObjectReference

func GetLoadBalancerSysCtl

func GetLoadBalancerSysCtl(cr *meridiov1alpha1.Trench) string

func GetLogLevel

func GetLogLevel() string

func GetNSMRegistryService

func GetNSMRegistryService() string

func GetPodDisruptionBudgetModel

func GetPodDisruptionBudgetModel(f string) (*policyv1.PodDisruptionBudget, error)

func GetPodDisruptionBudgetVersion

func GetPodDisruptionBudgetVersion(client client.Client) (string, error)

func GetPrefixedName

func GetPrefixedName(resourceName string) string

func GetProbe

func GetProbe(timer probeTimer, command []string) *corev1.Probe

func GetProbeCommand

func GetProbeCommand(spiffe bool, addr, svc string) []string

func GetProxySysCtl

func GetProxySysCtl(cr *meridiov1alpha1.Trench) string

func GetResourceRequirementAnnotation

func GetResourceRequirementAnnotation(from *metav1.ObjectMeta) (string, bool)

GetResourceRequirementAnnotation - Gets ResourceRequirementKey annotation based on param 'from'

func GetRoleBindingModel

func GetRoleBindingModel(f string) (*rbacv1.RoleBinding, error)

func GetRoleModel

func GetRoleModel(f string) (*rbacv1.Role, error)

func GetServiceAccountModel

func GetServiceAccountModel(f string) (*corev1.ServiceAccount, error)

func GetServiceModel

func GetServiceModel(f string) (*corev1.Service, error)

func GetStatefulSetModel

func GetStatefulSetModel(f string) (*appsv1.StatefulSet, error)

func GetSuffixedName

func GetSuffixedName(resourceName, suffix string) string

func GetTrenchBySelector

func GetTrenchBySelector(e *Executor, selector client.ObjectKey) (*meridiov1alpha1.Trench, error)

func IPAMServiceName

func IPAMServiceName(trench *meridiov1alpha1.Trench) string

func IPAMServiceWithPort

func IPAMServiceWithPort(cr *meridiov1alpha1.Trench) string

func IPAMStatefulSetName

func IPAMStatefulSetName(trench *meridiov1alpha1.Trench) string

func LbFeDeploymentName

func LbFeDeploymentName(attractor *meridiov1alpha1.Attractor) string

func LoadBalancerNsName

func LoadBalancerNsName(conduit, trench, namespace string) string

func NSEDeploymentName

func NSEDeploymentName(attractor *meridiov1alpha1.Attractor) string

func NSPServiceAccountName

func NSPServiceAccountName() string

func NSPServiceName

func NSPServiceName(trench *meridiov1alpha1.Trench) string

func NSPServiceWithPort

func NSPServiceWithPort(cr *meridiov1alpha1.Trench) string

func NSPStatefulSetName

func NSPStatefulSetName(trench *meridiov1alpha1.Trench) string

func NsName

func NsName(meta metav1.ObjectMeta) string

func PDBName

func PDBName(attractir *meridiov1alpha1.Attractor) string

func ProxyDeploymentName

func ProxyDeploymentName(conduit *meridiov1alpha1.Conduit) string

func ProxyNtwkSvcNsName

func ProxyNtwkSvcNsName(cr *meridiov1alpha1.Conduit) string

func SetContainerResourceRequirements

func SetContainerResourceRequirements(from *metav1.ObjectMeta, container *corev1.Container) error

SetContainerResourceRequirements - Finds and sets resource requirements for container.

func SetResourceRequirementAnnotation

func SetResourceRequirementAnnotation(from *metav1.ObjectMeta, into *metav1.ObjectMeta)

SetResourceRequirementAnnotation - Sets ResourceRequirementKey annotation based on param 'from'.

func VlanNtwkSvcName

func VlanNtwkSvcName(attractorCr *meridiov1alpha1.Attractor, trenchCr *meridiov1alpha1.Trench) string

Types

type Action

type Action interface {
	Run(e *Executor) (string, string, error)
}

func AppendActions

func AppendActions(actions ...Action) []Action

type Executions

type Executions interface {
	RunAll(actions []Action) error
	// contains filtered or unexported methods
}

type Executor

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

func NewExecutor

func NewExecutor(s *runtime.Scheme, c client.Client, ct context.Context, cr client.Object, l logr.Logger) *Executor

func (*Executor) AddCreateAction

func (e *Executor) AddCreateAction(obj client.Object)

func (*Executor) AddUpdateAction

func (e *Executor) AddUpdateAction(obj client.Object)

func (*Executor) AddUpdateStatusAction

func (e *Executor) AddUpdateStatusAction(obj client.Object)

func (*Executor) GetObject

func (e *Executor) GetObject(selector client.ObjectKey, obj client.Object) error

func (*Executor) GetOwner

func (e *Executor) GetOwner() client.Object

func (*Executor) ListObject

func (e *Executor) ListObject(obj client.ObjectList, opts ...client.ListOption) error

func (*Executor) LogError

func (e *Executor) LogError(err error, msg string)

func (*Executor) LogInfo

func (e *Executor) LogInfo(msg string)

func (*Executor) RunActions

func (e *Executor) RunActions() error

func (*Executor) SetControllerReference

func (e *Executor) SetControllerReference(obj client.Object) error

func (*Executor) SetOwner

func (e *Executor) SetOwner(cr client.Object)

Set the owner of created objects

func (*Executor) SetOwnerReference

func (e *Executor) SetOwnerReference(obj client.Object, owners ...client.Object) error

Append/update owner reference. Used when setting owner reference for custom resource

type NamedResourceRequirements

type NamedResourceRequirements struct {
	Name      string                      `json:"name" protobuf:"bytes,1,opt,name=name"`
	Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"`
}

type ResourceRequirementTemplates

type ResourceRequirementTemplates struct {
	Templates []NamedResourceRequirements `json:"templates,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=templates"`
}

ResourceRequirementTemplates - Describes the data layout of a resource requirement template file

Jump to

Keyboard shortcuts

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