kubernetes

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelRadiusApplication  = "radapp.io/application"
	LabelRadiusResource     = "radapp.io/resource"
	LabelRadiusDeployment   = "radapp.io/deployment"
	LabelRadiusRouteFmt     = "radapp.io/route-%s-%s"
	LabelRadiusResourceType = "radapp.io/resource-type"
	LabelPartOf             = "app.kubernetes.io/part-of"
	LabelName               = "app.kubernetes.io/name"
	LabelManagedBy          = "app.kubernetes.io/managed-by"

	LabelManagedByRadiusRP = "radius-rp"

	FieldManager = "radius-rp"

	// ControlPlanePartOfLabelValue is the value we use for 'app.kubernetes.io/part-of' in Radius's control-plane components.
	// This value can be used to query all of the pods that make up the control plane (for example).
	ControlPlanePartOfLabelValue = "radius"

	AnnotationSecretHash = "radapp.io/secret-hash"
	RadiusDevPrefix      = "radapp.io/"

	// AnnotationIdentityType is the annotation for supported identity.
	AnnotationIdentityType = "radapp.io/identity-type"
)

Commonly-used and Radius-Specific labels for Kubernetes

Variables

This section is empty.

Functions

func ConvertLabelToResourceType

func ConvertLabelToResourceType(labelValue string) string

ConvertLabelToResourceType converts from kubernetes label value to Radius resource type i.e. it replaces the first occurrence of "-" with "/" in the given string and returns the result. Example: Applications.Core-containers becomes Applications.Core/Containers

func ConvertResourceTypeToLabelValue

func ConvertResourceTypeToLabelValue(resourceType string) string

ConvertResourceTypeToLabelValue converts the given string to a value that Kubernetes allows i.e. it replaces the first occurrence of "/" with "-" and returns the modified string. Example: Applications.Core/containers becomes Applications.Core-Containers

func FindContourHTTPProxy

func FindContourHTTPProxy(resources []rpv1.OutputResource) (*contourv1.HTTPProxy, rpv1.OutputResource)

FindContourHTTPProxyByLocalID searches through a slice of OutputResources to find a HTTPProxy resource.

func FindContourHTTPProxyByLocalID

func FindContourHTTPProxyByLocalID(resources []rpv1.OutputResource, localID string) (*contourv1.HTTPProxy, rpv1.OutputResource)

FindContourHTTPProxyByLocalID searches through a slice of OutputResources to find a HTTPProxy resource with the given localID.

func FindDeployment

func FindDeployment(resources []rpv1.OutputResource) (*appsv1.Deployment, rpv1.OutputResource)

FindDeployment searches through a slice of OutputResource objects and returns the first Deployment object and its associated OutputResource object.

func FindSecret

func FindSecret(resources []rpv1.OutputResource) (*corev1.Secret, rpv1.OutputResource)

FindSecret iterates through a slice of OutputResource objects and returns the first Secret object found and its corresponding OutputResource object.

func FindService

func FindService(resources []rpv1.OutputResource) (*corev1.Service, rpv1.OutputResource)

FindService searches through a slice of OutputResource objects and returns the first Service object found and the OutputResource object it was found in.

func GetShortenedTargetPortName

func GetShortenedTargetPortName(name string) string

GetShortenedTargetPortName takes in a string and returns a shortened version of it by using a hashing algorithm. This generates a unique port name based on a resource id and can be used to link up a Service and Deployment.

func IsValidDaprObjectName

func IsValidDaprObjectName(name string) bool

IsValidDaprObjectName checks if the given string is a valid Dapr object name and returns a boolean value.

func IsValidObjectName

func IsValidObjectName(name string) bool

IsValidObjectName checks if the given string is a valid Kubernetes object name.

func MakeDescriptiveDaprLabels

func MakeDescriptiveDaprLabels(application string, resource string, resourceType string) map[string]any

MakeDescriptiveLabels returns a map of the descriptive labels for a Kubernetes Dapr resource associated with a Radius resource. The descriptive labels are a superset of the selector labels.

func MakeDescriptiveLabels

func MakeDescriptiveLabels(application string, resource string, resourceType string) map[string]string

MakeDescriptiveLabels returns a map of the descriptive labels for a Kubernetes resource associated with a Radius resource. The descriptive labels are a superset of the selector labels.

func MakeRouteSelectorLabels

func MakeRouteSelectorLabels(application string, resourceType string, route string) map[string]string

MakeRouteSelectorLabels returns a map of labels suitable for a Kubernetes selector to identify a labeled Radius-managed Kubernetes object.

This function differs from MakeSelectorLablels in that it's intended to *cross* resources. eg: The Service created by an HttpRoute and the Deployment created by a Container.

func MakeSelectorLabels

func MakeSelectorLabels(application string, resource string) map[string]string

MakeSelectorLabels returns a map of labels suitable for a Kubernetes selector to identify a labeled Radius-managed Kubernetes object.

This function is used to generate the labels used by a Deployment to select its Pods. eg: the Deployment and Pods are the same resource.

func NormalizeDaprResourceName

func NormalizeDaprResourceName(name string) string

NormalizeDaprResourceName normalizes resource name used for kubernetes Dapr resource name scoped in namespace. All name will be validated by swagger validation so that it does not get non-RFC1035 compliant characters. Therefore, this function will lowercase the name without allowed character validation. This function panics if the name is invalid. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#rfc-1035-label-names

func NormalizeResourceName

func NormalizeResourceName(name string) string

NormalizeResourceName normalizes resource name used for kubernetes resource name scoped in namespace. All name will be validated by swagger validation so that it does not get non-RFC1035 compliant characters. Therefore, this function will lowercase the name without allowed character validation. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#rfc-1035-label-names

Types

This section is empty.

Jump to

Keyboard shortcuts

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