mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 21:08:00 +00:00
33 lines
586 B
Go
33 lines
586 B
Go
|
package client
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/caos/orbos/pkg/labels"
|
||
|
|
||
|
"github.com/caos/orbos/pkg/kubernetes"
|
||
|
)
|
||
|
|
||
|
func QueryCertificates(
|
||
|
namespace string,
|
||
|
selector *labels.Selector,
|
||
|
k8sClient kubernetes.ClientInt,
|
||
|
) (
|
||
|
[]string,
|
||
|
error,
|
||
|
) {
|
||
|
|
||
|
list, err := k8sClient.ListSecrets(namespace, labels.MustK8sMap(selector))
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
certs := []string{}
|
||
|
for _, secret := range list.Items {
|
||
|
if strings.HasPrefix(secret.Name, clientSecretPrefix) {
|
||
|
certs = append(certs, strings.TrimPrefix(secret.Name, clientSecretPrefix))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return certs, nil
|
||
|
}
|