wlid

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 20

Documentation

Index

Constants

View Source
const (
	SpiffePrefix = "://"
)

wlid/ sid utils

Variables

View Source
var (
	WlidPrefix           = "wlid://"
	SidPrefix            = "sid://"
	ClusterWlidPrefix    = "cluster-"
	NamespaceWlidPrefix  = "namespace-"
	DataCenterWlidPrefix = "datacenter-"
	ProjectWlidPrefix    = "project-"
	SecretSIDPrefix      = "secret-"
	SubSecretSIDPrefix   = "subsecret-"
	K8SKindsList         = []string{"ComponentStatus", "ConfigMap", "ControllerRevision", "CronJob",
		"CustomResourceDefinition", "DaemonSet", "Deployment", "Endpoints", "Event", "HorizontalPodAutoscaler",
		"Ingress", "Job", "Lease", "LimitRange", "LocalSubjectAccessReview", "MutatingWebhookConfiguration",
		"Namespace", "NetworkPolicy", "Node", "PersistentVolume", "PersistentVolumeClaim", "Pod",
		"PodDisruptionBudget", "PodSecurityPolicy", "PodTemplate", "PriorityClass", "ReplicaSet",
		"ReplicationController", "ResourceQuota", "Role", "RoleBinding", "Secret", "SelfSubjectAccessReview",
		"SelfSubjectRulesReview", "Service", "ServiceAccount", "StatefulSet", "StorageClass",
		"SubjectAccessReview", "TokenReview", "ValidatingWebhookConfiguration", "VolumeAttachment"}
	NativeKindsList = []string{"Dockerized", "Native"}
	KindReverseMap  = map[string]string{}
)

Functions

func GetClusterFromWlid

func GetClusterFromWlid(wlid string) string

GetClusterFromWlid parse wlid and get cluster

func GetK8SKindFronList

func GetK8SKindFronList(kind string) string

GetK8SKindFronList get the calculated wlid

func GetK8sWLID

func GetK8sWLID(level0, level1, k, name string) string

GetK8sWLID get the k8s calculated wlid

func GetKindFromWlid

func GetKindFromWlid(wlid string) string

GetKindFromWlid parse wlid and get kind

func GetNameFromWlid

func GetNameFromWlid(wlid string) string

GetNameFromWlid parse wlid and get name

func GetNamespaceFromWlid

func GetNamespaceFromWlid(wlid string) string

GetNamespaceFromWlid parse wlid and get Namespace

func GetNativeWLID

func GetNativeWLID(level0, level1, k, name string) string

GetNativeWLID get the native calculated wlid

func GetWLID

func GetWLID(level0, level1, k, name string) string

GetWLID get the calculated wlid

func IsK8SKindInList

func IsK8SKindInList(kind string) bool

IsK8SKindInList Check if the kind is a known kind

func IsSid

func IsSid(id string) bool

func IsWlid

func IsWlid(id string) bool

func IsWlidValid

func IsWlidValid(wlid string) error

IsWlidValid test if wlid is a valid wlid

func RestoreMicroserviceIDs

func RestoreMicroserviceIDs(spiffe string) []string

RestoreMicroserviceIDsFromSpiffe -

func RestoreMicroserviceIDsFromSpiffe

func RestoreMicroserviceIDsFromSpiffe(spiffe string) ([]string, error)

RestoreMicroserviceIDsFromSpiffe -

func StringHasWhitespace

func StringHasWhitespace(str string) bool

StringHasWhitespace check if a string has whitespace

func WildWlidContainsWlid

func WildWlidContainsWlid(wildWlid, wlid string) bool

WildWlidContainsWlid does WildWlid contains Wlid

Types

type SpiffeBasicInfo

type SpiffeBasicInfo struct {
	//cluster/datacenter
	Level0     string `json:"level0"`
	Level0Type string `json:"level0Type"`

	//namespace/project
	Level1     string `json:"level0"`
	Level1Type string `json:"level0Type"`

	Kind string `json:"kind"`
	Name string `json:"name"`
}

represents workload basic info

func SpiffeToSpiffeInfo

func SpiffeToSpiffeInfo(spiffe string) (*SpiffeBasicInfo, error)

Jump to

Keyboard shortcuts

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