kubernetes

package
v0.26.3 Latest Latest
Warning

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

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

Documentation

Overview

package kubernetes defines utility functions and constants for working with Kubernetes types and UCP resource IDs.

Index

Constants

View Source
const (
	// PlaneTypeKubernetes defines the type name of the Kubernetes plane.
	PlaneTypeKubernetes = "kubernetes"

	// PlaneNameTODO is the name of the Kubernetes plane to use when the plane name is not known.
	// This is similar to context.TODO() in the Go standard library. When we support multiple kubernetes
	// clusters in a single Radius instance, we will need to remove this and replace all occurrences.
	PlaneNameTODO = "local"

	// ScopeTypeNamespaces defines the type name of the Kubernetes namespace scope.
	ScopeNamespaces = "namespaces"
)
View Source
const (
	// KindDeployment is the kind of a Kubernetes Deployment.
	KindDeployment = "Deployment"
	// ResourceTypeDeployment is the resource type of a Kubernetes Deployment.
	ResourceTypeDeployment = "apps/Deployment"
	// KindSecret is the kind of a Kubernetes Secret.
	KindSecret = "Secret"
	// ResourceTypeSecret is the resource type of a Kubernetes Secret.
	ResourceTypeSecret = "core/Secret"
	// KindService is the kind of a Kubernetes Service.
	KindService = "Service"
	// ResourceTypeService is the resource type of a Kubernetes Service.
	ResourceTypeService = "core/Service"
	// KindServiceAccount is the kind of a Kubernetes ServiceAccount.
	KindServiceAccount = "ServiceAccount"
	// ResourceTypeServiceAccount is the resource type of a Kubernetes ServiceAccount.
	ResourceTypeServiceAccount = "core/ServiceAccount"
	// KindRole is the kind of a Kubernetes Role.
	KindRole = "Role"
	// ResourceTypeRole is the resource type of a Kubernetes Role.
	ResourceTypeRole = "rbac.authorization.k8s.io/Role"
	// KindRoleBinding is the kind of a Kubernetes RoleBinding.
	KindRoleBinding = "RoleBinding"
	// ResourceTypeRoleBinding is the resource type of a Kubernetes RoleBinding.
	ResourceTypeRoleBinding = "rbac.authorization.k8s.io/RoleBinding"
	// KindSecretProviderClass is the kind of a Kubernetes SecretProviderClass.
	KindSecretProviderClass = "SecretProviderClass"
	// ResourceTypeSecretProviderClass is the resource type of a Kubernetes SecretProviderClass.
	ResourceTypeSecretProviderClass = "secrets-store.csi.x-k8s.io/SecretProviderClass"

	// KindContourHTTPProxy is the kind of a Contour HTTPProxy.
	KindContourHTTPProxy = "HTTPProxy"
	// ResourceTypeContourHTTPProxy is the resource type of a Contour HTTPProxy.
	ResourceTypeContourHTTPProxy = "projectcontour.io/HTTPProxy"

	// ResourceTypeDaprComponent is the resource type of a Dapr component.
	ResourceTypeDaprComponent = "dapr.io/Component"
)

Variables

This section is empty.

Functions

func IDFromMeta

func IDFromMeta(planeName string, gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) resources.ID

IDFromMeta returns the UCP resource ID for the given Kubernetes object specified by its GroupVersionKind and ObjectMeta.

func IDFromParts

func IDFromParts(planeName string, group string, kind string, namespace string, name string) resources.ID

IDFromParts returns the UCP resource ID for the given Kubernetes object specified by its component parts.

func ResourceTypeFromGVK

func ResourceTypeFromGVK(gvk schema.GroupVersionKind) string

ResourceTypeFromGVK returns the resource type of a Kubernetes resource given its group, version, and kind.

func ToParts

func ToParts(id resources.ID) (group, kind, namespace, name string)

ToParts returns the component parts of the given UCP resource ID.

func ToUCPResourceID added in v0.26.0

func ToUCPResourceID(namespace, resourceType, resourceName, provider string) (string, error)

ToUCPResourceID takes namespace, resourceType, resourceName, provider information and returns string representing UCP qualified resource ID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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