Documentation ¶
Overview ¶
Package kubernetes ...
Package kubernetes ...
Package kubernetes ...
Package kubernetes provides functionality for kubernetes.
Package kubernetes ...
Index ¶
- func IsContainerInState(containerStatuses []corev1.ContainerStatus, state ContainerState) bool
- func IsNodeInCondition(node corev1.Node, conditionType corev1.NodeConditionType) bool
- type ClusterType
- type ContainerState
- type Kubernetes
- func (k *Kubernetes) ClusterName() string
- func (k *Kubernetes) Config() *rest.Config
- func (k *Kubernetes) CreateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
- func (k *Kubernetes) CreateMonitoringConfig(ctx context.Context, storage *everestv1alpha1.MonitoringConfig) error
- func (k *Kubernetes) CreateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
- func (k *Kubernetes) DeleteBackupStorage(ctx context.Context, name string) error
- func (k *Kubernetes) DeleteMonitoringConfig(ctx context.Context, namespace, name string) error
- func (k *Kubernetes) DeleteSecret(ctx context.Context, namespace, name string) error
- func (k *Kubernetes) GetAllClusterResources(ctx context.Context, clusterType ClusterType, ...) (uint64, uint64, uint64, error)
- func (k *Kubernetes) GetBackupStorage(ctx context.Context, name string) (*everestv1alpha1.BackupStorage, error)
- func (k *Kubernetes) GetClusterType(ctx context.Context) (ClusterType, error)
- func (k *Kubernetes) GetConsumedCPUAndMemory(ctx context.Context, namespace string) (cpuMillis uint64, memoryBytes uint64, err error)
- func (k *Kubernetes) GetConsumedDiskBytes(_ context.Context, clusterType ClusterType, ...) (uint64, error)
- func (k *Kubernetes) GetDBNamespaces(ctx context.Context, namespace string) ([]string, error)
- func (k *Kubernetes) GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error)
- func (k *Kubernetes) GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error)
- func (k *Kubernetes) GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error)
- func (k *Kubernetes) GetDatabaseEngine(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseEngine, error)
- func (k *Kubernetes) GetDeployment(ctx context.Context, name, namespace string) (*appsv1.Deployment, error)
- func (k *Kubernetes) GetEverestID(ctx context.Context) (string, error)
- func (k *Kubernetes) GetMonitoringConfig(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error)
- func (k *Kubernetes) GetMonitoringConfigsBySecretName(ctx context.Context, namespace, secretName string) ([]*everestv1alpha1.MonitoringConfig, error)
- func (k *Kubernetes) GetNamespace(ctx context.Context, name string) (*corev1.Namespace, error)
- func (k *Kubernetes) GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error)
- func (k *Kubernetes) GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error)
- func (k *Kubernetes) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)
- func (k *Kubernetes) GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)
- func (k *Kubernetes) GetWorkerNodes(ctx context.Context) ([]corev1.Node, error)
- func (k *Kubernetes) IsBackupStorageUsed(ctx context.Context, backupStorageName string) (bool, error)
- func (k *Kubernetes) IsMonitoringConfigUsed(ctx context.Context, namespace, monitoringConfigName string) (bool, error)
- func (k *Kubernetes) ListBackupStorages(ctx context.Context) (*everestv1alpha1.BackupStorageList, error)
- func (k *Kubernetes) ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterBackupList, error)
- func (k *Kubernetes) ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterRestoreList, error)
- func (k *Kubernetes) ListDatabaseClusters(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseClusterList, error)
- func (k *Kubernetes) ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error)
- func (k *Kubernetes) ListMonitoringConfigs(ctx context.Context, namespace string) (*everestv1alpha1.MonitoringConfigList, error)
- func (k *Kubernetes) Namespace() string
- func (k *Kubernetes) UpdateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
- func (k *Kubernetes) UpdateMonitoringConfig(ctx context.Context, storage *everestv1alpha1.MonitoringConfig) error
- func (k *Kubernetes) UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsContainerInState ¶
func IsContainerInState(containerStatuses []corev1.ContainerStatus, state ContainerState) bool
IsContainerInState returns true if container is in give state, otherwise false.
func IsNodeInCondition ¶
func IsNodeInCondition(node corev1.Node, conditionType corev1.NodeConditionType) bool
IsNodeInCondition returns true if node's condition given as an argument has status "True". Otherwise it returns false.
Types ¶
type ClusterType ¶
type ClusterType string
ClusterType defines type of cluster.
const ( // ClusterTypeUnknown is for unknown type. ClusterTypeUnknown ClusterType = "unknown" // ClusterTypeMinikube is for minikube. ClusterTypeMinikube ClusterType = "minikube" // ClusterTypeEKS is for EKS. ClusterTypeEKS ClusterType = "eks" // ClusterTypeGeneric is a generic type. ClusterTypeGeneric ClusterType = "generic" // EverestOperatorDeploymentName is the name of the deployment for everest operator. EverestOperatorDeploymentName = "everest-operator-controller-manager" // EverestDBNamespacesEnvVar is the name of the environment variable that // contains the list of monitored namespaces. EverestDBNamespacesEnvVar = "DB_NAMESPACES" )
type ContainerState ¶
type ContainerState string
ContainerState describes container's state - waiting, running, terminated.
const ( // ContainerStateWaiting represents a state when container requires some // operations being done in order to complete start up. ContainerStateWaiting ContainerState = "waiting" // ContainerStateTerminated indicates that container began execution and // then either ran to completion or failed for some reason. ContainerStateTerminated ContainerState = "terminated" )
type Kubernetes ¶
type Kubernetes struct {
// contains filtered or unexported fields
}
Kubernetes is a client for Kubernetes.
func NewInCluster ¶ added in v0.5.0
func NewInCluster(l *zap.SugaredLogger) (*Kubernetes, error)
NewInCluster creates a new kubernetes client using incluster authentication.
func (*Kubernetes) ClusterName ¶
func (k *Kubernetes) ClusterName() string
ClusterName returns the name of the k8s cluster.
func (*Kubernetes) Config ¶ added in v0.5.0
func (k *Kubernetes) Config() *rest.Config
Config returns rest config.
func (*Kubernetes) CreateBackupStorage ¶ added in v0.5.0
func (k *Kubernetes) CreateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
CreateBackupStorage returns backup storages by provided name.
func (*Kubernetes) CreateMonitoringConfig ¶ added in v0.5.0
func (k *Kubernetes) CreateMonitoringConfig(ctx context.Context, storage *everestv1alpha1.MonitoringConfig) error
CreateMonitoringConfig returns monitoring configs by provided name.
func (*Kubernetes) CreateSecret ¶ added in v0.2.0
func (k *Kubernetes) CreateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
CreateSecret creates a secret.
func (*Kubernetes) DeleteBackupStorage ¶ added in v0.5.0
func (k *Kubernetes) DeleteBackupStorage(ctx context.Context, name string) error
DeleteBackupStorage returns backup storages by provided name.
func (*Kubernetes) DeleteMonitoringConfig ¶ added in v0.2.0
func (k *Kubernetes) DeleteMonitoringConfig(ctx context.Context, namespace, name string) error
DeleteMonitoringConfig returns monitoring configs by provided name.
func (*Kubernetes) DeleteSecret ¶ added in v0.2.0
func (k *Kubernetes) DeleteSecret(ctx context.Context, namespace, name string) error
DeleteSecret deletes a secret.
func (*Kubernetes) GetAllClusterResources ¶
func (k *Kubernetes) GetAllClusterResources( ctx context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList, ) (uint64, uint64, uint64, error)
GetAllClusterResources goes through all cluster nodes and sums their allocatable resources.
func (*Kubernetes) GetBackupStorage ¶ added in v0.2.0
func (k *Kubernetes) GetBackupStorage(ctx context.Context, name string) (*everestv1alpha1.BackupStorage, error)
GetBackupStorage returns backup storages by provided name.
func (*Kubernetes) GetClusterType ¶
func (k *Kubernetes) GetClusterType(ctx context.Context) (ClusterType, error)
GetClusterType tries to guess the underlying kubernetes cluster based on storage class.
func (*Kubernetes) GetConsumedCPUAndMemory ¶
func (k *Kubernetes) GetConsumedCPUAndMemory(ctx context.Context, namespace string) ( cpuMillis uint64, memoryBytes uint64, err error, )
GetConsumedCPUAndMemory returns consumed CPU and Memory in given namespace. If namespace is empty, it tries to get them from all namespaces.
func (*Kubernetes) GetConsumedDiskBytes ¶
func (k *Kubernetes) GetConsumedDiskBytes( _ context.Context, clusterType ClusterType, volumes *corev1.PersistentVolumeList, ) (uint64, error)
GetConsumedDiskBytes returns consumed bytes. The strategy differs based on k8s cluster type.
func (*Kubernetes) GetDBNamespaces ¶ added in v0.8.0
GetDBNamespaces returns a list of namespaces that are monitored by the Everest operator.
func (*Kubernetes) GetDatabaseCluster ¶
func (k *Kubernetes) GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error)
GetDatabaseCluster returns database clusters by provided name.
func (*Kubernetes) GetDatabaseClusterBackup ¶ added in v0.2.0
func (k *Kubernetes) GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error)
GetDatabaseClusterBackup returns database cluster backup by name.
func (*Kubernetes) GetDatabaseClusterRestore ¶ added in v0.2.0
func (k *Kubernetes) GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error)
GetDatabaseClusterRestore returns database cluster restore by name.
func (*Kubernetes) GetDatabaseEngine ¶ added in v0.3.0
func (k *Kubernetes) GetDatabaseEngine(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseEngine, error)
GetDatabaseEngine returns database clusters by provided name.
func (*Kubernetes) GetDeployment ¶ added in v0.8.0
func (k *Kubernetes) GetDeployment(ctx context.Context, name, namespace string) (*appsv1.Deployment, error)
GetDeployment returns k8s deployment by provided name and namespace.
func (*Kubernetes) GetEverestID ¶ added in v0.5.0
func (k *Kubernetes) GetEverestID(ctx context.Context) (string, error)
GetEverestID returns the ID of the namespace where everest is deployed.
func (*Kubernetes) GetMonitoringConfig ¶ added in v0.5.0
func (k *Kubernetes) GetMonitoringConfig(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error)
GetMonitoringConfig returns monitoring configs by provided name.
func (*Kubernetes) GetMonitoringConfigsBySecretName ¶ added in v0.2.0
func (k *Kubernetes) GetMonitoringConfigsBySecretName( ctx context.Context, namespace, secretName string, ) ([]*everestv1alpha1.MonitoringConfig, error)
GetMonitoringConfigsBySecretName returns a list of monitoring configs which use the provided secret name.
func (*Kubernetes) GetNamespace ¶ added in v0.2.0
GetNamespace returns a namespace.
func (*Kubernetes) GetPersistentVolumes ¶
func (k *Kubernetes) GetPersistentVolumes(ctx context.Context) (*corev1.PersistentVolumeList, error)
GetPersistentVolumes returns list of persistent volumes.
func (*Kubernetes) GetPods ¶
func (k *Kubernetes) GetPods(ctx context.Context, namespace string, labelSelector *metav1.LabelSelector) (*corev1.PodList, error)
GetPods returns list of pods.
func (*Kubernetes) GetStorageClasses ¶ added in v0.2.0
func (k *Kubernetes) GetStorageClasses(ctx context.Context) (*storagev1.StorageClassList, error)
GetStorageClasses returns list of storage classes.
func (*Kubernetes) GetWorkerNodes ¶
GetWorkerNodes returns list of cluster workers nodes.
func (*Kubernetes) IsBackupStorageUsed ¶ added in v0.5.0
func (k *Kubernetes) IsBackupStorageUsed(ctx context.Context, backupStorageName string) (bool, error)
IsBackupStorageUsed checks that a backup storage by provided name is used across k8s cluster.
func (*Kubernetes) IsMonitoringConfigUsed ¶ added in v0.5.0
func (k *Kubernetes) IsMonitoringConfigUsed(ctx context.Context, namespace, monitoringConfigName string) (bool, error)
IsMonitoringConfigUsed checks that a backup storage by provided name is used across k8s cluster.
func (*Kubernetes) ListBackupStorages ¶ added in v0.5.0
func (k *Kubernetes) ListBackupStorages(ctx context.Context) (*everestv1alpha1.BackupStorageList, error)
ListBackupStorages returns list of managed backup storages.
func (*Kubernetes) ListDatabaseClusterBackups ¶ added in v0.2.0
func (k *Kubernetes) ListDatabaseClusterBackups(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterBackupList, error)
ListDatabaseClusterBackups returns database cluster backups.
func (*Kubernetes) ListDatabaseClusterRestores ¶ added in v0.2.0
func (k *Kubernetes) ListDatabaseClusterRestores(ctx context.Context, namespace string, options metav1.ListOptions) (*everestv1alpha1.DatabaseClusterRestoreList, error)
ListDatabaseClusterRestores returns database cluster restores.
func (*Kubernetes) ListDatabaseClusters ¶
func (k *Kubernetes) ListDatabaseClusters(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseClusterList, error)
ListDatabaseClusters returns list of managed database clusters.
func (*Kubernetes) ListDatabaseEngines ¶ added in v0.3.0
func (k *Kubernetes) ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error)
ListDatabaseEngines returns list of managed database clusters.
func (*Kubernetes) ListMonitoringConfigs ¶ added in v0.5.0
func (k *Kubernetes) ListMonitoringConfigs(ctx context.Context, namespace string) (*everestv1alpha1.MonitoringConfigList, error)
ListMonitoringConfigs returns list of managed monitoring configs.
func (*Kubernetes) Namespace ¶ added in v0.5.0
func (k *Kubernetes) Namespace() string
Namespace returns the current namespace.
func (*Kubernetes) UpdateBackupStorage ¶ added in v0.5.0
func (k *Kubernetes) UpdateBackupStorage(ctx context.Context, storage *everestv1alpha1.BackupStorage) error
UpdateBackupStorage returns backup storages by provided name.
func (*Kubernetes) UpdateMonitoringConfig ¶ added in v0.5.0
func (k *Kubernetes) UpdateMonitoringConfig(ctx context.Context, storage *everestv1alpha1.MonitoringConfig) error
UpdateMonitoringConfig returns monitoring configs by provided name.
func (*Kubernetes) UpdateSecret ¶ added in v0.2.0
func (k *Kubernetes) UpdateSecret(ctx context.Context, secret *corev1.Secret) (*corev1.Secret, error)
UpdateSecret updates a secret.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package client ...
|
Package client ... |
customresources
Package customresources provides methods to work with custom everest k8s resources.
|
Package customresources provides methods to work with custom everest k8s resources. |