client-go: kmodules.xyz/client-go/meta Index | Files

package meta

import "kmodules.xyz/client-go/meta"

Index

Package Files

annotations.go arguments.go cloud.go cmp.go encoding.go hash.go incluster.go lib.go patch.go

Constants

const (
    NameLabelKey      = "app.kubernetes.io/name"
    VersionLabelKey   = "app.kubernetes.io/version"
    InstanceLabelKey  = "app.kubernetes.io/instance"
    PartOfLabelKey    = "app.kubernetes.io/part-of"
    ComponentLabelKey = "app.kubernetes.io/component"
    ManagedByLabelKey = "app.kubernetes.io/managed-by"

    MaxCronJobNameLength = 52 //xref: https://github.com/kubernetes/kubernetes/pull/52733
)

https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels ref: https://github.com/kubernetes-sigs/application/blob/4ead7f1b87048b7717b3e474a21fdc07e6bce636/pkg/controller/application/application_controller.go#L28

const LastAppliedConfigAnnotation = "kubectl.kubernetes.io/last-applied-configuration"

Variables

var JSONPrettySerializer = func() *Codec {
    mediaType := "application/json"
    info, ok := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), mediaType)
    if !ok {
        panic("unsupported media type " + mediaType)
    }
    return &Codec{&codec{info.PrettySerializer}}
}()
var JSONSerializer = func() *Codec {
    mediaType := "application/json"
    info, ok := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), mediaType)
    if !ok {
        panic("unsupported media type " + mediaType)
    }
    return &Codec{&codec{info.Serializer}}
}()
var YAMLSerializer = func() *Codec {
    mediaType := "application/yaml"
    info, ok := runtime.SerializerInfoForMediaType(scheme.Codecs.SupportedMediaTypes(), mediaType)
    if !ok {
        panic("unsupported media type " + mediaType)
    }
    return &Codec{&codec{info.Serializer}}
}()

func APIServerCertificate Uses

func APIServerCertificate(cfg *rest.Config) (*x509.Certificate, error)

func AddLabelBlacklistFlag Uses

func AddLabelBlacklistFlag(fs *pflag.FlagSet)

AddLabelBlacklistFlag is for explicitly initializing the flags

func AlreadyReconciled Uses

func AlreadyReconciled(o interface{}) (bool, error)

func BuildArgumentListFromMap Uses

func BuildArgumentListFromMap(baseArguments map[string]string, overrideArguments map[string]string) []string

BuildArgumentListFromMap takes two string-string maps, one with the base arguments and one with optional override arguments

func ClusterDomain Uses

func ClusterDomain() string

func CreateJSONMergePatch Uses

func CreateJSONMergePatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)

func CreateJSONPatch Uses

func CreateJSONPatch(cur interface{}, mod interface{}) ([]byte, error)

func CreateStrategicPatch Uses

func CreateStrategicPatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)

func Decode Uses

func Decode(input interface{}, output interface{}) error

Decode takes an input structure and uses reflection to translate it to the output structure. output must be a pointer to a map or struct.

WARNING: `json` tags are not respected when struct converted to map[string]interface{} WARNING: Embedded structs are not decoded properly: https://github.com/mitchellh/mapstructure/pull/80

func DeepHashObject Uses

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func DeleteInBackground Uses

func DeleteInBackground() metav1.DeleteOptions

func DeleteInForeground Uses

func DeleteInForeground() metav1.DeleteOptions

func Diff Uses

func Diff(x, y interface{}) string

func Equal Uses

func Equal(x, y interface{}) bool

func EqualAnnotation Uses

func EqualAnnotation(x, y map[string]string) bool

EqualAnnotation checks equality of annotations skipping `kubectl.kubernetes.io/last-applied-configuration` key

func FilterKeys Uses

func FilterKeys(domainKey string, out, in map[string]string) map[string]string

func GenerationHash Uses

func GenerationHash(in metav1.Object) string

func GetBool Uses

func GetBool(m map[string]string, key string) (interface{}, error)

func GetBoolValue Uses

func GetBoolValue(m map[string]string, key string) (bool, error)

func GetDuration Uses

func GetDuration(m map[string]string, key string) (interface{}, error)

func GetDurationValue Uses

func GetDurationValue(m map[string]string, key string) (time.Duration, error)

func GetFloat Uses

func GetFloat(m map[string]string, key string) (interface{}, error)

func GetFloatValue Uses

func GetFloatValue(m map[string]string, key string) (float64, error)

func GetInt Uses

func GetInt(m map[string]string, key string) (interface{}, error)

func GetIntValue Uses

func GetIntValue(m map[string]string, key string) (int, error)

func GetKind Uses

func GetKind(v interface{}) string

func GetList Uses

func GetList(m map[string]string, key string) (interface{}, error)

func GetListValue Uses

func GetListValue(m map[string]string, key string) ([]string, error)

func GetMap Uses

func GetMap(m map[string]string, key string) (interface{}, error)

