Skip to content

How can I change the name of namespaces created by LocallyRunOperatorExtension? #2163

Closed
@machenity

Description

@machenity

Hi. I wrote some tests using LocallyRunOperatorExtension, but I encountered the following error:

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: 
https://xxxxxx.com/api/v1/namespaces. Message: namespaces "xxxxxxxxxoperatorsecuritye2e-xxxxxxxxxxxxxxxxxxxx" 
already exists. Received status: Status(apiVersion=v1, code=409, details=StatusDetails(causes=[], group=null, kind=namespaces, 
name=xxxxxxxxxoperatorsecuritye2e-xxxxxxxxxxxxxxxxxxxx, retryAfterSeconds=null, uid=null, additionalProperties={}), 
kind=Status, message=namespaces "xxxxxxxxxoperatorsecuritye2e-xxxxxxxxxxxxxxxxxxxx" already exists, 
metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), 
reason=AlreadyExists, status=Failure, additionalProperties={}).

(I have obscured some data that reveals personal information).

I suspected it was because the class name + test method name I use as the namespace name was longer than 63 characters, and the UUID part that ensures uniqueness, was truncated, causing two tests running in parallel to create a namespace with the same name.

Looking at the java-operator-sdk code, it appears that there is no configuration to provide a custom namespace name, or at least modify the prefix.

Maybe I missed that configuration?

Besides, if there really is no such configuration, I'd like to add such a feature to the JOSDK, if you don't mind.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions