Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:26

    manusa on master

    chore(deps): bump jetty.version… (compare)

  • 05:26

    manusa on maven

    (compare)

  • 05:26
    manusa closed #4227
  • 05:26
    manusa milestoned #4227
  • 05:11

    manusa on maven

    (compare)

  • 05:11

    manusa on master

    chore(deps): bump spotless-mave… (compare)

  • 05:11
    manusa closed #4245
  • 05:11
    manusa milestoned #4245
  • 05:07

    manusa on maven

    (compare)

  • 05:07

    manusa on master

    chore(deps-dev): bump approvalt… (compare)

  • 05:07
    manusa closed #4244
  • 05:07
    manusa milestoned #4244
  • 05:00
    manusa commented #4218
  • Jul 03 23:33
    shawkins commented #4239
  • Jul 03 16:28
    stale[bot] labeled #4004
  • Jul 03 16:28
    stale[bot] labeled #3985
  • Jul 03 16:28
    stale[bot] labeled #3974
  • Jul 03 16:28
    stale[bot] commented #4004
  • Jul 03 16:28
    stale[bot] commented #3985
  • Jul 03 16:28
    stale[bot] commented #3974
Rohan Kumar
@rohanKanojia
Sorry, I was on PTO yesterday. client.customResource DSL method involving HashMaps has been marked as deprecated. I think you should replace your code with something like this:
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);
}
David Calap
@dcalap

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!

Rohan Kumar
@rohanKanojia
I don't think KubernetesMockServer supports any kind of validation
David Calap
@dcalap
@rohanKanojia ok, thanks for the info
Marc Nuri
@manusa
The Crud Server supports only very basic functionality. This seems like something that could be implemented because it's not dependent on external controllers and might be part of the API server. However, it's something pretty advanced, but contributions are welcome ;)
nautiam
@nautiam
I want to watch and forward all the log of Pod whenever a log is printed out. Is there anyway to do it? Thanks.
nautiam
@nautiam
@rohanKanojia thanks, it works. Is there anyway to use regex with Pod name? Because Pod name is generated randomly and I don't know how to get it exactly.
Rohan Kumar
@rohanKanojia
Umm, you can try using labels. I'm not sure if we have support of querying with regex
Yikun Jiang
@Yikun

Is it possible to reuse the kubernetes client in extension client?

such as for volcano extension:

volcanoClient = new DefaultVolcanoClient(kubernetesClient)

then we can reuse the kubernetesClient configuration and httpClient.

@rohanKanojia @manusa
Rohan Kumar
@rohanKanojia
there should be an adapt method available in KubernetesClient interface
example for knative extension here: https://github.com/fabric8io/kubernetes-client/blob/master/doc/CHEATSHEET.md#initializing-knative-client . Maybe this should be already available in Volcano extension you implemented
Yikun Jiang
@Yikun
@rohanKanojia Thanks, I will do some try to use it.
markusriedl
@markusriedl
Hi, is it possible create an informer, that doesn't use the default serviceaccount?
Rohan Kumar
@rohanKanojia
Umm, I don't understand your question. What does creating informer has to do with serviceaccount? It depends on the ServiceAccount used by the pod from where informer gets created (If you're doing this in cluster)
markusriedl
@markusriedl

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)

Rohan Kumar
@rohanKanojia
seems like your Role configured with ServiceAccount doesn't have watch verb in it
Could you please check Role associated with default ServiceAccount?
markusriedl
@markusriedl
Indeed, doesn't have the watch verb in it
THX! (still a noob to all this)
Rohan Kumar
@rohanKanojia
we're all noobs :-)
nautiam
@nautiam
Hi @rohanKanojia ,
Is this possible to renew the token? I can't use the OAuth Token after a long time.
Rohan Kumar
@rohanKanojia
Sorry I don't understand your question
Could you please elaborate?
Marc Nuri
@manusa
Starting release process for Kubernetes Client 5.11.0
Marc Nuri
@manusa
Sonataype Nexus not working great today...
Rohan Kumar
@rohanKanojia
:-(
Marc Nuri
@manusa
I'll retry in 12 hours.
Rohan Kumar
@rohanKanojia
okay
Marc Nuri
@manusa
Attempt #2
igor-barsukov
@igor-barsukov

Hello!
Could you please advise what is equivalent for command kubectl rollout status deployment/<depl-name> in Kubernates client?

I'm bit confused. When I'm trying to fetch deployment status with:

kubernetesClient.apps().deployments().inNamespace(project)
            .withName(name).get().getStatus().getConditions()

Getting such 2 conditions:

    DeploymentCondition(
        lastTransitionTime=2021-12-08T09:31:42Z, 
        lastUpdateTime=2021-12-08T16:12:17Z, 
        message=ReplicaSet "test-service-cdf767b67" has successfully progressed., 
        reason=NewReplicaSetAvailable, 
        status=True, 
        type=Progressing, 
        additionalProperties={}), 
    DeploymentCondition(
        lastTransitionTime=2021-12-17T10:29:15Z, 
        lastUpdateTime=2021-12-17T10:29:15Z, 
        message=Deployment has minimum availability., 
        reason=MinimumReplicasAvailable, 
        status=True, 
        type=Available, 
        additionalProperties={})

Meanwhile for kubectl command:

>> kubectl rollout status deployment/test-service
deployment "test-service" successfully rolled out
Rohan Kumar
@rohanKanojia
I think you're checking the right object
kubectl also detects status based on latest condition
igor-barsukov
@igor-barsukov
@rohanKanojia thanks for answer.
But I'm wondering how could I get this deployment "test-service" successfully rolled out status via Kubernates client? Or there is no way to do that?
If no, than could I consider status ReplicaSet "test-service-cdf767b67" has successfully progressed as indicator of successful deployment?
Rohan Kumar
@rohanKanojia
I think we do have some utility class for checking whether deployment is ready or not
igor-barsukov
@igor-barsukov
Could you point out that class?
Rohan Kumar
@rohanKanojia
There should be an isReady() DSL method available for Deployment. Under the hood it calls Readiness.isReady https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/readiness/Readiness.java#L77
igor-barsukov
@igor-barsukov
Thank you, will check it
Rohan Kumar
@rohanKanojia
In order to check whether a Deployment is successful, this should work:
boolean isAvailable = client.apps().deployments().inNamespace("default").withName("name").isReady();
A V Sai Charan
@charcharan

Hi, I have created a pod using fabric8io kubernetes client. It was successful, Now I am trying to push a file to pod (uploading to pod). I have followed the way mentioned here,

https://itnext.io/copy-files-to-from-pods-in-java-using-fabric8-kubernetes-client-485e73335cb6

But i am facing error as,

java.lang.IllegalArgumentException: Provided arguments are not valid (file, directory, path)
at io.fabric8.kubernetes.client.dsl.internal.uploadable.PodUpload.upload(PodUpload.java:69) ~[kubernetes-client-5.11.0.jar:na]

I have verified the file directory and path.
Can anyone please help me how can I resolve this issue ?

Rohan Kumar
@rohanKanojia
Do you have your code which we can try reproducing on our machine?
33 replies
Marc Nuri
@manusa
Starting release process for Kubernetes Client 5.11.1
A V Sai Charan
@charcharan
Hi I am trying to upload the file to pod, But I am getting this error continuously. I have sleep timeout for 1 Minute after creating the pod and I have checked the pod status before uploading the pod. But still I am getting the error,
PodUploadWebSocketListener failed with - null
2 replies