mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 05:49:40 +02:00
chore(filenames): fix filenames EE-5717 (#9171)
This commit is contained in:
parent
60ae6a63fc
commit
bf51f1b6c9
4 changed files with 0 additions and 0 deletions
22
api/kubernetes/cli/deployment.go
Normal file
22
api/kubernetes/cli/deployment.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
)
|
||||
|
||||
// HasStackName checks whether the given name is used in the given namespace.
|
||||
func (kcl *KubeClient) HasStackName(namespace string, stackName string) (bool, error) {
|
||||
querySet := labels.Set{"io.portainer.kubernetes.application.stack": stackName}
|
||||
listOpts := metav1.ListOptions{LabelSelector: labels.SelectorFromSet(querySet).String()}
|
||||
list, err := kcl.cli.AppsV1().Deployments(namespace).List(context.TODO(), listOpts)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if len(list.Items) > 0 {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue