manusa on master
fix #4142: additional patch met… refactor: clean up reported sme… (compare)
I try to add the extension for volcano, but I meet the issue: panic: Not able to set api version for volcano.sh/apis/pkg/apis/scheduling/v1beta1/Queue Complete code and log are in [1].
Could you give some idea on it?
KubernetesServer
in unit tests. Are there any known issues regarding this (I couldn't find any but maybe I have missed something)? Otherwise I would try to raise an issue on GitHub including a small reproduction example.
Code:
final CustomResourceDefinitionContext sprkCrdContext = new CustomResourceDefinitionContext.Builder()
.withName("sparkoperator.k8s.io")
.withGroup("sparkoperator.k8s.io")
.withScope("Namespaced")
.withVersion("v1beta2")
.withPlural("sparkapp")
.build();
log.error("config location {}", System.getProperty("kubeconfig"));
try (
KubernetesClient k8s = new DefaultKubernetesClient()) {
k8s.customResource(sprkCrdContext);
k8s.load(getClass().getResourceAsStream(name))
.inNamespace("default")
.createOrReplace();
try (KubernetesClient client = new DefaultKubernetesClient()) {
CustomResourceDefinitionContext context = new CustomResourceDefinitionContext.Builder()
.withGroup("sparkoperator.k8s.io")
.withScope("Namespaced")
.withVersion("v1beta2")
.withPlural("sparkapp")
.build();
GenericKubernetesResource cr = client.genericKubernetesResources(context)
.load(GenericKubernetesResourceExample.class.getResourceAsStream("/sparkapplication-cr.yml"))
.get();
client.genericKubernetesResources(context)
.inNamespace("default")
.create(cr);
}
Hi, one question. When we create a Customer Resource Definition we have one part with:
schema:
openAPIV3Schema:
type: object
properties:
# Fields to validate are the following:
metadata: # 'metadata' should be an object
type: object
properties: # With the following field 'name'
name:
type: string # Of type 'string'
pattern: '^[a-z]+\.[a-z]+$' # allows only 'word.word' names
spec: # Root field 'spec'
When we create a resource from this CRD and we apply it with kubctl
it validates the pattern properly, getting an error in the terminal if we don't match the pattern.
The point now is, can we do something similar with the kubernetes crud server? Looks like is not validating it when we create it programatically. Any idea how to do it? Thanks!
Thanks for replying, maybe I'm understanding it wrong (which is very likely).
Maybe a bit more detail.
So, when querying:
final Endpoints endpoints = k8sClient.endpoints()
.withName(name).get();
which works fine, however, when I want to register an informable to that, i.e.,
k8sClient
.endpoints()
.withName(serviceId.getValue())
.inform(endpointsHandler, resyncTimeInMillis);
I get an exception:
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: endpoints "value" is forbidden: User "system:serviceaccount:default:default" cannot watch resource "endpoints" in API group "" in the namespace "default"
And that is not the configured service account (so my guess was that this is service account related, and it needs to be configured somehow) (yes this is done in a cluster)