Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serviceaccount_delay to namespace context #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion xrally_kubernetes/tasks/contexts/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# under the License.

from rally.task import context
from rally.common import utils as commonutils

from xrally_kubernetes.tasks import context as common_context

Expand All @@ -34,6 +35,10 @@ class NamespaceContext(common_context.BaseKubernetesContext):
},
"namespace_choice_method": {
"enum": ["random", "round_robin"]
},
"serviceaccount_delay": {
"type": "integer",
"minimum": 0
}
}
}
Expand All @@ -43,7 +48,8 @@ class NamespaceContext(common_context.BaseKubernetesContext):
def setup(self):
self.context["kubernetes"].update({
"namespace_choice_method": self.config["namespace_choice_method"],
"serviceaccounts": self.config.get("with_serviceaccount") or False
"serviceaccounts": self.config.get("with_serviceaccount") or False,
"serviceaccount_delay": self.config.get("serviceaccount_delay") or 0
})

self.context["kubernetes"].setdefault("namespaces", [])
Expand All @@ -53,6 +59,9 @@ def setup(self):
if self.config.get("with_serviceaccount"):
self.client.create_serviceaccount(name, namespace=name)
self.client.create_secret(name, namespace=name)
commonutils.interruptable_sleep(
self.context["kubernetes"]["serviceaccount_delay"]
)

def cleanup(self):
for name in self.context["kubernetes"].get("namespaces"):
Expand Down