Documentation
¶
Index ¶
- Constants
- func AddSaToRoleBindingWithRetries(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, ...) (err error)
- func DefaultErrorFormat(es []error) string
- func DeleteRoleBinding(ctx context.Context, k8sClient kubernetes.Interface, ...) error
- func DownloadUrl(ctx context.Context, httpClient *http.Client, url string, localPath string) error
- func FileSize(filePath string) (int64, error)
- func FindAllGlobs(paths ...string) ([]string, error)
- func GetChecksum(src io.Reader) (*fv1.Checksum, error)
- func GetCurrentNamespace() (string, error)
- func GetFileChecksum(fileName string) (*fv1.Checksum, error)
- func GetFunctionIstioServiceName(fnName, fnNamespace string) string
- func GetImagePullPolicy(policy string) apiv1.PullPolicy
- func GetInformerFactoryByExecutor(client kubernetes.Interface, executorType v1.ExecutorType, ...) (k8sInformers.SharedInformerFactory, error)
- func GetInformerFactoryByReadyPod(client kubernetes.Interface, namespace string, ...) (k8sInformers.SharedInformerFactory, error)
- func GetInformersForNamespaces(client versioned.Interface, defaultSync time.Duration, kind string) map[string]cache.SharedIndexInformer
- func GetNamespaces() []string
- func GetPackageGetterCR() string
- func GetSecretConfigMapGetterCR() string
- func GetStringValueFromEnv(envVar string) (string, error)
- func GetTempDir() (string, error)
- func GetUIntValueFromEnv(envVar string) (uint, error)
- func IsNetworkError(err error) bool
- func IsPodTerminated(pod *v1.Pod) bool
- func IsReadyPod(pod *v1.Pod) bool
- func IsURL(str string) bool
- func IsZip(filename string) (bool, error)
- func MakeSAMapKey(saName, saNamespace string) string
- func MakeSAObj(sa, ns string) *apiv1.ServiceAccount
- func MakeZipArchive(targetName string, globs ...string) (string, error)
- func MultiErrorWithFormat() *multierror.Error
- func NewBackOff(initialInterval time.Duration, maxInterval time.Duration, multiplier float64, ...) (*backoff, error)
- func NewDefaultBackOff() *backoff
- func PodContainerReadyStatus(pod *v1.Pod) (readyContainers, noOfContainers int)
- func RemoveSAFromRoleBindingWithRetries(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, ...) (err error)
- func RemoveZeroBytes(src []byte) []byte
- func SetupRoleBinding(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, ...) error
- func SetupSA(ctx context.Context, k8sClient kubernetes.Interface, sa, ns string) (*apiv1.ServiceAccount, error)
- func SupportedMetricsAPIVersionAvailable(discoveredAPIGroups *metav1.APIGroupList) bool
- func UrlForFunction(name, namespace string) string
- type NamespaceResolver
- type PatchSpec
Constants ¶
const ( DefaultInitialInterval = 500 * time.Millisecond DefaultMultiplier = 1.5 DefaultMaxInterval = 300 * time.Second DefaultMaxCount = 30 )
const ( ENV_FUNCTION_NAMESPACE string = "FISSION_FUNCTION_NAMESPACE" ENV_BUILDER_NAMESPACE string = "FISSION_BUILDER_NAMESPACE" ENV_DEFAULT_NAMESPACE string = "FISSION_DEFAULT_NAMESPACE" )
Variables ¶
This section is empty.
Functions ¶
func AddSaToRoleBindingWithRetries ¶
func AddSaToRoleBindingWithRetries(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, roleBinding, roleBindingNs, sa, saNamespace, role, roleKind string) (err error)
AddSaToRoleBindingWithRetries adds a service account to a rolebinding object. IT retries on already exists and conflict errors.
func DefaultErrorFormat ¶ added in v1.7.0
func DeleteRoleBinding ¶
func DeleteRoleBinding(ctx context.Context, k8sClient kubernetes.Interface, roleBinding, roleBindingNs string) error
DeleteRoleBinding deletes a rolebinding object. if k8s throws an error that the rolebinding is not there, it just returns silently.
func DownloadUrl ¶ added in v1.7.0
func FindAllGlobs ¶
FindAllGlobs returns a list of globs of input list.
func GetCurrentNamespace ¶ added in v1.17.0
GetCurrentNamespace returns Kubernetes namespace of current Pod
func GetFunctionIstioServiceName ¶
GetFunctionIstioServiceName return service name of function for istio feature
func GetImagePullPolicy ¶
func GetImagePullPolicy(policy string) apiv1.PullPolicy
GetImagePullPolicy returns the image pull policy base on the input value.
func GetInformerFactoryByExecutor ¶ added in v1.14.1
func GetInformerFactoryByExecutor(client kubernetes.Interface, executorType v1.ExecutorType, defaultResync time.Duration) (k8sInformers.SharedInformerFactory, error)
func GetInformerFactoryByReadyPod ¶ added in v1.15.0
func GetInformerFactoryByReadyPod(client kubernetes.Interface, namespace string, labelSelector *metav1.LabelSelector) (k8sInformers.SharedInformerFactory, error)
func GetInformersForNamespaces ¶ added in v1.18.0
func GetNamespaces ¶ added in v1.18.0
func GetNamespaces() []string
func GetPackageGetterCR ¶ added in v1.16.0
func GetPackageGetterCR() string
func GetSecretConfigMapGetterCR ¶ added in v1.16.0
func GetSecretConfigMapGetterCR() string
func GetStringValueFromEnv ¶ added in v1.18.0
func GetTempDir ¶
GetTempDir creates and return a temporary directory
func GetUIntValueFromEnv ¶ added in v1.18.0
func IsNetworkError ¶
IsNetworkError returns true if an error is a network error, and false otherwise.
func IsPodTerminated ¶ added in v1.15.1
func IsReadyPod ¶
IsReadyPod checks both all containers in a pod are ready and whether the .metadata.DeletionTimestamp is nil.
func MakeSAMapKey ¶
func MakeSAObj ¶
func MakeSAObj(sa, ns string) *apiv1.ServiceAccount
MakeSAObj returns a ServiceAccount object with the given SA name and namespace
func MakeZipArchive ¶ added in v1.7.0
func MultiErrorWithFormat ¶ added in v1.7.0
func MultiErrorWithFormat() *multierror.Error
func NewBackOff ¶ added in v1.10.0
func NewBackOff(initialInterval time.Duration, maxInterval time.Duration, multiplier float64, maxCount float64) (*backoff, error)
NewBackOff returns a new backoff struct with initialized values
func NewDefaultBackOff ¶ added in v1.10.0
func NewDefaultBackOff() *backoff
NewDefaultBackOff returns new backoff struct with default values
func PodContainerReadyStatus ¶ added in v1.15.0
PodContainerReadyStatus returns the number of ready containers and total containers present in pod
func RemoveSAFromRoleBindingWithRetries ¶
func RemoveSAFromRoleBindingWithRetries(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, roleBinding, roleBindingNs string, saToRemove map[string]bool) (err error)
RemoveSAFromRoleBindingWithRetries removes an SA from the rolebinding passed as parameter. If this is the only SA in the rolebinding, then it deletes the rolebinding object.
func RemoveZeroBytes ¶
RemoveZeroBytes remove empty byte(\x00) from input byte slice and return a new byte slice This function is trying to fix the problem that empty byte will fail os.Openfile For more information, please visit: 1. https://github.com/golang/go/issues/24195 2. https://play.golang.org/p/5F9ykC2tlbc
func SetupRoleBinding ¶
func SetupRoleBinding(ctx context.Context, logger *zap.Logger, k8sClient kubernetes.Interface, roleBinding, roleBindingNs, role, roleKind, sa, saNamespace string) error
SetupRoleBinding adds a role to a service account if the rolebinding object is already present in the namespace. if not, it creates a rolebinding object granting the role to the SA in the namespace.
func SetupSA ¶
func SetupSA(ctx context.Context, k8sClient kubernetes.Interface, sa, ns string) (*apiv1.ServiceAccount, error)
SetupSA checks if a service account is present in the namespace, if not creates it.
func SupportedMetricsAPIVersionAvailable ¶ added in v1.14.1
func SupportedMetricsAPIVersionAvailable(discoveredAPIGroups *metav1.APIGroupList) bool
func UrlForFunction ¶
Types ¶
type NamespaceResolver ¶ added in v1.18.0
type NamespaceResolver struct { FunctionNamespace string BuiderNamespace string DefaultNamespace string }
func DefaultNSResolver ¶ added in v1.18.0
func DefaultNSResolver() *NamespaceResolver
GetFissionNamespaces => return all fission core component namespaces
func (*NamespaceResolver) GetBuilderNS ¶ added in v1.18.0
func (nsr *NamespaceResolver) GetBuilderNS(namespace string) string
func (*NamespaceResolver) GetFunctionNS ¶ added in v1.18.0
func (nsr *NamespaceResolver) GetFunctionNS(namespace string) string
func (*NamespaceResolver) ResolveNamespace ¶ added in v1.18.0
func (nsr *NamespaceResolver) ResolveNamespace(namespace string) string