Documentation ¶
Index ¶
- Constants
- func ConvertLabelToResourceType(labelValue string) string
- func ConvertResourceTypeToLabelValue(resourceType string) string
- func FindContourHTTPProxy(resources []rpv1.OutputResource) (*contourv1.HTTPProxy, rpv1.OutputResource)
- func FindContourHTTPProxyByLocalID(resources []rpv1.OutputResource, localID string) (*contourv1.HTTPProxy, rpv1.OutputResource)
- func FindDeployment(resources []rpv1.OutputResource) (*appsv1.Deployment, rpv1.OutputResource)
- func FindSecret(resources []rpv1.OutputResource) (*corev1.Secret, rpv1.OutputResource)
- func FindService(resources []rpv1.OutputResource) (*corev1.Service, rpv1.OutputResource)
- func GetShortenedTargetPortName(name string) string
- func HashSecretData(secretData map[string][]byte) string
- func IsValidDaprObjectName(name string) bool
- func IsValidObjectName(name string) bool
- func MakeDescriptiveDaprLabels(application string, resource string, resourceType string) map[string]any
- func MakeDescriptiveLabels(application string, resource string, resourceType string) map[string]string
- func MakeRouteSelectorLabels(application string, resourceType string, route string) map[string]string
- func MakeSelectorLabels(application string, resource string) map[string]string
- func NormalizeDaprResourceName(name string) string
- func NormalizeResourceName(name string) string
Constants ¶
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 ¶
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 ¶
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 ¶
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 HashSecretData ¶ added in v0.26.4
HashSecretData hashes the data in a secret to produce a deterministic hash.
This can be used as a Kubernetes annotation to force a Deployment to redeploy pods when the secret changes.
func IsValidDaprObjectName ¶
IsValidDaprObjectName checks if the given string is a valid Dapr object name and returns a boolean value.
func IsValidObjectName ¶
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 MakeRouteSelectorLabels in that it's intended to *cross* resources. eg: The Service created by an HttpRoute and the Deployment created by a Container.
func MakeSelectorLabels ¶
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 ¶
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 ¶
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.