Documentation ¶
Index ¶
- Variables
- func ApplyConfigMap(ctx context.Context, k8sClient client.Client, configmap *corev1.ConfigMap) error
- func ApplyDeployment(ctx context.Context, k8sClient client.Client, deploy *appv1.Deployment) error
- func ApplyService(ctx context.Context, k8sClient client.Client, expectSvc *corev1.Service, ...) error
- func ApplyStatefulSet(ctx context.Context, k8sClient client.Client, expect *appv1.StatefulSet, ...) error
- func CheckVolumes(volumes []corev1.Volume, mounts []corev1.VolumeMount) error
- func CleanMinorVersion(version string) string
- func CreateClientObject(ctx context.Context, k8sClient client.Client, object client.Object) error
- func DeleteAutoscaler(ctx context.Context, k8sClient client.Client, namespace, name string, ...) error
- func DeleteConfigMap(ctx context.Context, k8sClient client.Client, namespace, name string) error
- func DeleteDeployment(ctx context.Context, k8sClient client.Client, namespace, name string) error
- func DeleteService(ctx context.Context, k8sClient client.Client, namespace, name string) error
- func DeleteStatefulset(ctx context.Context, k8sClient client.Client, namespace, name string) error
- func GetConfig(ctx context.Context, k8sClient client.Client, ...) (map[string]interface{}, error)
- func GetConfigMap(ctx context.Context, k8scient client.Client, namespace, name string) (*corev1.ConfigMap, error)
- func GetEnvVarValue(ctx context.Context, k8sClient client.Client, namespace string, ...) (string, error)
- func GetKubernetesVersion() error
- func GetValueFromConfigmap(ctx context.Context, k8sClient client.Client, namespace string, name string, ...) (string, error)
- func GetValueFromSecret(ctx context.Context, k8sClient client.Client, namespace string, name string, ...) (string, error)
- func HasMountPath(mounts []corev1.VolumeMount, newMountPath string) bool
- func HasVolume(volumes []corev1.Volume, newVolumeName string) bool
- func PodIsReady(status *corev1.PodStatus) bool
- func ResolveConfigMap(configMap *corev1.ConfigMap, key string) (map[string]interface{}, error)
- func UpdateClientObject(ctx context.Context, k8sClient client.Client, object client.Object) error
- type ServiceEqual
- type StatefulSetEqual
Constants ¶
This section is empty.
Variables ¶
var ( KUBE_MAJOR_VERSION string KUBE_MINOR_VERSION string )
Functions ¶
func ApplyConfigMap ¶ added in v1.8.0
func ApplyDeployment ¶ added in v1.8.0
func ApplyService ¶
func ApplyStatefulSet ¶
func ApplyStatefulSet(ctx context.Context, k8sClient client.Client, expect *appv1.StatefulSet, enableScaleTo1 bool, equal StatefulSetEqual) error
ApplyStatefulSet when the object is not exist, create object. if exist and statefulset have been updated, patch the statefulset.
func CheckVolumes ¶ added in v1.9.1
func CheckVolumes(volumes []corev1.Volume, mounts []corev1.VolumeMount) error
func CleanMinorVersion ¶ added in v1.9.4
CleanMinorVersion removes non-digit characters from a Kubernetes minor version string.
func CreateClientObject ¶
func DeleteAutoscaler ¶
func DeleteConfigMap ¶ added in v1.8.0
DeleteConfigMap delete configmap.
func DeleteDeployment ¶ added in v1.8.0
DeleteDeployment delete deployment.
func DeleteService ¶
DeleteService delete service.
func DeleteStatefulset ¶
DeleteStatefulset delete statefulset.
func GetConfig ¶ added in v1.9.8
func GetConfig(ctx context.Context, k8sClient client.Client, configMapInfo srapi.ConfigMapInfo, configMaps []srapi.ConfigMapReference, expectMountPath, expectKey string, namespace string) (map[string]interface{}, error)
GetConfig get the config of component. First, It tries to read the config from the ConfigMapInfo, which has the configMap name and key. Second, if the ConfigMapInfo is empty, it will try to read the config from the ConfigMaps. Last, If the fe ConfigMapInfo is empty and the configMaps is nil, it will return an empty map.
func GetConfigMap ¶
func GetConfigMap(ctx context.Context, k8scient client.Client, namespace, name string) (*corev1.ConfigMap, error)
GetConfigMap get the configmap name=name, namespace=namespace.
func GetEnvVarValue ¶ added in v1.9.0
func GetEnvVarValue(ctx context.Context, k8sClient client.Client, namespace string, envVar corev1.EnvVar) (string, error)
GetEnvVarValue returns the value of an environment variable. It handles both Value and ValueFrom cases. It assumes that the environment variable exists and is valid.
func GetKubernetesVersion ¶ added in v1.8.1
func GetKubernetesVersion() error
GetKubernetesVersion get kubernetes version. It should not be executed concurrently. The global variable KUBE_MAJOR_VERSION and KUBE_MINOR_VERSION will be set.
func GetValueFromConfigmap ¶ added in v1.9.0
func GetValueFromConfigmap(ctx context.Context, k8sClient client.Client, namespace string, name string, key string) (string, error)
GetValueFromConfigmap returns the runtime value of a key in a configmap. It assumes that the configmap and the key exist and are valid.
func GetValueFromSecret ¶ added in v1.9.0
func GetValueFromSecret(ctx context.Context, k8sClient client.Client, namespace string, name string, key string) (string, error)
GetValueFromSecret returns the value of a key in a secret. It assumes that the secret and the key exist and are valid.
func HasMountPath ¶ added in v1.9.4
func HasMountPath(mounts []corev1.VolumeMount, newMountPath string) bool
func PodIsReady ¶
func ResolveConfigMap ¶ added in v1.9.8
Types ¶
type ServiceEqual ¶
ServiceEqual judges two services equal or not in some fields. developer can custom the function.
type StatefulSetEqual ¶
type StatefulSetEqual func(expect *appv1.StatefulSet, actual *appv1.StatefulSet) bool
StatefulSetEqual judges two statefulset equal or not in some fields. developer can custom the function.