Wait for kube api during init (#440)

* kubernetes: wait for KubeAPI to be reachable
This commit is contained in:
3u13r 2022-11-04 12:36:26 +01:00 committed by GitHub
parent b89fae8062
commit 9ad377284d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 190 additions and 10 deletions

View file

@ -30,6 +30,7 @@ type Client interface {
AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error
// WaitForCRD waits for the given CRD to be established.
WaitForCRD(ctx context.Context, crd string) error
ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error)
}
// clientGenerator can generate new clients from a kubeconfig.
@ -86,12 +87,17 @@ func (k *Kubectl) CreateConfigMap(ctx context.Context, configMap corev1.ConfigMa
return err
}
err = client.CreateConfigMap(ctx, configMap)
return client.CreateConfigMap(ctx, configMap)
}
// ListAllNamespaces returns all namespaces in the cluster.
func (k *Kubectl) ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error) {
client, err := k.clientGenerator.NewClient(k.kubeconfig)
if err != nil {
return err
return nil, err
}
return nil
return client.ListAllNamespaces(ctx)
}
func (k *Kubectl) AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error {