Documentation
¶
Overview ¶
Package names has helpers for naming resources and generating strings
Index ¶
- Constants
- func CSRName(namespace, quarksSecretName string) string
- func CsrPrivateKeySecretName(csrName string) string
- func DNSLabelSafe(name string) string
- func GetDockerSourceName(prefix, repo, tag string) (string, error)
- func GetStatefulSetName(name string) string
- func JobName(eJobName string) (string, error)
- func OrdinalFromPodName(name string) int
- func Sanitize(name string) string
- func SanitizeSubdomain(name string) string
- func SpecIndex(azIndex int, podOrdinal int) int
- func TruncateMD5(s string, maxLen int) string
- func VolumeName(secretName string) string
Constants ¶
const ( // ConfigMap is used in log messages ConfigMap = "configmap" // Secret is used in log messages Secret = "secret" )
const GroupName = "quarks.cloudfoundry.org"
GroupName is the k8s API group name
Variables ¶
This section is empty.
Functions ¶
func CsrPrivateKeySecretName ¶
CsrPrivateKeySecretName returns a Secret name for a given CertificateSigningRequest private key
func DNSLabelSafe ¶
DNSLabelSafe filters invalid characters and returns a string that is safe to use as a DNS label. It does not enforce the required string length, see `Sanitize`.
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
func GetDockerSourceName ¶
GetDockerSourceName returns the name of the docker image More info:
- https://kubernetes.io/docs/concepts/containers/images
- <hub-user>/<repo-name>[:<tag>]
- ACCOUNT.dkr.ecr.REGION.amazonaws.com/imagename:tag
prefix: [<host>[:<port>]/][<org>/] repo: <name> tag :[:<tag>]
func GetStatefulSetName ¶
GetStatefulSetName gets statefulset name from podName
func JobName ¶
JobName returns a unique, short name for a given eJob k8s allows 63 chars, but the job's pod will have -\d{6} (=7 chars) appended. So we return max 56 chars: name39-suffix16
func OrdinalFromPodName ¶
OrdinalFromPodName returns ordinal from pod name
func Sanitize ¶
Sanitize produces valid k8s names, i.e. for containers: [a-z0-9]([-a-z0-9]*[a-z0-9])? The result is DNS label compatible and usable as a path segment name.
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
func SanitizeSubdomain ¶
SanitizeSubdomain allows more than Sanitize, cannot be used for DNS or path segments.
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names
func SpecIndex ¶ added in v0.0.2
SpecIndex return the job sepc index. We use a very large value as a maximum number of replicas per instance group, per AZ We do this in lieu of using the actual replica count, which would cause pods to always restart
func TruncateMD5 ¶
TruncateMD5 truncates the string to n chars and adds a hex encoded md5 sum. Producing a uniq representation of the original string, if maxLen >= 32. Example: names are limited to 63 characters so we recalculate the name as <name trimmed to 30 characters>-<md5 hash of name>
func VolumeName ¶
VolumeName generate volume name based on secret name
Types ¶
This section is empty.