Documentation ¶
Index ¶
- Variables
- func AddFinalizer(obj metav1.Object, finalizer string) bool
- func CombineErrors(errs ...error) error
- func Contains(s string, arr []string) bool
- func Context() context.Context
- func CurrentNamespace() string
- func GetAWSRegion() (string, error)
- func GetContainerStatusLine(cont *corev1.ContainerStatus) string
- func GetEnvVariable(env *[]corev1.EnvVar, name string) *corev1.EnvVar
- func GetFlagStringOrPrompt(cmd *cobra.Command, flag string) string
- func GetFlagStringOrPromptPassword(cmd *cobra.Command, flag string) string
- func GetPodLogs(pod corev1.Pod) (map[string]io.ReadCloser, error)
- func GetPodStatusLine(pod *corev1.Pod) string
- func IgnoreError(err error)
- func InitLogger()
- func IsAWSPlatform() bool
- func IsAzurePlatform() bool
- func IsPersistentError(err error) bool
- func IsStringGraphicOrSpacesCharsOnly(s string) bool
- func IsValidS3BucketName(name string) bool
- func KubeApply(obj runtime.Object) bool
- func KubeCheck(obj runtime.Object) bool
- func KubeCheckOptional(obj runtime.Object) bool
- func KubeCheckQuiet(obj runtime.Object) bool
- func KubeClient() client.Client
- func KubeConfig() *rest.Config
- func KubeCreateSkipExisting(obj runtime.Object) bool
- func KubeDelete(obj runtime.Object, opts ...client.DeleteOption) bool
- func KubeDeleteAllOf(obj runtime.Object, opts ...client.DeleteAllOfOption) bool
- func KubeGet(obj runtime.Object) (name string, kind string, err error)
- func KubeList(list runtime.Object, options ...client.ListOption) bool
- func KubeObject(text string) runtime.Object
- func KubeUpdate(obj runtime.Object) bool
- func LogError(err error)
- func Logger() *logrus.Entry
- func MapperProvider(config *rest.Config) (meta.RESTMapper, error)
- func NewFastRESTMapper(dc discovery.DiscoveryInterface, filter APIGroupFilterFunc) meta.RESTMapper
- func NoGroupFilter(*metav1.APIGroup) bool
- func ObjectKey(obj runtime.Object) client.ObjectKey
- func Panic(err error)
- func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop()
- func RandomBase64(numBytes int) string
- func RandomHex(numBytes int) string
- func ReflectEnvVariable(env *[]corev1.EnvVar, name string)
- func RemoveFinalizer(obj metav1.Object, finalizer string) bool
- func SaveCRsToFile(crs runtime.Object, path string) error
- func SaveStreamToFile(body io.ReadCloser, path string) error
- func SecretResetStringDataFromData(obj runtime.Object)
- func SetAvailableCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func SetErrorCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func SetProgressingCondition(conditions *[]conditionsv1.Condition, reason string, message string)
- func Tar(src string, writers ...io.Writer) error
- func WriteYamlFile(name string, obj runtime.Object, moreObjects ...runtime.Object) error
- type APIGroupFilterFunc
- type FastRESTMapper
- func (m *FastRESTMapper) Discover() error
- func (m *FastRESTMapper) DiscoverGroup(gr *restmapper.APIGroupResources) error
- func (m *FastRESTMapper) DiscoverOnError(err error) bool
- func (m *FastRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error)
- func (m *FastRESTMapper) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
- func (m *FastRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
- func (m *FastRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)
- func (m *FastRESTMapper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error)
- func (m *FastRESTMapper) ResourceSingularizer(resource string) (string, error)
- func (m *FastRESTMapper) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error)
- type OAuth2Endpoints
- type PersistentError
- type PrintColumn
- type PrintTable
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddFinalizer ¶ added in v2.3.0
AddFinalizer adds the finalizer to the object if it doesn't contains it already
func CombineErrors ¶
CombineErrors takes a list of errors and combines them to one. Generally it will return the first non-nil error, but if a persistent error is found it will be returned instead of non-persistent errors.
func CurrentNamespace ¶
func CurrentNamespace() string
CurrentNamespace reads the current namespace from the kube config
func GetAWSRegion ¶
GetAWSRegion parses the region from a node's name
func GetContainerStatusLine ¶
func GetContainerStatusLine(cont *corev1.ContainerStatus) string
GetContainerStatusLine returns a one liner status for a container
func GetEnvVariable ¶ added in v2.3.0
GetEnvVariable is looknig for env variable called name in env and return a pointer to the variable
func GetFlagStringOrPrompt ¶
GetFlagStringOrPrompt returns flag value but if empty will promtp to read from stdin
func GetFlagStringOrPromptPassword ¶
GetFlagStringOrPromptPassword is like GetFlagStringOrPrompt but does not show the input characters on the terminal to avoid leaking secret data in shell history
func GetPodLogs ¶ added in v2.0.7
GetPodLogs info
func GetPodStatusLine ¶
GetPodStatusLine returns a one liner status for a pod
func IsAWSPlatform ¶
func IsAWSPlatform() bool
IsAWSPlatform returns true if this cluster is running on AWS
func IsAzurePlatform ¶ added in v2.3.0
func IsAzurePlatform() bool
IsAzurePlatform returns true if this cluster is running on Azure
func IsPersistentError ¶
IsPersistentError checks if the provided error is persistent.
func IsStringGraphicOrSpacesCharsOnly ¶ added in v2.1.0
IsStringGraphicOrSpacesCharsOnly returns true only if all the chars are graphic or spaces
func IsValidS3BucketName ¶ added in v2.1.0
IsValidS3BucketName checks the name according to https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
func KubeApply ¶
KubeApply will check if the object exists and will create/update accordingly and report the object status.
func KubeCheckOptional ¶
KubeCheckOptional checks if the object exists and reports the object status. It detects the situation of a missing CRD and reports it as an optional feature.
func KubeCheckQuiet ¶ added in v2.1.0
KubeCheckQuiet checks if the object exists fills the given object if found. returns true if the object was found. It does not print any status
func KubeClient ¶
KubeClient resturns a controller-runtime client We use a lazy mapper and a specialized implementation of fast mapper in order to avoid lags when running a CLI client to a far away cluster.
func KubeConfig ¶
KubeConfig loads kubernetes client config from default locations (flags, user dir, etc)
func KubeCreateSkipExisting ¶
KubeCreateSkipExisting will check if the object exists and will create/skip accordingly and report the object status.
func KubeDelete ¶
func KubeDelete(obj runtime.Object, opts ...client.DeleteOption) bool
KubeDelete deletes an object and reports the object status.
func KubeDeleteAllOf ¶ added in v2.3.0
func KubeDeleteAllOf(obj runtime.Object, opts ...client.DeleteAllOfOption) bool
KubeDeleteAllOf deletes an list of objects and reports the status.
func KubeGet ¶ added in v2.1.0
KubeGet gets a runtime.Object, fills the given object and returns the name and kind returns error on failure
func KubeList ¶
func KubeList(list runtime.Object, options ...client.ListOption) bool
KubeList returns a list of objects.
func KubeObject ¶
KubeObject loads a text yaml/json to a kubernets object.
func KubeUpdate ¶
KubeUpdate updates an object and reports the object status.
func MapperProvider ¶
func MapperProvider(config *rest.Config) (meta.RESTMapper, error)
MapperProvider creates RESTMapper
func NewFastRESTMapper ¶
func NewFastRESTMapper(dc discovery.DiscoveryInterface, filter APIGroupFilterFunc) meta.RESTMapper
NewFastRESTMapper initializes a FastRESTMapper
func NoGroupFilter ¶
NoGroupFilter is a filtering function that includes all the server groups
func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop ¶ added in v2.0.2
func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop()
PrintThisNoteWhenFinishedApplyingAndStartWaitLoop is a common log task
func RandomBase64 ¶
RandomBase64 creates a random buffer with numBytes and returns it encoded in base64 Returned string length is 4*math.Ceil(numBytes/3)
func RandomHex ¶
RandomHex creates a random buffer with numBytes and returns it encoded in hex Returned string length is 2*numBytes
func ReflectEnvVariable ¶ added in v2.3.0
ReflectEnvVariable will add, update or remove an env variable base on the existence and value of an env variable with the same name on the container running this function.
func RemoveFinalizer ¶
RemoveFinalizer modifies the object and removes the finalizer
func SaveCRsToFile ¶ added in v2.0.7
SaveCRsToFile info
func SaveStreamToFile ¶ added in v2.0.7
func SaveStreamToFile(body io.ReadCloser, path string) error
SaveStreamToFile info
func SecretResetStringDataFromData ¶
SecretResetStringDataFromData reads the secret data into string data to streamline the paths that use the secret values as strings.
func SetAvailableCondition ¶
func SetAvailableCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetAvailableCondition updates the status conditions to available state
func SetErrorCondition ¶
func SetErrorCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetErrorCondition updates the status conditions to error state
func SetProgressingCondition ¶
func SetProgressingCondition(conditions *[]conditionsv1.Condition, reason string, message string)
SetProgressingCondition updates the status conditions to in-progress state
Types ¶
type APIGroupFilterFunc ¶
APIGroupFilterFunc is a filtering function to limit the amount of server groups we load
type FastRESTMapper ¶
type FastRESTMapper struct { Discovery discovery.DiscoveryInterface Filter APIGroupFilterFunc Mapper meta.RESTMapper }
FastRESTMapper loads the mapper data from the server with filter and concurrency and rediscovers the mapping on meta.NoKindMatchError errors See https://github.com/kubernetes-sigs/controller-runtime/issues/537
func (*FastRESTMapper) Discover ¶
func (m *FastRESTMapper) Discover() error
Discover reads server groups and then reads each group to initialize the mapper groups.
func (*FastRESTMapper) DiscoverGroup ¶
func (m *FastRESTMapper) DiscoverGroup(gr *restmapper.APIGroupResources) error
DiscoverGroup reads the server group
func (*FastRESTMapper) DiscoverOnError ¶
func (m *FastRESTMapper) DiscoverOnError(err error) bool
DiscoverOnError check if the error is NoMatchError and calls discover
func (*FastRESTMapper) KindFor ¶
func (m *FastRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error)
KindFor implements Mapper.KindFor
func (*FastRESTMapper) KindsFor ¶
func (m *FastRESTMapper) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
KindsFor implements Mapper.KindsFor
func (*FastRESTMapper) RESTMapping ¶
func (m *FastRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
RESTMapping implements Mapper.RESTMapping
func (*FastRESTMapper) RESTMappings ¶
func (m *FastRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)
RESTMappings implements Mapper.RESTMappings
func (*FastRESTMapper) ResourceFor ¶
func (m *FastRESTMapper) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error)
ResourceFor implements Mapper.ResourceFor
func (*FastRESTMapper) ResourceSingularizer ¶
func (m *FastRESTMapper) ResourceSingularizer(resource string) (string, error)
ResourceSingularizer implements Mapper.ResourceSingularizer
func (*FastRESTMapper) ResourcesFor ¶
func (m *FastRESTMapper) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error)
ResourcesFor implements Mapper.ResourcesFor
type OAuth2Endpoints ¶ added in v2.0.6
type OAuth2Endpoints struct { AuthorizationEndpoint string `json:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint"` }
OAuth2Endpoints holds OAuth2 endpoints information.
func DiscoverOAuthEndpoints ¶ added in v2.0.6
func DiscoverOAuthEndpoints() (*OAuth2Endpoints, error)
DiscoverOAuthEndpoints uses a well known url to get info on the cluster oauth2 endpoints
type PersistentError ¶
PersistentError is an error type that tells the reconcile to avoid requeueing.
func NewPersistentError ¶
func NewPersistentError(reason string, message string) *PersistentError
NewPersistentError returns a new persistent error.
func (*PersistentError) Error ¶
func (e *PersistentError) Error() string
Error function makes PersistentError implement error interface
type PrintColumn ¶
PrintColumn is a column in PrintTable
func (*PrintColumn) Pad ¶
func (c *PrintColumn) Pad(s string) string
Pad adds padding the provided string to make it print nicely as a table cell
func (*PrintColumn) RecalcWidth ¶
func (c *PrintColumn) RecalcWidth()
RecalcWidth can be called to recalculate the column width after manual updates are made
type PrintTable ¶
type PrintTable struct { Columns []PrintColumn NumRows int }
PrintTable is a table for printing with fixed column width and padding
func (*PrintTable) AddRow ¶
func (t *PrintTable) AddRow(items ...string) *PrintTable
AddRow adds a row of headers/values to the table
func (*PrintTable) RecalcWidth ¶
func (t *PrintTable) RecalcWidth() *PrintTable
RecalcWidth can be called to recalculate the columns width after manual updates are made
func (*PrintTable) String ¶
func (t *PrintTable) String() string