Documentation ¶
Index ¶
- Variables
- func AddFinalizer(o v1.Object, finalizer string)
- func AddOwnerReference(om *metav1.ObjectMeta, or metav1.OwnerReference)
- func ApplySecret(c kubernetes.Interface, s *corev1.Secret) (*corev1.Secret, error)
- func ConditionalStringFormat(format string, value string) string
- func GenerateHex(dataLen int) (string, error)
- func GenerateName(base string) string
- func GenerateNameMaxLength(base string, maxLength int) string
- func GeneratePassword(dataLen int) (string, error)
- func HasFinalizer(o v1.Object, finalizer string) bool
- func IfEmptyString(s, r string) string
- func LatestDeploymentCondition(conditions []appsv1.DeploymentCondition) appsv1.DeploymentCondition
- func NamespaceNameFromObjectRef(or *corev1.ObjectReference) types.NamespacedName
- func ObjectReference(o metav1.ObjectMeta, apiVersion, kind string) *corev1.ObjectReference
- func ObjectToOwnerReference(r *corev1.ObjectReference) *metav1.OwnerReference
- func ParseBool(s string) bool
- func ParseMap(s string) map[string]string
- func RemoveFinalizer(o v1.Object, finalizer string)
- func SecretData(client kubernetes.Interface, namespace string, ks corev1.SecretKeySelector) ([]byte, error)
- func String(v string) *string
- func StringValue(v *string) string
- func ToLowerRemoveSpaces(input string) string
Constants ¶
This section is empty.
Variables ¶
var DefaultUpdateRetry = wait.Backoff{ Steps: 10, Duration: 500 * time.Millisecond, Factor: 1.0, Jitter: 0.1, }
DefaultUpdateRetry is the recommended retry for a failure to update a resource or ensuring that the changes from an update have been committed and have become consistent.
Functions ¶
func AddFinalizer ¶
AddFinalizer - add finalizer (if it wasn't added before)
func AddOwnerReference ¶ added in v0.2.0
func AddOwnerReference(om *metav1.ObjectMeta, or metav1.OwnerReference)
AddOwnerReference to the object metadata, only if this owner reference is not in the existing owner references list
func ApplySecret ¶
ApplySecret creates or updates if exist kubernetes secret
func ConditionalStringFormat ¶ added in v0.2.0
ConditionalStringFormat returns based on the format string and substitution value. If format is not provided, substitution value is returned If format is provided with '%s' substitution symbol, fmt.Sprintf(fmt, val) is returned.
NOTE: only single %s substitution is supported
If name format does not contain '%s' substitution, i.e. a constant string, the constant string value is returned back
Examples:
For all examples assume "value" = "test-value" 1. format = "", ContainerName = "test-value" 2. format = "foo", ContainerName = "foo" 3. format = "foo-%s", ContainerName = "foo-test-value" 4. format = "foo-%s-bar-%s", ContainerName = "foo-test-value-bar-%!s(MISSING)"
func GenerateHex ¶
GenerateHex generates a hex string using random data of the given length.
func GenerateName ¶
GenerateName returns the given base name plus a random suffix of five alphanumerics and a hyphen separator. The string is guaranteed to not exceed the length of a standard Kubernetes name (253 characters). e.g., GenerateName("foo") would return a value similar to: "foo-a1b2c".
If base string length exceeds 247 (253 - 6) characters, it will be truncated to 247 characters before adding random suffix e.g., GenerateName("foo...ververylongstringof253chars") would return value similar to:
"foo...ververylongstringof25-x8y9z"
func GenerateNameMaxLength ¶ added in v0.2.0
GenerateNameMaxLength returns the given base name with a dash and random 5 character suffix. basename will be trimmed as necessary to meet the limits of maxLength.
func GeneratePassword ¶
GeneratePassword generates a password using random data of the given length, then encodes to a base64 string.
func HasFinalizer ¶
HasFinalizer - check if given instance has a given finalizer
func IfEmptyString ¶
IfEmptyString test input string and if empty, i.e = "", return a replacement string
func LatestDeploymentCondition ¶
func LatestDeploymentCondition(conditions []appsv1.DeploymentCondition) appsv1.DeploymentCondition
LatestDeploymentCondition returns the supplied condition with the latest last update time.
func NamespaceNameFromObjectRef ¶ added in v0.2.0
func NamespaceNameFromObjectRef(or *corev1.ObjectReference) types.NamespacedName
NamespaceNameFromObjectRef helper function to create NamespacedName
func ObjectReference ¶
func ObjectReference(o metav1.ObjectMeta, apiVersion, kind string) *corev1.ObjectReference
ObjectReference from provided ObjectMeta, apiVersion and kind
func ObjectToOwnerReference ¶
func ObjectToOwnerReference(r *corev1.ObjectReference) *metav1.OwnerReference
ObjectToOwnerReference converts core ObjectReference to meta OwnerReference
func ParseMap ¶ added in v0.2.0
ParseMap string encoded map values example: "foo:bar,one:two" -> map[string]string{"foo":"bar","one":"two"}
func RemoveFinalizer ¶
RemoveFinalizer - from the list of kubernetes object finalizers
func SecretData ¶
func SecretData(client kubernetes.Interface, namespace string, ks corev1.SecretKeySelector) ([]byte, error)
SecretData returns secret data value for a given secret/key combination or error if secret or key is not found
func StringValue ¶ added in v0.2.0
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func ToLowerRemoveSpaces ¶
ToLowerRemoveSpaces returns the supplied string in lowercase with all spaces (not all whitespace) removed.
Types ¶
This section is empty.