rrajesh-cloudera commented on code in PR #915:
URL: https://github.com/apache/yunikorn-k8shim/pull/915#discussion_r1804176086
##########
test/e2e/framework/helpers/k8s/k8s_utils.go:
##########
@@ -1779,3 +1822,96 @@ func (k *KubeCtl) DeleteStorageClass(scName string)
error {
}
return nil
}
+
+func (k *KubeCtl) GetSecrets(namespace string) (*v1.SecretList, error) {
+ return k.clientSet.CoreV1().Secrets(namespace).List(context.TODO(),
metav1.ListOptions{})
+}
+
+func (k *KubeCtl) GetSecretValue(namespace, secretName, key string) (string,
error) {
+ var secret *v1.Secret
+ var err error
+
+ // Retry loop in case secret is not yet populated
+ for i := 0; i < 5; i++ {
+ secret, err =
k.clientSet.CoreV1().Secrets(namespace).Get(context.TODO(), secretName,
metav1.GetOptions{})
+ if err != nil {
+ return "", err
+ }
+
+ // Check if the secret contains data
+ if len(secret.Data) > 0 {
+ value, ok := secret.Data[key]
+ if !ok {
+ return "", fmt.Errorf("key %s not found in
secret %s", key, secretName)
+ }
+ return string(value), nil
+ }
+
+ // Wait before retrying
+ time.Sleep(2 * time.Second)
Review Comment:
Updated the code with requested changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]