Documentation ¶
Index ¶
- func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Clientset, ...) (err error)
- func DefaultErrorFormat(es []error) string
- func DeleteRoleBinding(k8sClient *kubernetes.Clientset, roleBinding, roleBindingNs string) 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 GetFileChecksum(fileName string) (*fv1.Checksum, error)
- func GetFunctionIstioServiceName(fnName, fnNamespace string) string
- func GetImagePullPolicy(policy string) apiv1.PullPolicy
- func GetTempDir() (string, error)
- func IsNetworkError(err error) bool
- func IsReadyPod(pod *apiv1.Pod) bool
- func IsURL(str string) bool
- 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 RemoveSAFromRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Clientset, ...) (err error)
- func RemoveZeroBytes(src []byte) []byte
- func SetupRoleBinding(logger *zap.Logger, k8sClient *kubernetes.Clientset, ...) error
- func SetupSA(k8sClient *kubernetes.Clientset, sa, ns string) (*apiv1.ServiceAccount, error)
- func UrlForFunction(name, namespace string) string
- type PatchSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSaToRoleBindingWithRetries ¶
func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Clientset, 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 ¶
func DeleteRoleBinding ¶
func DeleteRoleBinding(k8sClient *kubernetes.Clientset, 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 ¶
func FindAllGlobs ¶
FindAllGlobs returns a list of globs of input list.
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 GetTempDir ¶
GetTempDir creates and return a temporary directory
func IsNetworkError ¶
IsNetworkError returns true if an error is a network error, and false otherwise.
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 MultiErrorWithFormat ¶
func MultiErrorWithFormat() *multierror.Error
func RemoveSAFromRoleBindingWithRetries ¶
func RemoveSAFromRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Clientset, 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(logger *zap.Logger, k8sClient *kubernetes.Clientset, 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(k8sClient *kubernetes.Clientset, sa, ns string) (*apiv1.ServiceAccount, error)
SetupSA checks if a service account is present in the namespace, if not creates it.