Documentation
¶
Index ¶
- Constants
- Variables
- func AbctlConfigFromData(data map[string]string) (*abctl.Config, error)
- func GetAbctlConfig(ctx context.Context, client Client, namespace string) (*abctl.Config, error)
- func GetCurrentNamespace() (string, error)
- func Ingress(chartVersion string, hosts []string) *networkingv1.Ingress
- func IsAbctlInitialized(ctx context.Context, client Client, namespace string) error
- type Client
- type Cluster
- type DefaultK8sClient
- func (d *DefaultK8sClient) ConfigMapCreate(ctx context.Context, configMap *corev1.ConfigMap) error
- func (d *DefaultK8sClient) ConfigMapGet(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)
- func (d *DefaultK8sClient) ConfigMapList(ctx context.Context, namespace string) (*corev1.ConfigMapList, error)
- func (d *DefaultK8sClient) ConfigMapUpdate(ctx context.Context, configMap *corev1.ConfigMap) error
- func (d *DefaultK8sClient) DeploymentList(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)
- func (d *DefaultK8sClient) DeploymentRestart(ctx context.Context, namespace, name string) error
- func (d *DefaultK8sClient) EventsWatch(ctx context.Context, namespace string) (watch.Interface, error)
- func (d *DefaultK8sClient) IngressCreate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
- func (d *DefaultK8sClient) IngressExists(ctx context.Context, namespace string, ingress string) bool
- func (d *DefaultK8sClient) IngressUpdate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
- func (d *DefaultK8sClient) LogsGet(ctx context.Context, namespace string, name string) (string, error)
- func (d *DefaultK8sClient) NamespaceCreate(ctx context.Context, namespace string) error
- func (d *DefaultK8sClient) NamespaceDelete(ctx context.Context, namespace string) error
- func (d *DefaultK8sClient) NamespaceExists(ctx context.Context, namespace string) bool
- func (d *DefaultK8sClient) PersistentVolumeClaimCreate(ctx context.Context, namespace, name, volumeName string) error
- func (d *DefaultK8sClient) PersistentVolumeClaimDelete(ctx context.Context, namespace, name, _ string) error
- func (d *DefaultK8sClient) PersistentVolumeClaimExists(ctx context.Context, namespace, name, _ string) bool
- func (d *DefaultK8sClient) PersistentVolumeCreate(ctx context.Context, namespace, name string) error
- func (d *DefaultK8sClient) PersistentVolumeDelete(ctx context.Context, _, name string) error
- func (d *DefaultK8sClient) PersistentVolumeExists(ctx context.Context, _, name string) bool
- func (d *DefaultK8sClient) PodList(ctx context.Context, namespace string) (*corev1.PodList, error)
- func (d *DefaultK8sClient) SecretCreateOrUpdate(ctx context.Context, secret corev1.Secret) error
- func (d *DefaultK8sClient) SecretDeleteCollection(ctx context.Context, namespace, _type string) error
- func (d *DefaultK8sClient) SecretGet(ctx context.Context, namespace, name string) (*corev1.Secret, error)
- func (d *DefaultK8sClient) SecretPatch(ctx context.Context, namespace, name string, patchData []byte, ...) error
- func (d *DefaultK8sClient) ServerVersionGet() (string, error)
- func (d *DefaultK8sClient) ServiceGet(ctx context.Context, namespace string, name string) (*corev1.Service, error)
- func (d *DefaultK8sClient) StreamPodLogs(ctx context.Context, namespace string, podName string, since time.Time) (io.ReadCloser, error)
- type ExtraVolumeMount
- type KindCluster
- func (k *KindCluster) Create(ctx context.Context, port int, extraMounts []ExtraVolumeMount) error
- func (k *KindCluster) Delete(ctx context.Context) error
- func (k *KindCluster) Exists(ctx context.Context) bool
- func (k *KindCluster) LoadImages(ctx context.Context, dockerClient docker.Client, images []string)
- type Logger
- type Provider
Constants ¶
const ( Kind = "kind" Test = "test" )
Variables ¶
var ( // DefaultProvider represents the kind (https://kind.sigs.k8s.io/) provider. DefaultProvider = Provider{ Name: Kind, ClusterName: "airbyte-abctl", Context: common.AirbyteKubeContext, Kubeconfig: paths.Kubeconfig, } // TestProvider represents a test provider, for testing purposes TestProvider = Provider{ Name: Test, ClusterName: "test-airbyte-abctl", Context: "test-airbyte-abctl", Kubeconfig: filepath.Join(os.TempDir(), "abctl", paths.FileKubeconfig), } )
var DefaultPersistentVolumeSize = resource.MustParse("500Mi")
DefaultPersistentVolumeSize is the size of the disks created by the persistent-volumes and requested by the persistent-volume-claims.
Functions ¶
func AbctlConfigFromData ¶ added in v0.30.2
AbctlConfigFromData extracts abctl configuration from ConfigMap data
func GetAbctlConfig ¶ added in v0.30.2
GetAbctlConfig gets the abctl configuration from k8s
func GetCurrentNamespace ¶ added in v0.30.2
GetCurrentNamespace returns the namespace from the current kubeconfig context. If no namespace is set in the context, it returns "default".
Types ¶
type Client ¶
type Client interface {
// DeploymentList returns a list of all the services within the namespace
DeploymentList(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)
// DeploymentRestart will force a restart of the deployment name in the provided namespace.
// This is a blocking call, it should only return once the deployment has completed.
DeploymentRestart(ctx context.Context, namespace, name string) error
EventsWatch(ctx context.Context, namespace string) (watch.Interface, error)
IngressCreate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
IngressExists(ctx context.Context, namespace string, ingress string) bool
IngressUpdate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
LogsGet(ctx context.Context, namespace string, name string) (string, error)
NamespaceCreate(ctx context.Context, namespace string) error
NamespaceExists(ctx context.Context, namespace string) bool
NamespaceDelete(ctx context.Context, namespace string) error
PersistentVolumeCreate(ctx context.Context, namespace, name string) error
PersistentVolumeExists(ctx context.Context, namespace, name string) bool
PersistentVolumeDelete(ctx context.Context, namespace, name string) error
PersistentVolumeClaimCreate(ctx context.Context, namespace, name, volumeName string) error
PersistentVolumeClaimExists(ctx context.Context, namespace, name, volumeName string) bool
PersistentVolumeClaimDelete(ctx context.Context, namespace, name, volumeName string) error
PodList(ctx context.Context, namespace string) (*corev1.PodList, error)
SecretCreateOrUpdate(ctx context.Context, secret corev1.Secret) error
SecretPatch(ctx context.Context, namespace, name string, patchData []byte, patchType types.PatchType) error
// SecretDeleteCollection deletes multiple secrets.
// Note this takes a `type` and not a `name`. All secrets matching this type will be removed.
SecretDeleteCollection(ctx context.Context, namespace, _type string) error
SecretGet(ctx context.Context, namespace, name string) (*corev1.Secret, error)
// ConfigMapGet retrieves a ConfigMap by name
ConfigMapGet(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)
// ConfigMapList lists ConfigMaps in a namespace
ConfigMapList(ctx context.Context, namespace string) (*corev1.ConfigMapList, error)
// ConfigMapCreate creates a new ConfigMap
ConfigMapCreate(ctx context.Context, configMap *corev1.ConfigMap) error
// ConfigMapUpdate updates an existing ConfigMap
ConfigMapUpdate(ctx context.Context, configMap *corev1.ConfigMap) error
ServiceGet(ctx context.Context, namespace, name string) (*corev1.Service, error)
StreamPodLogs(ctx context.Context, namespace string, podName string, since time.Time) (io.ReadCloser, error)
// ServerVersionGet returns the kubernetes version.
ServerVersionGet() (string, error)
}
Client primarily for testing purposes
type Cluster ¶
type Cluster interface {
// Create a cluster with the provided name.
Create(ctx context.Context, portHTTP int, extraMounts []ExtraVolumeMount) error
// Delete a cluster with the provided name.
Delete(ctx context.Context) error
// Exists returns true if the cluster exists, false otherwise.
Exists(ctx context.Context) bool
LoadImages(ctx context.Context, dockerClient docker.Client, images []string)
}
Cluster is an interface representing all the actions taken at the cluster level.
type DefaultK8sClient ¶
type DefaultK8sClient struct {
ClientSet kubernetes.Interface
}
DefaultK8sClient converts the official kubernetes client to our more manageable (and testable) interface
func (*DefaultK8sClient) ConfigMapCreate ¶ added in v0.30.2
ConfigMapCreate creates a new ConfigMap
func (*DefaultK8sClient) ConfigMapGet ¶ added in v0.30.2
func (d *DefaultK8sClient) ConfigMapGet(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)
ConfigMapGet retrieves a ConfigMap by name
func (*DefaultK8sClient) ConfigMapList ¶ added in v0.30.2
func (d *DefaultK8sClient) ConfigMapList(ctx context.Context, namespace string) (*corev1.ConfigMapList, error)
func (*DefaultK8sClient) ConfigMapUpdate ¶ added in v0.30.2
ConfigMapUpdate updates an existing ConfigMap
func (*DefaultK8sClient) DeploymentList ¶
func (d *DefaultK8sClient) DeploymentList(ctx context.Context, namespace string) (*appsv1.DeploymentList, error)
func (*DefaultK8sClient) DeploymentRestart ¶
func (d *DefaultK8sClient) DeploymentRestart(ctx context.Context, namespace, name string) error
func (*DefaultK8sClient) EventsWatch ¶
func (*DefaultK8sClient) IngressCreate ¶
func (d *DefaultK8sClient) IngressCreate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
func (*DefaultK8sClient) IngressExists ¶
func (*DefaultK8sClient) IngressUpdate ¶
func (d *DefaultK8sClient) IngressUpdate(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
func (*DefaultK8sClient) NamespaceCreate ¶
func (d *DefaultK8sClient) NamespaceCreate(ctx context.Context, namespace string) error
func (*DefaultK8sClient) NamespaceDelete ¶
func (d *DefaultK8sClient) NamespaceDelete(ctx context.Context, namespace string) error
func (*DefaultK8sClient) NamespaceExists ¶
func (d *DefaultK8sClient) NamespaceExists(ctx context.Context, namespace string) bool
func (*DefaultK8sClient) PersistentVolumeClaimCreate ¶
func (d *DefaultK8sClient) PersistentVolumeClaimCreate(ctx context.Context, namespace, name, volumeName string) error
func (*DefaultK8sClient) PersistentVolumeClaimDelete ¶
func (d *DefaultK8sClient) PersistentVolumeClaimDelete(ctx context.Context, namespace, name, _ string) error
func (*DefaultK8sClient) PersistentVolumeClaimExists ¶
func (d *DefaultK8sClient) PersistentVolumeClaimExists(ctx context.Context, namespace, name, _ string) bool
func (*DefaultK8sClient) PersistentVolumeCreate ¶
func (d *DefaultK8sClient) PersistentVolumeCreate(ctx context.Context, namespace, name string) error
func (*DefaultK8sClient) PersistentVolumeDelete ¶
func (d *DefaultK8sClient) PersistentVolumeDelete(ctx context.Context, _, name string) error
func (*DefaultK8sClient) PersistentVolumeExists ¶
func (d *DefaultK8sClient) PersistentVolumeExists(ctx context.Context, _, name string) bool
func (*DefaultK8sClient) SecretCreateOrUpdate ¶
func (*DefaultK8sClient) SecretDeleteCollection ¶
func (d *DefaultK8sClient) SecretDeleteCollection(ctx context.Context, namespace, _type string) error
func (*DefaultK8sClient) SecretPatch ¶ added in v0.30.2
func (*DefaultK8sClient) ServerVersionGet ¶
func (d *DefaultK8sClient) ServerVersionGet() (string, error)
func (*DefaultK8sClient) ServiceGet ¶
func (*DefaultK8sClient) StreamPodLogs ¶
func (d *DefaultK8sClient) StreamPodLogs(ctx context.Context, namespace string, podName string, since time.Time) (io.ReadCloser, error)
type ExtraVolumeMount ¶
ExtraVolumeMount defines a host volume mount for the Kind cluster
func ParseVolumeMounts ¶ added in v0.29.0
func ParseVolumeMounts(specs []string) ([]ExtraVolumeMount, error)
ParseVolumeMounts parses a slice of volume mount specs in the format <HOST_PATH>:<GUEST_PATH> and returns a slice of ExtraVolumeMount. Returns an error if any spec is invalid.
type KindCluster ¶ added in v0.30.0
type KindCluster struct {
// contains filtered or unexported fields
}
KindCluster is a Cluster implementation for kind (https://kind.sigs.k8s.io/).
func (*KindCluster) Create ¶ added in v0.30.0
func (k *KindCluster) Create(ctx context.Context, port int, extraMounts []ExtraVolumeMount) error
func (*KindCluster) Delete ¶ added in v0.30.0
func (k *KindCluster) Delete(ctx context.Context) error
func (*KindCluster) Exists ¶ added in v0.30.0
func (k *KindCluster) Exists(ctx context.Context) bool
func (*KindCluster) LoadImages ¶ added in v0.30.0
LoadImages pulls images from Docker Hub, and loads them into the kind cluster. This is a best-effort optimization, which is why it doesn't return an error. It's possible that only some images will be loaded.
type Logger ¶
type Logger struct {
}
Logger is an implementation of the WarningHandler that converts the k8s warning messages into abctl debug messages.