Documentation ¶
Index ¶
- Constants
- func DecompressGzipTar(readCloser io.ReadCloser, dir string) error
- func DownloadFileFromGithub(owner, repository, fileName, ref, githubURL, user, token string, ...) ([]byte, bool, error)
- func DownloadTrigger(triggerURL, triggerChkSum, dir string, verifyChkSum bool) error
- func DownloadYAML(kubeClient *kubernetes.Clientset, header map[string][]string, ...) (map[string]interface{}, bool, error)
- func GetGitHubSecret(client *kubernetes.Clientset, namespace string, repoURL string) (string, string, error)
- func GetKabaneroNamespace() string
- func GetTriggerFiles(client rest.Interface, url *url.URL, skipChkSumVerify bool) (string, error)
- func GetTriggerInfo(client rest.Interface, namespace string) (*url.URL, string, error)
- func MergePathWithErrorCheck(dir string, toMerge string) (string, error)
- func NewDynamicClient(kubeConfig *rest.Config) (dynamic.Interface, error)
- func NewKabConfig(masterURL, kubeconfigPath string) (*rest.Config, error)
- func NewKubeClient(kubeConfig *rest.Config) (*kubernetes.Clientset, error)
- func NewKubeConfig(masterURL, kubeconfigPath string) (*rest.Config, error)
- func ReadFile(fileName string) ([]byte, error)
- func ReadHTTPURL(url string) ([]byte, error)
- func ReadJSON(fileName string) (*unstructured.Unstructured, error)
- func ToDomainName(name string) string
- func ToLabel(input string) string
- func ToLabelName(name string) string
- func YAMLToMap(bytes []byte) (map[string]interface{}, error)
Constants ¶
const ( // KUBENAMESPACE the namespace that kabanero is running in KUBENAMESPACE = "KUBE_NAMESPACE" // DEFAULTNAMESPACE the default namespace name DEFAULTNAMESPACE = "kabanero" )
const ( V1 = "v1" V1ALPHA1 = "v1alpha1" KABANEROIO = "kabanero.io" KABANEROS = "kabaneros" ANNOTATIONS = "annotations" DATA = "data" URL = "url" USERNAME = "username" PASSWORD = "password" SECRETS = "secrets" SPEC = "spec" COLLECTIONS = "collections" REPOSITORIES = "repositories" ACTIVATEDEFAULTCOLLECTIONS = "activateDefaultCollections" METADATA = "metadata" )
Kubernetes and Kabanero yaml constants
const ( TRIGGERS = "triggers" CHKSUM = "sha256" )
constants
Variables ¶
This section is empty.
Functions ¶
func DecompressGzipTar ¶
func DecompressGzipTar(readCloser io.ReadCloser, dir string) error
DecompressGzipTar Decompresses and extracts a tar.gz file.
func DownloadFileFromGithub ¶
func DownloadFileFromGithub(owner, repository, fileName, ref, githubURL, user, token string, isEnterprise bool) ([]byte, bool, error)
DownloadFileFromGithub Downloads a file and returns: bytes of the file, true if file exists, and any error
func DownloadTrigger ¶
DownloadTrigger Download the trigger.tar.gz and unpack into the directory
triggerURL: URL that serves the trigger gzipped tar triggerChkSum: the sha256 checksum of the trigger archive dir: directory to unpack the trigger.tar.gz
func DownloadYAML ¶
func DownloadYAML(kubeClient *kubernetes.Clientset, header map[string][]string, bodyMap map[string]interface{}, fileName string) (map[string]interface{}, bool, error)
DownloadYAML Downloads a YAML file from a git repository.
header: HTTP header from webhook bodyMap: HTTP message body from webhook
func GetGitHubSecret ¶
func GetGitHubSecret(client *kubernetes.Clientset, namespace string, repoURL string) (string, string, error)
GetGitHubSecret Find the user/token for a GitHub API key. The format of the secret: apiVersion: v1 kind: Secret metadata:
name: gh-https-secret annotations: tekton.dev/git-0: https://github.com
type: kubernetes.io/basic-auth stringData:
username: <username> password: <token>
This will scan for a secret with either of the following annotations:
- tekton.dev/git-*
- kabanero.io/git-*
GetGitHubSecret will return the username and token of a secret whose annotation's value is a prefix match for repoURL. Note that a secret with the `kabanero.io/git-*` annotation is preferred over one with `tekton.dev/git-*`. Return: username, token, error
func GetKabaneroNamespace ¶
func GetKabaneroNamespace() string
GetKabaneroNamespace Get namespace of where kabanero is installed
func GetTriggerFiles ¶
GetTriggerFiles returns the directory containing the retrieved trigger files.
func GetTriggerInfo ¶
GetTriggerInfo Get the URL to trigger gzipped tar and its sha256 checksum.
func MergePathWithErrorCheck ¶
MergePathWithErrorCheck Merge a directory path with a relative path. Return error if the rectory not a prefix of the merged path after the merge
func NewDynamicClient ¶
NewDynamicClient Creates a new dynamic client
func NewKabConfig ¶
NewKabConfig Creates a new kabanero client config
func NewKubeClient ¶
func NewKubeClient(kubeConfig *rest.Config) (*kubernetes.Clientset, error)
NewKubeClient Creates a new kube client
func NewKubeConfig ¶
NewKubeConfig Creates a new kube config
func ReadHTTPURL ¶
ReadHTTPURL Read remote file from URL and return bytes
func ReadJSON ¶
func ReadJSON(fileName string) (*unstructured.Unstructured, error)
ReadJSON reads a JSON file and returns it as an unstructured.Unstructured object.
func ToDomainName ¶
ToDomainName Convert a name to domain name format. The name must:
- Start with [a-z0-9]. If not, "0" is prepended.
- lower case. If not, lower case is used.
- contain only '.', '-', and [a-z0-9]. If not, "." is used insteaad.
- end with alpha numeric characters. Otherwise, '0' is appended
- can't have consecutive '.'. Consecutive ".." is substituted with ".".
Returns the empty string if the name is empty after conversion
func ToLabelName ¶
ToLabelName Convert the name part of a label. The name must:
- Start with [a-z0-9A-Z]. If not, "0" is prepended.
- End with [a-z0-9A-Z]. If not, "0" is appended
- Intermediate characters can only be: [a-z0-9A-Z] or '_', '-', and '.' If not, '.' is used.
- be maximum maxLabelLength characters long
Types ¶
This section is empty.