Kubernetes-client: Use enum for getScope values

Created on 20 Nov 2020  路  8Comments  路  Source: fabric8io/kubernetes-client

componenkubernetes-model enhancement

Most helpful comment

I understand that having a set of scopes defined as an enum is preferred, there's no opposition in that.

What I don't know from the description of this issue is where are we going to change this.
From the recent work of Chris, I understand that we are talking about CustomResourceDefinitions. Are we?

But which classes are you intending to change, because the CustomResourceDefinition model is generated. So if you want to do this, a custom serializer + deserializer must be provided, and the generator tuned so that the field is declared as an enum instead of a plain String.

Then there's also the CustomResourceDefinitionContext which also provides this scope field and maybe is the one you are referring to since it's used in:
https://github.com/fabric8io/kubernetes-client/blob/742207112e29c5f457bb918f750bec8002ff1822/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/CustomResourceOperationsImpl.java#L64-L66

All 8 comments

I can do this. Can you please assign to me?

Thanks, I've assigned this to you. However, I feel issue needs some clarity. I'm not really sure what this issue is about.

Please @Priya103, at least state what you're intending to change so that @metacosm can validate.

Currently getScope is compared with string "Namespaced" in kubernetes-client however it is good to have this static string as enum.

Umm, Could you please share a link to the code where this getScope() is? I see a getScope() in CustomResourceDefinitionSpec but it's a part of model(which is generated)

I understand that having a set of scopes defined as an enum is preferred, there's no opposition in that.

What I don't know from the description of this issue is where are we going to change this.
From the recent work of Chris, I understand that we are talking about CustomResourceDefinitions. Are we?

But which classes are you intending to change, because the CustomResourceDefinition model is generated. So if you want to do this, a custom serializer + deserializer must be provided, and the generator tuned so that the field is declared as an enum instead of a plain String.

Then there's also the CustomResourceDefinitionContext which also provides this scope field and maybe is the one you are referring to since it's used in:
https://github.com/fabric8io/kubernetes-client/blob/742207112e29c5f457bb918f750bec8002ff1822/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/CustomResourceOperationsImpl.java#L64-L66

I am talking about kubernetes-client/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/CustomResourceOperationsImpl.java and RawCustomResourceOperationsImpl

Yep, sorry this issue is suffering from tunnel vision where I expect everyone to immediately understand what the heck I'm talking about with only a couple of keywords! 馃槵
Sorry about that. Indeed, custom de-/serializer will be needed to make it cleaner, imo.

Was this page helpful?
0 / 5 - 0 ratings