func GetMapValue Uses

func GetMapValue(m map[string]string, key string) (map[string]string, error)

func GetString Uses

func GetString(m map[string]string, key string) (interface{}, error)

func GetStringValue Uses

func GetStringValue(m map[string]string, key string) (string, error)

func GetStringValueForKeys Uses

func GetStringValueForKeys(m map[string]string, key string, alts ...string) (string, error)

func HasKey Uses

func HasKey(m map[string]string, key string) bool

func JsonDiff Uses

func JsonDiff(old, new interface{}) (string, error)

func MarshalToJson Uses

func MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)

MarshalToJson marshals an object into json.

func MarshalToPrettyJson Uses

func MarshalToPrettyJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)

MarshalToPrettyJson marshals an object into pretty json.

func MarshalToYAML Uses

func MarshalToYAML(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)

MarshalToYAML marshals an object into yaml.

func MergeKeys Uses

func MergeKeys(out, in map[string]string) map[string]string

func MustAlreadyReconciled Uses

func MustAlreadyReconciled(o interface{}) bool

func NameWithPrefix Uses

func NameWithPrefix(prefix, name string, customLength ...int) string

func NameWithSuffix Uses

func NameWithSuffix(name, suffix string, customLength ...int) string

func Namespace Uses

func Namespace() string

func ObjectHash Uses

func ObjectHash(in metav1.Object) string

ObjectHash includes all top label fields (like data, spec) except TypeMeta, ObjectMeta and Status also includes Generation, Annotation and Labels form ObjectMeta

func OverwriteKeys Uses

func OverwriteKeys(out, in map[string]string) map[string]string

func ParseArgumentListToMap Uses

func ParseArgumentListToMap(arguments []string) map[string]string

ParseArgumentListToMap parses a CLI argument list in the form "--foo=bar" to a string-string map

func PossiblyInCluster Uses

func PossiblyInCluster() bool

PossiblyInCluster returns true if loading an inside-kubernetes-cluster is possible. ref: https://github.com/kubernetes/kubernetes/blob/v1.18.3/staging/src/k8s.io/client-go/tools/clientcmd/client_config.go#L537

func RemoveKey Uses

func RemoveKey(m map[string]string, key string) map[string]string

func ReplaceArgument Uses

func ReplaceArgument(command []string, argMutateFunc func(map[string]string) map[string]string) []string

ReplaceArgument gets a command list; converts it to a map for easier modification, runs the provided function that returns a new modified map, and then converts the map back to a command string slice

func RequireChainKeyUnchanged Uses

func RequireChainKeyUnchanged(key string) mergepatch.PreconditionFunc

func StringToQuantityHookFunc Uses

func StringToQuantityHookFunc() mapstructure.DecodeHookFunc

StringToQuantityHookFunc returns a DecodeHookFunc that converts string to resource.Quantity

func TestAKS Uses

func TestAKS(cert *x509.Certificate) (string, error)

func TestEKS Uses

func TestEKS(cert *x509.Certificate) (string, error)

func TestGKE Uses

func TestGKE() (string, error)

ref: https://cloud.google.com/compute/docs/storing-retrieving-metadata

func UnmarshalFromJSON Uses

func UnmarshalFromJSON(data []byte, gv schema.GroupVersion) (runtime.Object, error)

UnmarshalFromJSON unmarshals an object into json.

func UnmarshalFromYAML Uses

func UnmarshalFromYAML(data []byte, gv schema.GroupVersion) (runtime.Object, error)

UnmarshalFromYAML unmarshals an object into yaml.

func UpsertArgumentList Uses

func UpsertArgumentList(baseArgs []string, overrideArgs []string, protectedFlags ...string) []string

func ValidCronJobNameWithPrefix Uses

func ValidCronJobNameWithPrefix(prefix, name string) string

func ValidCronJobNameWithPrefixNSuffix Uses

func ValidCronJobNameWithPrefixNSuffix(prefix, name, suffix string) string

func ValidCronJobNameWithSuffix Uses

func ValidCronJobNameWithSuffix(name, suffix string) string

func ValidNameWithPrefix Uses

func ValidNameWithPrefix(prefix, name string, customLength ...int) string

func ValidNameWithPrefixNSuffix Uses

func ValidNameWithPrefixNSuffix(prefix, name, suffix string, customLength ...int) string

func ValidNameWithSuffix Uses

func ValidNameWithSuffix(name, suffix string, customLength ...int) string

Deprecated: Use NameWithSuffix in new code

type Codec Uses

type Codec struct {
    // contains filtered or unexported fields
}

type GetFunc Uses

type GetFunc func(map[string]string) (interface{}, error)

func ParseFor Uses

func ParseFor(key string, fn ParserFunc) GetFunc

type ParserFunc Uses

type ParserFunc func(map[string]string, string) (interface{}, error)

Package meta imports 41 packages (graph) and is imported by 172 packages. Updated 2020-09-25. Refresh now. Tools for package owners.