mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-21 20:54:24 -04:00
add namespace to kubectl requests (#315)
* add namespace to kubectl requests * Add tests for missing/wrong namespace Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
c37fab0a4c
commit
e0ce2e8a51
6 changed files with 43 additions and 27 deletions
|
@ -20,8 +20,8 @@ type Client interface {
|
|||
// GetObjects converts resources into prepared info fields for use in ApplyOneObject.
|
||||
GetObjects(resources resources.Marshaler) ([]*resource.Info, error)
|
||||
CreateConfigMap(ctx context.Context, configMap corev1.ConfigMap) error
|
||||
AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string) error
|
||||
AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string) error
|
||||
AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error
|
||||
AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error
|
||||
}
|
||||
|
||||
// clientGenerator can generate new clients from a kubeconfig.
|
||||
|
@ -86,26 +86,26 @@ func (k *Kubectl) CreateConfigMap(ctx context.Context, configMap corev1.ConfigMa
|
|||
return nil
|
||||
}
|
||||
|
||||
func (k *Kubectl) AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string) error {
|
||||
func (k *Kubectl) AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error {
|
||||
client, err := k.clientGenerator.NewClient(k.kubeconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = client.AddTolerationsToDeployment(ctx, tolerations, name); err != nil {
|
||||
if err = client.AddTolerationsToDeployment(ctx, tolerations, name, namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k *Kubectl) AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string) error {
|
||||
func (k *Kubectl) AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error {
|
||||
client, err := k.clientGenerator.NewClient(k.kubeconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = client.AddNodeSelectorsToDeployment(ctx, selectors, name); err != nil {
|
||||
if err = client.AddNodeSelectorsToDeployment(ctx, selectors, name, namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue