Documentation ¶
Index ¶
- Constants
- Variables
- type Cluster
- type DefaultK8sClient
- func (d *DefaultK8sClient) CreateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
- func (d *DefaultK8sClient) CreateOrUpdateSecret(ctx context.Context, namespace, name string, data map[string][]byte) error
- func (d *DefaultK8sClient) DeleteNamespace(ctx context.Context, namespace string) error
- func (d *DefaultK8sClient) ExistsIngress(ctx context.Context, namespace string, ingress string) bool
- func (d *DefaultK8sClient) ExistsNamespace(ctx context.Context, namespace string) bool
- func (d *DefaultK8sClient) GetServerVersion() (string, error)
- func (d *DefaultK8sClient) GetService(ctx context.Context, namespace string, name string) (*coreV1.Service, error)
- func (d *DefaultK8sClient) UpdateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
- type DockerDesktopCluster
- type K8sClient
- type KindCluster
- type Provider
Constants ¶
View Source
const ( DockerDesktop = "docker-desktop" Kind = "kind" Test = "test" )
TODO: add supported map
Variables ¶
View Source
var ( // DockerDesktopProvider represents the docker-desktop provider. DockerDesktopProvider = Provider{ Name: DockerDesktop, ClusterName: "docker-desktop", Context: "docker-desktop", Kubeconfig: filepath.Join(".kube", "config"), HelmNginx: []string{ "controller.service.httpsPort.enable=false", }, } // KindProvider represents the kind (https://kind.sigs.k8s.io/) provider. KindProvider = Provider{ Name: Kind, ClusterName: "airbyte-abctl", Context: "kind-airbyte-abctl", Kubeconfig: filepath.Join(".airbyte", "abctl", "abctl.kubeconfig"), HelmNginx: []string{ "controller.hostPort.enabled=true", "controller.service.httpsPort.enable=false", "controller.service.type=NodePort", }, } // TestProvider represents a test provider, for testing purposes TestProvider = Provider{ Name: Test, ClusterName: "test", Context: "test-abctl", Kubeconfig: filepath.Join(os.TempDir(), "abctl.kubeconfig"), HelmNginx: []string{}, } )
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface { // Create a cluster with the provided name. Create(portHTTP int) error // Delete a cluster with the provided name. Delete() error // Exists returns true if the cluster exists, false otherwise. Exists() bool }
Cluster is an interface representing all the actions taken at the cluster level.
func NewCluster ¶
NewCluster returns a Cluster implementation for the provider.
type DefaultK8sClient ¶
type DefaultK8sClient struct {
ClientSet *kubernetes.Clientset
}
DefaultK8sClient converts the official kubernetes client to our more manageable (and testable) interface
func (*DefaultK8sClient) CreateIngress ¶
func (d *DefaultK8sClient) CreateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
func (*DefaultK8sClient) CreateOrUpdateSecret ¶
func (*DefaultK8sClient) DeleteNamespace ¶
func (d *DefaultK8sClient) DeleteNamespace(ctx context.Context, namespace string) error
func (*DefaultK8sClient) ExistsIngress ¶
func (*DefaultK8sClient) ExistsNamespace ¶
func (d *DefaultK8sClient) ExistsNamespace(ctx context.Context, namespace string) bool
func (*DefaultK8sClient) GetServerVersion ¶
func (d *DefaultK8sClient) GetServerVersion() (string, error)
func (*DefaultK8sClient) GetService ¶
func (*DefaultK8sClient) UpdateIngress ¶
func (d *DefaultK8sClient) UpdateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error
type DockerDesktopCluster ¶
type DockerDesktopCluster struct {
// contains filtered or unexported fields
}
DockerDesktopCluster is a Cluster that represents a docker-desktop cluster
func (DockerDesktopCluster) Create ¶
func (d DockerDesktopCluster) Create(_ int) error
func (DockerDesktopCluster) Delete ¶
func (d DockerDesktopCluster) Delete() error
func (DockerDesktopCluster) Exists ¶
func (d DockerDesktopCluster) Exists() bool
type K8sClient ¶
type K8sClient interface { // CreateIngress creates an ingress in the given namespace CreateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error // ExistsIngress returns true if the ingress exists in the namespace, false otherwise. ExistsIngress(ctx context.Context, namespace string, ingress string) bool // UpdateIngress updates an existing ingress in the given namespace UpdateIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error // ExistsNamespace returns true if the namespace exists, false otherwise ExistsNamespace(ctx context.Context, namespace string) bool // DeleteNamespace deletes the existing namespace DeleteNamespace(ctx context.Context, namespace string) error // CreateOrUpdateSecret will update or create the secret name with the payload of data in the specified namespace CreateOrUpdateSecret(ctx context.Context, namespace, name string, data map[string][]byte) error // GetService returns a the service for the given namespace and name GetService(ctx context.Context, namespace, name string) (*coreV1.Service, error) // GetServerVersion returns the k8s version. GetServerVersion() (string, error) }
K8sClient primarily for testing purposes
type KindCluster ¶
type KindCluster struct {
// contains filtered or unexported fields
}
KindCluster is a Cluster implementation for kind (https://kind.sigs.k8s.io/).
func (*KindCluster) Create ¶
func (k *KindCluster) Create(port int) error
func (*KindCluster) Delete ¶
func (k *KindCluster) Delete() error
func (*KindCluster) Exists ¶
func (k *KindCluster) Exists() bool
type Provider ¶
type Provider struct { // Name of this provider Name string // ClusterName is the name of the cluster this provider will interact with ClusterName string // Context this provider should use Context string // Kubeconfig location Kubeconfig string // HelmNginx additional helm values to pass to the nginx chart HelmNginx []string }
Provider represents a k8s provider.
func ProviderFromString ¶
ProviderFromString returns a provider from the given string s. If no provider is found, an error is returned.
Click to show internal directories.
Click to hide internal directories.