util

package
v0.24.9-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 140

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApplyAnnotation

func CreateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error

CreateApplyAnnotation gets the modified configuration of the object, without embedding it again, and then sets it on the object as the annotation.

func CreateOrUpdateAnnotation

func CreateOrUpdateAnnotation(createAnnotation bool, obj runtime.Object, codec runtime.Encoder) error

CreateOrUpdateAnnotation creates the annotation used by kubectl apply only when createAnnotation is true Otherwise, only update the annotation when it already exists

func GetModifiedConfiguration

func GetModifiedConfiguration(obj runtime.Object, annotate bool, codec runtime.Encoder) ([]byte, error)

GetModifiedConfiguration retrieves the modified configuration of the object. If annotate is true, it embeds the result as an annotation in the modified configuration. If an object was read from the command input, it will use that version of the object. Otherwise, it will use the version from the server.

func GetOriginalConfiguration

func GetOriginalConfiguration(obj runtime.Object) ([]byte, error)

GetOriginalConfiguration retrieves the original configuration of the object from the annotation, or nil if no annotation was found.

func HashObject

func HashObject(obj runtime.Object, codec runtime.Codec) (string, error)

HashObject returns the hash of a Object hash by a Codec

func LookupContainerPortNumberByName

func LookupContainerPortNumberByName(pod v1.Pod, name string) (int32, error)

LookupContainerPortNumberByName find containerPort number by its named port name

func LookupContainerPortNumberByServicePort

func LookupContainerPortNumberByServicePort(svc v1.Service, pod v1.Pod, port int32) (int32, error)

LookupContainerPortNumberByServicePort implements the handling of resolving container named port, as well as ignoring targetPort when clusterIP=None It returns an error when a named port can't find a match (with -1 returned), or when the service does not declare such port (with the input port number returned).

func LookupServicePortNumberByName

func LookupServicePortNumberByName(svc v1.Service, name string) (int32, error)

LookupServicePortNumberByName find service port number by its named port name

func ParseFileSource

func ParseFileSource(source string) (keyName, filePath string, err error)

ParseFileSource parses the source given.

Acceptable formats include:
 1.  source-path: the basename will become the key name
 2.  source-name=source-path: the source-name will become the key name and
     source-path is the path to the key file.

Key names cannot include '='.

func ParseLiteralSource

func ParseLiteralSource(source string) (keyName, value string, err error)

ParseLiteralSource parses the source key=val pair into its component pieces. This functionality is distinguished from strings.SplitN(source, "=", 2) since it returns an error in the case of empty keys, values, or a missing equals sign.

func ParseRFC3339

func ParseRFC3339(s string, nowFn func() metav1.Time) (metav1.Time, error)

ParseRFC3339 parses an RFC3339 date in either RFC3339Nano or RFC3339 format.

func Umask

func Umask(mask int) (old int, err error)

Umask is a wrapper for `unix.Umask()` on non-Windows platforms

Types

This section is empty.

Directories

Path Synopsis
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.
Package openapi is a collection of libraries for fetching the openapi spec from a Kubernetes server and then indexing the type definitions.

Jump to

Keyboard shortcuts

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