Documentation ¶
Overview ¶
nolint: goconst
Index ¶
- Constants
- Variables
- func APIServerCertificate(cfg *rest.Config) (*x509.Certificate, error)
- func AddLabelBlacklistFlag(fs *pflag.FlagSet)
- func AlreadyReconciled(o interface{}) (bool, error)
- func BuildArgumentListFromMap(baseArguments map[string]string, overrideArguments map[string]string) []string
- func ClusterDomain() string
- func CreateJSONMergePatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)
- func CreateJSONPatch(cur interface{}, mod interface{}) ([]byte, error)
- func CreateStrategicPatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)
- func Decode(input interface{}, output interface{}) error
- func DecodeObject(in interface{}, out interface{}) error
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func DeleteInBackground() metav1.DeleteOptions
- func DeleteInForeground() metav1.DeleteOptions
- func Diff(x, y interface{}) string
- func Equal(x, y interface{}) bool
- func EqualAnnotation(x, y map[string]string) bool
- func FilterKeys(domainKey string, out, in map[string]string) map[string]string
- func GenerationHash(in metav1.Object) string
- func GetBool(m map[string]string, key string) (interface{}, error)
- func GetBoolValue(m map[string]string, key string) (bool, error)
- func GetBytesForKeys(m map[string][]byte, key string, alts ...string) ([]byte, error)
- func GetCondition(conditions []metav1.Condition, condType string) (int, *metav1.Condition)
- func GetDuration(m map[string]string, key string) (interface{}, error)
- func GetDurationValue(m map[string]string, key string) (time.Duration, error)
- func GetFloat(m map[string]string, key string) (interface{}, error)
- func GetFloatValue(m map[string]string, key string) (float64, error)
- func GetInt(m map[string]string, key string) (interface{}, error)
- func GetIntValue(m map[string]string, key string) (int, error)
- func GetKind(v interface{}) string
- func GetList(m map[string]string, key string) (interface{}, error)
- func GetListValue(m map[string]string, key string) ([]string, error)
- func GetMap(m map[string]string, key string) (interface{}, error)
- func GetMapValue(m map[string]string, key string) (map[string]string, error)
- func GetString(m map[string]string, key string) (interface{}, error)
- func GetStringValue(m map[string]string, key string) (string, error)
- func GetStringValueForKeys(m map[string]string, key string, alts ...string) (string, error)
- func HasCondition(conditions []metav1.Condition, condType string) bool
- func HasKey(m map[string]string, key string) bool
- func IPv6EnabledInCluster(kc kubernetes.Interface) (bool, error)
- func IPv6EnabledInKernel() (bool, error)
- func IsConditionFalse(conditions []metav1.Condition, condType string) bool
- func IsConditionTrue(conditions []metav1.Condition, condType string) bool
- func IsConditionUnknown(conditions []metav1.Condition, condType string) bool
- func IsOfficialType(group string) bool
- func JsonDiff(old, new interface{}) (string, error)
- func LabelsForLabelSelector(sel *metav1.LabelSelector) (map[string]string, bool)
- func Marshal(v interface{}, format DataFormat) ([]byte, error)
- func MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)
- func MarshalToPrettyJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)
- func MarshalToYAML(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)
- func MergeKeys(out, in map[string]string) map[string]string
- func MustAlreadyReconciled(o interface{}) bool
- func NameWithPrefix(prefix, name string, customLength ...int) string
- func NameWithSuffix(name, suffix string, customLength ...int) string
- func NewCondition(reason string, message string, generation int64, conditionStatus ...bool) metav1.Condition
- func NodeName() string
- func ObjectHash(in metav1.Object) string
- func OverwriteKeys(out map[string]string, ins ...map[string]string) map[string]string
- func ParseArgumentListToMap(arguments []string) map[string]string
- func PodName() string
- func PodNamespace() string
- func PodServiceAccount() string
- func PossiblyInCluster() bool
- func RemoveCondition(conditions []metav1.Condition, condType string) []metav1.Condition
- func RemoveKey(m map[string]string, key string) map[string]string
- func ReplaceArgument(command []string, argMutateFunc func(map[string]string) map[string]string) []string
- func RequireChainKeyUnchanged(key string) mergepatch.PreconditionFunc
- func ResourceHash(obj metav1.Object) string
- func SetCondition(conditions []metav1.Condition, newCondition metav1.Condition) []metav1.Condition
- func StatusConditionAwareEqual(old, new interface{}) bool
- func StatusEqual(old, new interface{}) bool
- func StringToQuantityHookFunc() mapstructure.DecodeHookFunc
- func TestAKS(cert *x509.Certificate) (string, error)
- func TestEKS(cert *x509.Certificate) (string, error)
- func TestGKE() (string, error)
- func UnmarshalFromJSON(data []byte, gv schema.GroupVersion) (runtime.Object, error)
- func UnmarshalFromYAML(data []byte, gv schema.GroupVersion) (runtime.Object, error)
- func UpsertArgumentList(baseArgs []string, overrideArgs []string, protectedFlags ...string) []string
- func ValidCronJobNameWithPrefix(prefix, name string) string
- func ValidCronJobNameWithPrefixNSuffix(prefix, name, suffix string) string
- func ValidCronJobNameWithSuffix(name, suffix string) string
- func ValidNameWithPrefix(prefix, name string, customLength ...int) string
- func ValidNameWithPrefixNSuffix(prefix, name, suffix string, customLength ...int) string
- func ValidNameWithSuffix(name, suffix string, customLength ...int) stringdeprecated
- type Codec
- type Condition
- type DataFormat
- type GetFunc
- type ParserFunc
- type PreConditionSet
- type Status
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 Statuses = []Status{InProgressStatus, FailedStatus, CurrentStatus, TerminatingStatus, UnknownStatus}
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}} }()
Functions ¶
func APIServerCertificate ¶
func APIServerCertificate(cfg *rest.Config) (*x509.Certificate, error)
func AddLabelBlacklistFlag ¶
AddLabelBlacklistFlag is for explicitly initializing the flags
func AlreadyReconciled ¶
func BuildArgumentListFromMap ¶
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 ¶
func ClusterDomain() string
func CreateJSONMergePatch ¶
func CreateJSONMergePatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)
func CreateJSONPatch ¶
func CreateStrategicPatch ¶
func CreateStrategicPatch(cur interface{}, mod interface{}, fns ...mergepatch.PreconditionFunc) ([]byte, error)
func Decode ¶
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 DecodeObject ¶
func DecodeObject(in interface{}, out interface{}) error
func DeepHashObject ¶
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 ¶
func DeleteInBackground() metav1.DeleteOptions
func DeleteInForeground ¶
func DeleteInForeground() metav1.DeleteOptions
func EqualAnnotation ¶
EqualAnnotation checks equality of annotations skipping `kubectl.kubernetes.io/last-applied-configuration` key
func GenerationHash ¶
func GetBytesForKeys ¶
func GetCondition ¶ added in v0.25.20
GetCondition returns a pointer to the desired condition referred by "condType". Otherwise, it returns nil.
func GetDurationValue ¶
func GetStringValueForKeys ¶
func HasCondition ¶ added in v0.25.20
HasCondition returns "true" if the desired condition provided in "condType" is present in the condition list. Otherwise, it returns "false".
func IPv6EnabledInCluster ¶
func IPv6EnabledInCluster(kc kubernetes.Interface) (bool, error)
func IPv6EnabledInKernel ¶
func IsConditionFalse ¶ added in v0.25.20
IsConditionFalse returns "true" if the desired condition is in false state. It returns "false" if the desired condition is not in "false" state or is not in the condition list.
func IsConditionTrue ¶ added in v0.25.20
IsConditionTrue returns "true" if the desired condition is in true state. It returns "false" if the desired condition is not in "true" state or is not in the condition list.
func IsConditionUnknown ¶ added in v0.25.20
IsConditionUnknown returns "true" if the desired condition is in unknown state. It returns "false" if the desired condition is not in "unknown" state or is not in the condition list.
func IsOfficialType ¶ added in v0.25.42
func LabelsForLabelSelector ¶ added in v0.25.34
func LabelsForLabelSelector(sel *metav1.LabelSelector) (map[string]string, bool)
func Marshal ¶
func Marshal(v interface{}, format DataFormat) ([]byte, error)
func MarshalToJson ¶
MarshalToJson marshals an object into json.
func MarshalToPrettyJson ¶
MarshalToPrettyJson marshals an object into pretty json.
func MarshalToYAML ¶
MarshalToYAML marshals an object into yaml.
func MustAlreadyReconciled ¶
func MustAlreadyReconciled(o interface{}) bool
func NameWithPrefix ¶
func NameWithSuffix ¶
func NewCondition ¶ added in v0.25.20
func ObjectHash ¶
ObjectHash includes all top label fields (like data, spec) except TypeMeta, ObjectMeta and Status also includes Generation, Annotation and Labels form ObjectMeta
func OverwriteKeys ¶
func ParseArgumentListToMap ¶
ParseArgumentListToMap parses a CLI argument list in the form "--foo=bar" to a string-string map
func PodNamespace ¶
func PodNamespace() string
func PodServiceAccount ¶ added in v0.25.17
func PodServiceAccount() string
func PossiblyInCluster ¶
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 RemoveCondition ¶ added in v0.25.20
RemoveCondition remove a condition from the condition list referred by "condType" parameter.
func ReplaceArgument ¶
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 ¶
func RequireChainKeyUnchanged(key string) mergepatch.PreconditionFunc
func ResourceHash ¶ added in v0.29.8
func SetCondition ¶ added in v0.25.20
SetCondition add/update the desired condition to the condition list. It does nothing if the condition is already in its desired state.
func StatusConditionAwareEqual ¶
func StatusConditionAwareEqual(old, new interface{}) bool
func StatusEqual ¶
func StatusEqual(old, new interface{}) bool
func StringToQuantityHookFunc ¶
func StringToQuantityHookFunc() mapstructure.DecodeHookFunc
StringToQuantityHookFunc returns a DecodeHookFunc that converts string to resource.Quantity
func UnmarshalFromJSON ¶
UnmarshalFromJSON unmarshals an object into json.
func UnmarshalFromYAML ¶
UnmarshalFromYAML unmarshals an object into yaml.
func UpsertArgumentList ¶
func ValidNameWithPrefix ¶
func ValidNameWithSuffix
deprecated
Types ¶
type DataFormat ¶
type DataFormat string
const ( // Do not change format KeepFormat DataFormat = "" JsonFormat DataFormat = "json" YAMLFormat DataFormat = "yaml" )
func NewDataFormat ¶
func NewDataFormat(format string, def DataFormat) DataFormat
type PreConditionSet ¶
func (PreConditionSet) Error ¶
func (s PreConditionSet) Error() error
func (PreConditionSet) PreconditionFunc ¶
func (s PreConditionSet) PreconditionFunc() []mergepatch.PreconditionFunc
type Status ¶ added in v0.25.20
type Status string
Status defines the set of statuses a resource can have. Based on kstatus: https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus +kubebuilder:validation:Enum=InProgress;Failed;Current;Terminating;NotFound;Unknown
func StatusFromStringOrDie ¶ added in v0.25.20
StatusFromStringOrDie turns a string into a Status. Will panic if the provided string is not a valid status.