Documentation ¶
Overview ¶
Copyright (c) 2022, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
Index ¶
- Constants
- Variables
- func BuildKubeConfig(kubeconfig string) (*rest.Config, 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 GetCertManagerClienset() (*certmanagerv1.CertmanagerV1Client, error)
- func GetCertManagerClientsetInCluster(kubeconfigPath string) (*certmanagerv1.CertmanagerV1Client, 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 GetHostnameFromGateway(namespace string, appConfigName string, gateways ...*istiov1alpha3.Gateway) (string, error)
- func GetHostnameFromGatewayInCluster(namespace string, appConfigName string, kubeconfigPath string, ...) (string, error)
- func GetInstalledBOMData(kubeconfigPath string) ([]byte, error)
- func GetIstioClientset() (*istioClient.Clientset, error)
- func GetIstioClientsetInCluster(kubeconfigPath string) (*istioClient.Clientset, 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 ResetCoreV1Client()
- func ResetGetAPIExtV1ClientFunc()
- func SetCmdRunner(r vzos.CmdRunner)
- func SetDefaultRunner()
- func SetFakeClient(client kubernetes.Interface)
- func Unmarshall(reader *bufio.Reader) ([]unstructured.Unstructured, error)
- type ClientConfigFunc
- type YAMLApplier
- func (y *YAMLApplier) ApplyBT(b []byte, args any) error
- func (y *YAMLApplier) ApplyD(directory string) error
- func (y *YAMLApplier) ApplyDT(directory string, args any) error
- func (y *YAMLApplier) ApplyF(filePath string) error
- func (y *YAMLApplier) ApplyFT(filePath string, args any) error
- func (y *YAMLApplier) ApplyFTDefaultConfig(filePath string, args any) error
- func (y *YAMLApplier) ApplyS(spec string) error
- func (y *YAMLApplier) DeleteAll() error
- func (y *YAMLApplier) DeleteF(filePath string) error
- func (y *YAMLApplier) DeleteFT(filePath string, args any) error
- func (y *YAMLApplier) DeleteFTDefaultConfig(filePath string, args any) error
- func (y *YAMLApplier) DeleteFWithDependents(filePath string) error
- func (y *YAMLApplier) DeleteS(spec string) 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 BuildKubeConfig ¶ added in v1.5.0
func ErrorIfDeploymentExists ¶ added in v1.4.0
ErrorIfDeploymentExists reports error if any of the Deployments exists
func ErrorIfServiceExists ¶ added in v1.4.0
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 ¶ added in v1.5.0
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 ¶ added in v1.6.0
func GetAPIExtGoClient() (apiextv1Client.Interface, error)
GetAPIExtGoClient returns an API Extensions go-client
func GetAPIExtV1Client ¶ added in v1.6.0
func GetAPIExtV1Client() (apiextv1.ApiextensionsV1Interface, error)
GetAPIExtV1Client returns the ApiextensionsV1Interface
func GetAppsV1Client ¶ added in v1.4.0
func GetAppsV1Client(log ...vzlog.VerrazzanoLogger) (appsv1.AppsV1Interface, error)
GetAppsV1Client returns the AppsV1Interface
func GetCertManagerClienset ¶ added in v1.3.0
func GetCertManagerClienset() (*certmanagerv1.CertmanagerV1Client, error)
GetCertManagerClienset returns the clientset object for CertManager
func GetCertManagerClientsetInCluster ¶ added in v1.3.0
func GetCertManagerClientsetInCluster(kubeconfigPath string) (*certmanagerv1.CertmanagerV1Client, error)
GetCertManagerClientsetInCluster returns the clientset object for CertManager
func GetConfigFromController ¶ added in v1.5.0
GetConfigFromController get the config from the Controller Runtime and set the default QPS and burst.
func GetConfigOrDieFromController ¶ added in v1.5.0
GetConfigOrDieFromController get the config from the Controller Runtime and set the default QPS and burst.
func GetCoreV1Client ¶ added in v1.3.0
func GetCoreV1Client(log ...vzlog.VerrazzanoLogger) (corev1.CoreV1Interface, error)
GetCoreV1Client returns the CoreV1Interface
func GetDynamicClient ¶ added in v1.5.0
GetDynamicClient returns the Dynamic Interface
func GetDynamicClientInCluster ¶ added in v1.4.0
GetDynamicClientInCluster returns a dynamic client needed to access Unstructured data
func GetGoClient ¶ added in v1.3.0
func GetGoClient(log ...vzlog.VerrazzanoLogger) (kubernetes.Interface, error)
GetGoClient returns a go-client
func GetHostnameFromGateway ¶
func GetHostnameFromGateway(namespace string, appConfigName string, gateways ...*istiov1alpha3.Gateway) (string, error)
GetHostnameFromGateway returns the host name from the application gateway that was created for the ApplicationConfiguration with name appConfigName from list of input gateways. If the input list of gateways is not provided, it is fetched from the kubernetes cluster
func GetHostnameFromGatewayInCluster ¶
func GetHostnameFromGatewayInCluster(namespace string, appConfigName string, kubeconfigPath string, gateways ...*istiov1alpha3.Gateway) (string, error)
GetHostnameFromGatewayInCluster returns the host name from the application gateway that was created for the ApplicationConfiguration with name appConfigName from list of input gateways. If the input list of gateways is not provided, it is fetched from the kubernetes cluster
func GetInstalledBOMData ¶ added in v1.4.0
GetInstalledBOMData Exec's into the Platform Operator pod and returns the installed BOM file data as JSON
func GetIstioClientset ¶
func GetIstioClientset() (*istioClient.Clientset, error)
GetIstioClientset returns the clientset object for Istio
func GetIstioClientsetInCluster ¶
func GetIstioClientsetInCluster(kubeconfigPath string) (*istioClient.Clientset, error)
GetIstioClientsetInCluster returns the clientset object for Istio
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 ¶ added in v1.4.0
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 ¶ added in v1.4.0
func GetKubernetesClientsetOrDie() *kubernetes.Clientset
GetKubernetesClientsetOrDie returns the kubernetes clientset, panic if it cannot be created.
func GetKubernetesClientsetWithConfig ¶ added in v1.3.0
func GetKubernetesClientsetWithConfig(config *rest.Config) (*kubernetes.Clientset, error)
GetKubernetesClientsetWithConfig returns the Kubernetes clientset for the given configuration
func GetKubernetesVersion ¶ added in v1.6.0
GetKubernetesVersion returns the version of Kubernetes cluster in which operator is deployed
func GetRunningPodForLabel ¶ added in v1.4.0
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 ¶ added in v1.4.0
func GetURLForIngress(client client.Client, name string, namespace string, scheme string) (string, error)
GetURLForIngress returns the url for an Ingress
func IsMinimumk8sVersion ¶ added in v1.6.0
func Marshal ¶ added in v1.5.4
func Marshal(objs []unstructured.Unstructured) ([]byte, error)
Marshal a list of unstructured objects as YAML to a byte array
func ResetCoreV1Client ¶ added in v1.4.6
func ResetCoreV1Client()
func ResetGetAPIExtV1ClientFunc ¶ added in v1.6.0
func ResetGetAPIExtV1ClientFunc()
ResetGetAPIExtV1ClientFunc for unit testing, to reset any overrides to GetAPIExtV1ClientFunc
func SetCmdRunner ¶ added in v1.5.0
SetCmdRunner sets the command runner as needed by unit tests
func SetDefaultRunner ¶ added in v1.5.0
func SetDefaultRunner()
SetDefaultRunner sets the command runner to default
func SetFakeClient ¶ added in v1.3.0
func SetFakeClient(client kubernetes.Interface)
SetFakeClient for unit tests
func Unmarshall ¶ added in v1.5.4
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 ¶ added in v1.2.0
type YAMLApplier struct {
// contains filtered or unexported fields
}
func NewYAMLApplier ¶ added in v1.2.0
func NewYAMLApplier(client crtpkg.Client, namespaceOverride string) *YAMLApplier
func (*YAMLApplier) ApplyBT ¶ added in v1.7.0
func (y *YAMLApplier) ApplyBT(b []byte, args any) error
func (*YAMLApplier) ApplyD ¶ added in v1.2.0
func (y *YAMLApplier) ApplyD(directory string) error
ApplyD applies all YAML files in a directory to Kubernetes
func (*YAMLApplier) ApplyDT ¶ added in v1.4.0
func (y *YAMLApplier) ApplyDT(directory string, args any) error
ApplyDT applies a directory of file templates to Kubernetes
func (*YAMLApplier) ApplyF ¶ added in v1.2.0
func (y *YAMLApplier) ApplyF(filePath string) error
ApplyF applies a file spec to Kubernetes
func (*YAMLApplier) ApplyFT ¶ added in v1.2.0
func (y *YAMLApplier) ApplyFT(filePath string, args any) error
ApplyFT applies a file template spec (go text.template) to Kubernetes
func (*YAMLApplier) ApplyFTDefaultConfig ¶ added in v1.2.0
func (y *YAMLApplier) ApplyFTDefaultConfig(filePath string, args any) error
ApplyFTDefaultConfig calls ApplyFT with rest client from the default config
func (*YAMLApplier) ApplyS ¶ added in v1.6.6
func (y *YAMLApplier) ApplyS(spec string) error
ApplyS applies a spec to Kubernetes via a string
func (*YAMLApplier) DeleteAll ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (y *YAMLApplier) DeleteF(filePath string) error
DeleteF deletes a file spec from Kubernetes
func (*YAMLApplier) DeleteFT ¶ added in v1.2.0
func (y *YAMLApplier) DeleteFT(filePath string, args any) error
DeleteFT deletes a file template spec (go text.template) to Kubernetes
func (*YAMLApplier) DeleteFTDefaultConfig ¶ added in v1.2.0
func (y *YAMLApplier) DeleteFTDefaultConfig(filePath string, args any) error
DeleteFTDefaultConfig calls deleteFT with rest client from the default config
func (*YAMLApplier) DeleteFWithDependents ¶ added in v1.6.0
func (y *YAMLApplier) DeleteFWithDependents(filePath string) error
DeleteFWithDependents deletes a file spec from Kubernetes along with other dependent objects in the background
func (*YAMLApplier) DeleteS ¶ added in v1.7.0
func (y *YAMLApplier) DeleteS(spec string) error
DeleteS deletes resources in a spec from Kubernetes via a string
func (*YAMLApplier) ObjectResultMsgs ¶ added in v1.4.0
func (y *YAMLApplier) ObjectResultMsgs() []string
ObjectResultMsgs is the list of object result messages using the ApplyX methods
func (*YAMLApplier) Objects ¶ added in v1.2.0
func (y *YAMLApplier) Objects() []unstructured.Unstructured
Objects is the list of objects created using the ApplyX methods