Documentation ¶
Index ¶
- Constants
- Variables
- func BuildKubeConfig(kubeconfig string) (*rest.Config, error)
- func CheckCRDsExist(crdNames []string) (bool, error)
- func ClearFakeClient()
- func ErrorIfDeploymentExists(namespace string, names ...string) error
- func ErrorIfServiceExists(namespace string, names ...string) error
- func ExecPod(client kubernetes.Interface, cfg *rest.Config, pod *v1.Pod, container string, ...) (string, string, error)
- func ExecPodNoTty(client kubernetes.Interface, cfg *rest.Config, pod *v1.Pod, container string, ...) (string, string, error)
- func GetAPIExtGoClient() (apiextv1Client.Interface, error)
- func GetAPIExtV1Client() (apiextv1.ApiextensionsV1Interface, error)
- func GetAppsV1Client(log ...vzlog.VerrazzanoLogger) (appsv1.AppsV1Interface, error)
- func GetConfigFromController() (*rest.Config, error)
- func GetConfigOrDieFromController() *rest.Config
- func GetCoreV1Client(log ...vzlog.VerrazzanoLogger) (corev1.CoreV1Interface, error)
- func GetDynamicClient() (dynamic.Interface, error)
- func GetDynamicClientInCluster(kubeconfigPath string) (dynamic.Interface, error)
- func GetGoClient(log ...vzlog.VerrazzanoLogger) (kubernetes.Interface, error)
- func GetKubeConfig() (*rest.Config, error)
- func GetKubeConfigGivenPath(kubeconfigPath string) (*rest.Config, error)
- func GetKubeConfigGivenPathAndContext(kubeConfigPath string, kubeContext string) (*rest.Config, error)
- func GetKubeConfigLocation() (string, error)
- func GetKubernetesClientset() (*kubernetes.Clientset, error)
- func GetKubernetesClientsetOrDie() *kubernetes.Clientset
- func GetKubernetesClientsetWithConfig(config *rest.Config) (*kubernetes.Clientset, error)
- func GetKubernetesVersion() (string, error)
- func GetRunningPodForLabel(c client.Client, label string, namespace string, log ...vzlog.VerrazzanoLogger) (*v1.Pod, error)
- func GetURLForIngress(client client.Client, name string, namespace string, scheme string) (string, error)
- func IsMinimumk8sVersion(expectedK8sVersion string) (bool, error)
- func Marshal(objs []unstructured.Unstructured) ([]byte, error)
- func MkDep(ns, name string) *appsv1.Deployment
- func MkSvc(ns, name string) *corev1.Service
- func MockDynamicClient(objects ...runtime.Object) func() (dynamic.Interface, error)
- func MockGetAppsV1(objects ...runtime.Object) func(_ ...vzlog.VerrazzanoLogger) (appsv1Cli.AppsV1Interface, error)
- func MockGetCoreV1(objects ...runtime.Object) func(_ ...vzlog.VerrazzanoLogger) (corev1Cli.CoreV1Interface, error)
- func NewControllerRuntimeClient(opts client.Options) (client.Client, error)
- func ResetGetAPIExtV1ClientFunc()
- func SetFakeClient(client kubernetes.Interface)
- func Unmarshall(reader *bufio.Reader) ([]unstructured.Unstructured, error)
- type ClientConfigFunc
- type YAMLApplier
- func (y *YAMLApplier) ApplyD(directory string) error
- func (y *YAMLApplier) ApplyDT(directory string, args map[string]interface{}) error
- func (y *YAMLApplier) ApplyF(filePath string) error
- func (y *YAMLApplier) ApplyFT(filePath string, args map[string]interface{}) error
- func (y *YAMLApplier) ApplyFTDefaultConfig(filePath string, args map[string]interface{}) error
- func (y *YAMLApplier) DeleteAll() error
- func (y *YAMLApplier) DeleteF(filePath string) error
- func (y *YAMLApplier) DeleteFT(filePath string, args map[string]interface{}) error
- func (y *YAMLApplier) DeleteFTDefaultConfig(filePath string, args map[string]interface{}) error
- func (y *YAMLApplier) ObjectResultMsgs() []string
- func (y *YAMLApplier) Objects() []unstructured.Unstructured
Constants ¶
const APIServerBurst = 150
const APIServerQPS = 100
const EnvVarKubeConfig = "KUBECONFIG"
EnvVarKubeConfig Name of Environment Variable for KUBECONFIG
const EnvVarTestKubeConfig = "TEST_KUBECONFIG"
EnvVarTestKubeConfig Name of Environment Variable for test KUBECONFIG
Variables ¶
var GetAPIExtV1ClientFunc = GetAPIExtV1Client
GetAPIExtV1ClientFunc is the function to return the ApiextensionsV1Interface
var GetAppsV1Func = GetAppsV1Client
GetAppsV1Func is the function the AppsV1Interface
var GetCoreV1Func = GetCoreV1Client
GetCoreV1Func is the function to return the CoreV1Interface
var GetDynamicClientFunc = GetDynamicClient
GetDynamicClientFunc is the function to return the Dynamic Interface
var NewPodExecutor = remotecommand.NewSPDYExecutor
NewPodExecutor is to be overridden during unit tests
Functions ¶
func CheckCRDsExist ¶
func ErrorIfDeploymentExists ¶
ErrorIfDeploymentExists reports error if any of the Deployments exists
func ErrorIfServiceExists ¶
ErrorIfServiceExists reports error if any of the Services exists
func ExecPod ¶
func ExecPod(client kubernetes.Interface, cfg *rest.Config, pod *v1.Pod, container string, command []string) (string, string, error)
ExecPod runs a remote command a pod, returning the stdout and stderr of the command.
func ExecPodNoTty ¶
func ExecPodNoTty(client kubernetes.Interface, cfg *rest.Config, pod *v1.Pod, container string, command []string) (string, string, error)
ExecPodNoTty runs a remote command a pod, returning the stdout and stderr of the command.
func GetAPIExtGoClient ¶
func GetAPIExtGoClient() (apiextv1Client.Interface, error)
GetAPIExtGoClient returns an API Extensions go-client
func GetAPIExtV1Client ¶
func GetAPIExtV1Client() (apiextv1.ApiextensionsV1Interface, error)
GetAPIExtV1Client returns the ApiextensionsV1Interface
func GetAppsV1Client ¶
func GetAppsV1Client(log ...vzlog.VerrazzanoLogger) (appsv1.AppsV1Interface, error)
GetAppsV1Client returns the AppsV1Interface
func GetConfigFromController ¶
GetConfigFromController get the config from the Controller Runtime and set the default QPS and burst.
func GetConfigOrDieFromController ¶
GetConfigOrDieFromController get the config from the Controller Runtime and set the default QPS and burst.
func GetCoreV1Client ¶
func GetCoreV1Client(log ...vzlog.VerrazzanoLogger) (corev1.CoreV1Interface, error)
GetCoreV1Client returns the CoreV1Interface
func GetDynamicClient ¶
GetDynamicClient returns the Dynamic Interface
func GetDynamicClientInCluster ¶
GetDynamicClientInCluster returns a dynamic client needed to access Unstructured data
func GetGoClient ¶
func GetGoClient(log ...vzlog.VerrazzanoLogger) (kubernetes.Interface, error)
GetGoClient returns a go-client
func GetKubeConfig ¶
GetKubeConfig Returns kubeconfig from KUBECONFIG env var if set Else from default location ~/.kube/config
func GetKubeConfigGivenPath ¶
GetKubeConfigGivenPath GetKubeConfig will get the kubeconfig from the given kubeconfigPath
func GetKubeConfigGivenPathAndContext ¶
func GetKubeConfigGivenPathAndContext(kubeConfigPath string, kubeContext string) (*rest.Config, error)
GetKubeConfigGivenPathAndContext returns a rest.Config given a kubeConfig and kubeContext.
func GetKubeConfigLocation ¶
GetKubeConfigLocation Helper function to obtain the default kubeConfig location
func GetKubernetesClientset ¶
func GetKubernetesClientset() (*kubernetes.Clientset, error)
GetKubernetesClientset returns the Kubernetes clientset for the cluster set in the environment
func GetKubernetesClientsetOrDie ¶
func GetKubernetesClientsetOrDie() *kubernetes.Clientset
GetKubernetesClientsetOrDie returns the kubernetes clientset, panic if it cannot be created.
func GetKubernetesClientsetWithConfig ¶
func GetKubernetesClientsetWithConfig(config *rest.Config) (*kubernetes.Clientset, error)
GetKubernetesClientsetWithConfig returns the Kubernetes clientset for the given configuration
func GetKubernetesVersion ¶
GetKubernetesVersion returns the version of Kubernetes cluster in which operator is deployed
func GetRunningPodForLabel ¶
func GetRunningPodForLabel(c client.Client, label string, namespace string, log ...vzlog.VerrazzanoLogger) (*v1.Pod, error)
GetRunningPodForLabel returns the reference of a running pod that matches the given label
func GetURLForIngress ¶
func GetURLForIngress(client client.Client, name string, namespace string, scheme string) (string, error)
GetURLForIngress returns the url for an Ingress
func IsMinimumk8sVersion ¶
func Marshal ¶
func Marshal(objs []unstructured.Unstructured) ([]byte, error)
Marshal a list of unstructured objects as YAML to a byte array
func MkDep ¶
func MkDep(ns, name string) *appsv1.Deployment
func MockDynamicClient ¶
MockDynamicClient mocks GetDynamicClient function
func MockGetAppsV1 ¶
func MockGetAppsV1(objects ...runtime.Object) func(_ ...vzlog.VerrazzanoLogger) (appsv1Cli.AppsV1Interface, error)
MockGetAppsV1 mocks GetAppsV1Client function
func MockGetCoreV1 ¶
func MockGetCoreV1(objects ...runtime.Object) func(_ ...vzlog.VerrazzanoLogger) (corev1Cli.CoreV1Interface, error)
MockGetCoreV1 mocks GetCoreV1Client function
func NewControllerRuntimeClient ¶
NewControllerRuntimeClient Create a new controller runtime client
func ResetGetAPIExtV1ClientFunc ¶
func ResetGetAPIExtV1ClientFunc()
ResetGetAPIExtV1ClientFunc for unit testing, to reset any overrides to GetAPIExtV1ClientFunc
func Unmarshall ¶
func Unmarshall(reader *bufio.Reader) ([]unstructured.Unstructured, error)
Unmarshall a reader containing YAML to a list of unstructured objects
Types ¶
type ClientConfigFunc ¶
type ClientConfigFunc func() (*rest.Config, kubernetes.Interface, error)
var ClientConfig ClientConfigFunc = func() (*rest.Config, kubernetes.Interface, error) { cfg, err := GetConfigFromController() if err != nil { return nil, nil, err } c, err := kubernetes.NewForConfig(cfg) if err != nil { return nil, nil, err } return cfg, c, nil }
type YAMLApplier ¶
type YAMLApplier struct {
// contains filtered or unexported fields
}
func NewYAMLApplier ¶
func NewYAMLApplier(client crtpkg.Client, namespaceOverride string) *YAMLApplier
func (*YAMLApplier) ApplyD ¶
func (y *YAMLApplier) ApplyD(directory string) error
ApplyD applies all YAML files in a directory to Kubernetes
func (*YAMLApplier) ApplyDT ¶
func (y *YAMLApplier) ApplyDT(directory string, args map[string]interface{}) error
ApplyDT applies a directory of file templates to Kubernetes
func (*YAMLApplier) ApplyF ¶
func (y *YAMLApplier) ApplyF(filePath string) error
ApplyF applies a file spec to Kubernetes
func (*YAMLApplier) ApplyFT ¶
func (y *YAMLApplier) ApplyFT(filePath string, args map[string]interface{}) error
ApplyFT applies a file template spec (go text.template) to Kubernetes
func (*YAMLApplier) ApplyFTDefaultConfig ¶
func (y *YAMLApplier) ApplyFTDefaultConfig(filePath string, args map[string]interface{}) error
ApplyFTDefaultConfig calls ApplyFT with rest client from the default config
func (*YAMLApplier) DeleteAll ¶
func (y *YAMLApplier) DeleteAll() error
DeleteAll deletes all objects created by the applier If you are using a YAMLApplier in a temporary context, please use defer y.DeleteAll() to clean up resources when you are done.
func (*YAMLApplier) DeleteF ¶
func (y *YAMLApplier) DeleteF(filePath string) error
DeleteF deletes a file spec from Kubernetes
func (*YAMLApplier) DeleteFT ¶
func (y *YAMLApplier) DeleteFT(filePath string, args map[string]interface{}) error
DeleteFT deletes a file template spec (go text.template) to Kubernetes
func (*YAMLApplier) DeleteFTDefaultConfig ¶
func (y *YAMLApplier) DeleteFTDefaultConfig(filePath string, args map[string]interface{}) error
DeleteFTDefaultConfig calls deleteFT with rest client from the default config
func (*YAMLApplier) ObjectResultMsgs ¶
func (y *YAMLApplier) ObjectResultMsgs() []string
ObjectResultMsgs is the list of object result messages using the ApplyX methods
func (*YAMLApplier) Objects ¶
func (y *YAMLApplier) Objects() []unstructured.Unstructured
Objects is the list of objects created using the ApplyX methods