Documentation ¶
Index ¶
- Variables
- func AddFinalizer(obj metav1.Object, finalizer string) bool
- func AddToRootCAs(localCertFile string) error
- func BuildExternalSecretPath(client *vaultApi.Client, kms nbv1.KeyManagementServiceSpec, uid string) (string, error)
- func CombineErrors(errs ...error) error
- func ComposePredicates(predicates ...predicate.Predicate) predicate.Predicate
- func Contains(s string, arr []string) bool
- func Context() context.Context
- func CurrentNamespace() string
- func DeleteSecret(client *vaultApi.Client, secretPath string) error
- func DeleteStorageClass(sc *storagev1.StorageClass) error
- func EnsureCommonMetaFields(object metav1.Object, finalizer string) bool
- func GetAWSRegion() (string, error)
- func GetCmDataHash(input map[string]string) string
- 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 GetIBMRegion() (string, error)
- func GetPodLogs(pod corev1.Pod) (map[string]io.ReadCloser, error)
- func GetPodStatusLine(pod *corev1.Pod) string
- func GetSecret(client *vaultApi.Client, secretName, secretPath string, backendPath string) (string, error)
- func GetVaultTLSConfig(config map[string]string, namespace string) (*api.TLSConfig, error)
- func GetWatchNamespace() (string, error)
- func HumanizeDuration(duration time.Duration) string
- func IgnoreError(err error)
- func InitLogger()
- func InitVaultClient(config map[string]string, tokenSecretName string, namespace string) (*vaultApi.Client, error)
- func IsAWSPlatform() bool
- func IsAzurePlatform() bool
- func IsGCPPlatform() bool
- func IsIBMPlatform() bool
- func IsPersistentError(err error) bool
- func IsStringGraphicOrSpacesCharsOnly(s string) bool
- func IsValidS3BucketName(name string) bool
- func IsVaultKMS(provider string) bool
- func KubeApply(obj client.Object) bool
- func KubeCheck(obj client.Object) bool
- func KubeCheckOptional(obj client.Object) bool
- func KubeCheckQuiet(obj client.Object) bool
- func KubeClient() client.Client
- func KubeConfig() *rest.Config
- func KubeCreateFailExisting(obj client.Object) bool
- func KubeCreateOptional(obj client.Object) bool
- func KubeCreateSkipExisting(obj client.Object) bool
- func KubeDelete(obj client.Object, opts ...client.DeleteOption) bool
- func KubeDeleteAllOf(obj client.Object, opts ...client.DeleteAllOfOption) bool
- func KubeDeleteNoPolling(obj client.Object, opts ...client.DeleteOption) bool
- func KubeGet(obj client.Object) (name string, kind string, err error)
- func KubeList(list client.ObjectList, options ...client.ListOption) bool
- func KubeObject(text string) runtime.Object
- func KubeUpdate(obj client.Object) bool
- func LoadBucketReplicationJSON(replicationJSONFilePath string) (string, error)
- func LogError(err error)
- func Logger() *logrus.Entry
- func MapperProvider(config *rest.Config) (meta.RESTMapper, error)
- func MergeEnvArrays(envA, envB *[]corev1.EnvVar)
- func MergeVolumeList(existing, template *[]corev1.Volume)
- func MergeVolumeMountList(existing, template *[]corev1.VolumeMount)
- func NewFastRESTMapper(dc discovery.DiscoveryInterface, filter APIGroupFilterFunc) meta.RESTMapper
- func NoGroupFilter(*metav1.APIGroup) bool
- func ObjectKey(obj client.Object) client.ObjectKey
- func Panic(err error)
- func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop()
- func PutSecret(client *vaultApi.Client, secretName, secretValue, secretPath string, ...) error
- 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 ValidateConnectionDetails(config map[string]string, tokenSecretName string, namespace string) error
- func ValidateVaultConnectionDetails(config map[string]string, tokenName string, namespace string) error
- func VerifyCredsInSecret(secretName string, namespace string, mandatoryProperties []string)
- func VerifyExternalSecretsDeletion(kms nbv1.KeyManagementServiceSpec, namespace string, uid string) 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 FilterForOwner
- type FinalizersChangedPredicate
- type LabelsChangedPredicate
- type LogEventsPredicate
- type OAuth2Endpoints
- type PersistentError
- type PrintColumn
- type PrintTable
Constants ¶
This section is empty.
Variables ¶
var ( // InsecureHTTPTransport is a global insecure http transport InsecureHTTPTransport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } // SecureHTTPTransport is a global secure http transport SecureHTTPTransport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: false}, } )
Functions ¶
func AddFinalizer ¶
AddFinalizer adds the finalizer to the object if it doesn't contains it already
func AddToRootCAs ¶
AddToRootCAs adds a local cert file to Our SecureHttpTransport
func BuildExternalSecretPath ¶
func BuildExternalSecretPath(client *vaultApi.Client, kms nbv1.KeyManagementServiceSpec, uid string) (string, error)
BuildExternalSecretPath builds a string that specifies the root key secret path
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 ComposePredicates ¶
ComposePredicates will compose a variable number of predicte and return a predicate that will allow events that are allowed by any of the given predicates.
func CurrentNamespace ¶
func CurrentNamespace() string
CurrentNamespace reads the current namespace from the kube config
func DeleteSecret ¶
DeleteSecret deletes the secret from the secrets store
func DeleteStorageClass ¶
func DeleteStorageClass(sc *storagev1.StorageClass) error
DeleteStorageClass deletes storage class
func EnsureCommonMetaFields ¶
EnsureCommonMetaFields ensures that the resource has all mandatory meta fields
func GetAWSRegion ¶
GetAWSRegion parses the region from a node's name
func GetCmDataHash ¶
GetCmDataHash calculates a Hash string repersnting an array of key value strings
func GetContainerStatusLine ¶
func GetContainerStatusLine(cont *corev1.ContainerStatus) string
GetContainerStatusLine returns a one liner status for a container
func GetEnvVariable ¶
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 GetIBMRegion ¶
GetIBMRegion returns the cluster's region in IBM Cloud
func GetPodStatusLine ¶
GetPodStatusLine returns a one liner status for a pod
func GetSecret ¶
func GetSecret(client *vaultApi.Client, secretName, secretPath string, backendPath string) (string, error)
GetSecret reads the secret to the secrets store
func GetVaultTLSConfig ¶
GetVaultTLSConfig returns tlsConfig if given
func GetWatchNamespace ¶
GetWatchNamespace returns the namespace the operator should be watching for changes this was implemented in operator-sdk v0.17 and removed. copied from here: https://github.com/operator-framework/operator-sdk/blob/53b00d125fb12515cd74fb169149913b401c8995/pkg/k8sutil/k8sutil.go#L45
func HumanizeDuration ¶
HumanizeDuration humanizes time.Duration output to a meaningful value - will show days/years
func InitVaultClient ¶
func InitVaultClient(config map[string]string, tokenSecretName string, namespace string) (*vaultApi.Client, error)
InitVaultClient inits the secret store
func IsAWSPlatform ¶
func IsAWSPlatform() bool
IsAWSPlatform returns true if this cluster is running on AWS
func IsAzurePlatform ¶
func IsAzurePlatform() bool
IsAzurePlatform returns true if this cluster is running on Azure
func IsGCPPlatform ¶
func IsGCPPlatform() bool
IsGCPPlatform returns true if this cluster is running on GCP
func IsIBMPlatform ¶
func IsIBMPlatform() bool
IsIBMPlatform returns true if this cluster is running on IBM Cloud
func IsPersistentError ¶
IsPersistentError checks if the provided error is persistent.
func IsStringGraphicOrSpacesCharsOnly ¶
IsStringGraphicOrSpacesCharsOnly returns true only if all the chars are graphic or spaces
func IsValidS3BucketName ¶
IsValidS3BucketName checks the name according to https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
func IsVaultKMS ¶
IsVaultKMS return true if kms provider is vault
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 ¶
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 KubeCreateFailExisting ¶
KubeCreateFailExisting will check if the object exists and will create/skip accordingly and report the object status.
func KubeCreateOptional ¶
KubeCreateOptional will check if the object exists and will create/skip accordingly It detects the situation of a missing CRD and reports it as an optional feature.
func KubeCreateSkipExisting ¶
KubeCreateSkipExisting will try to create an object returns true of the object exist or was created returns false otherwise
func KubeDelete ¶
func KubeDelete(obj client.Object, opts ...client.DeleteOption) bool
KubeDelete deletes an object and reports the object status.
func KubeDeleteAllOf ¶
func KubeDeleteAllOf(obj client.Object, opts ...client.DeleteAllOfOption) bool
KubeDeleteAllOf deletes an list of objects and reports the status.
func KubeDeleteNoPolling ¶
func KubeDeleteNoPolling(obj client.Object, opts ...client.DeleteOption) bool
KubeDeleteNoPolling deletes an object without waiting for acknowledgement the object got deleted
func KubeGet ¶
KubeGet gets a client.Object, fills the given object and returns the name and kind returns error on failure
func KubeList ¶
func KubeList(list client.ObjectList, 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 LoadBucketReplicationJSON ¶
LoadBucketReplicationJSON loads the bucket replication from a json file
func MapperProvider ¶
func MapperProvider(config *rest.Config) (meta.RESTMapper, error)
MapperProvider creates RESTMapper
func MergeEnvArrays ¶
MergeEnvArrays takes two Env variables arrays and merge them into the first
func MergeVolumeList ¶
MergeVolumeList takes two Volume arrays and merge them into the first
func MergeVolumeMountList ¶
func MergeVolumeMountList(existing, template *[]corev1.VolumeMount)
MergeVolumeMountList takes two VolumeMount arrays and merge them into the first
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 ¶
func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop()
PrintThisNoteWhenFinishedApplyingAndStartWaitLoop is a common log task
func PutSecret ¶
func PutSecret(client *vaultApi.Client, secretName, secretValue, secretPath string, backendPath string) error
PutSecret writes the secret to the secrets store
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 ¶
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 SaveStreamToFile ¶
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
func Tar ¶
Tar takes a source and variable writers and walks 'source' writing each file found to the tar writer; the purpose for accepting multiple writers is to allow for multiple outputs (for example a file, or md5 hash)
func ValidateConnectionDetails ¶
func ValidateConnectionDetails(config map[string]string, tokenSecretName string, namespace string) error
ValidateConnectionDetails return error if kms connection details are faulty
func ValidateVaultConnectionDetails ¶
func ValidateVaultConnectionDetails(config map[string]string, tokenName string, namespace string) error
ValidateVaultConnectionDetails return error if vault connection details are faulty
func VerifyCredsInSecret ¶
VerifyCredsInSecret throws fatal error when a given secret doesn't contain the mandatory properties
func VerifyExternalSecretsDeletion ¶
func VerifyExternalSecretsDeletion(kms nbv1.KeyManagementServiceSpec, namespace string, uid string) error
VerifyExternalSecretsDeletion checks if noobaa is on un-installation process if true, deletes secrets from external KMS
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 FilterForOwner ¶
FilterForOwner will only allow events that owned by noobaa
func (FilterForOwner) Create ¶
func (p FilterForOwner) Create(e event.CreateEvent) bool
Create implements the create event trap for FilterForOwner
func (FilterForOwner) Delete ¶
func (p FilterForOwner) Delete(e event.DeleteEvent) bool
Delete implements the delete event trap for FilterForOwner
func (FilterForOwner) Generic ¶
func (p FilterForOwner) Generic(e event.GenericEvent) bool
Generic implements the generic event trap for FilterForOwner
func (FilterForOwner) Update ¶
func (p FilterForOwner) Update(e event.UpdateEvent) bool
Update implements the update event trap for FilterForOwner
type FinalizersChangedPredicate ¶
FinalizersChangedPredicate will only allow events that changed Metadata.Finalizers
func (FinalizersChangedPredicate) Update ¶
func (p FinalizersChangedPredicate) Update(e event.UpdateEvent) bool
Update implements the update event trap for FinalizersChangedPredicate
type LabelsChangedPredicate ¶
LabelsChangedPredicate will only allow events that changed Metadata.Labels
func (LabelsChangedPredicate) Update ¶
func (p LabelsChangedPredicate) Update(e event.UpdateEvent) bool
Update implements the update event trap for LabelsChangedPredicate
type LogEventsPredicate ¶
type LogEventsPredicate struct { }
LogEventsPredicate will passthrough events while loging a message for each
func (LogEventsPredicate) Create ¶
func (p LogEventsPredicate) Create(e event.CreateEvent) bool
Create implements the create event trap for LogEventsPredicate
func (LogEventsPredicate) Delete ¶
func (p LogEventsPredicate) Delete(e event.DeleteEvent) bool
Delete implements the delete event trap for LogEventsPredicate
func (LogEventsPredicate) Generic ¶
func (p LogEventsPredicate) Generic(e event.GenericEvent) bool
Generic implements the generic event trap for LogEventsPredicate
func (LogEventsPredicate) Update ¶
func (p LogEventsPredicate) Update(e event.UpdateEvent) bool
Update implements the update event trap for LogEventsPredicate
type OAuth2Endpoints ¶
type OAuth2Endpoints struct { AuthorizationEndpoint string `json:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint"` }
OAuth2Endpoints holds OAuth2 endpoints information.
func DiscoverOAuthEndpoints ¶
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