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

Leaking connection and API POST apps.openshift.io/v1 bug #2522

Closed
nbn opened this issue Oct 1, 2020 · 5 comments
Closed

Leaking connection and API POST apps.openshift.io/v1 bug #2522

nbn opened this issue Oct 1, 2020 · 5 comments

Comments

@nbn
Copy link

nbn commented Oct 1, 2020

Hi,

Was using version 4.10.2 without any problems, but failed some consequences migrating to 4.11.1. My usual context is openshift, so I utilize deploymentconfigs and routes quite often, but needed the monitoring stuff included with 4.11

Here's my example code snippet, which creates a deploymentconfig, then retrives it and updates it.

public static void main(String[] args) {
    String namespace = args[0];
    System.out.println ("Hello namespace (" + namespace + ")");
    DefaultOpenShiftClient client = new DefaultOpenShiftClient();
    try {
        createDefaultDeploymentConfigAsInTheExamples(namespace, client);

        DeploymentConfig nginx = client.deploymentConfigs().inNamespace(namespace).withName("nginx").get();
        System.out.println(" I found " + nginx.getMetadata().getName());

        DeploymentConfig replace = client.deploymentConfigs().inNamespace(namespace).createOrReplace(nginx);
        System.out.println("Updated " + replace.getMetadata().getName());
    } finally {
        client.close();
    }
}

Running with 4.10.2, this is not a problem. With 4.11.0 and onward I get the exception below and the console hangs indefinitely..
Does anyone know if I should do things differently (with respect to the leaking and the server config) after migrating, or is this an error.

I run with these versions of openshift.

$ oc version
oc v3.10.0+dd10d17
kubernetes v1.10.0+b81c8f8
features: Basic-Auth

Server https://my-secret-cluster.com
openshift v3.11.170
kubernetes v1.11.0+d4cacc0


 io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://my-secret-cluster.com/apis/apps.openshift.io/v1/namespaces/secret-namespace/deploymentconfigs. Message: the API version in the data (apps.openshift.io/v1) does not match the expected API version (v1). Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=the API version in the data (apps.openshift.io/v1) does not match the expected API version (v1), metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:589)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:528)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:492)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:451)
    at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:252)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:867)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:356)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:421)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:83)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:415)
    at io.fabric8.kubernetes.client.dsl.base.BaseOperation.lambda$createOrReplaceWithNew$1(BaseOperation.java:387)
    at io.fabric8.openshift.api.model.DoneableDeploymentConfig.done(DoneableDeploymentConfig.java:27)
@rohanKanojia
Copy link
Member

rohanKanojia commented Oct 1, 2020

Umm, Would it be possible for you to check if this issue is reproducible on master? I think we have provided a fix for this in #2475 . I think we now have a test to check scenario you described:

@Test
public void createOrReplace() {
// Given
DeploymentConfig deploymentConfig = client.deploymentConfigs().inNamespace(session.getNamespace()).withName("dc-createorreplace").get();
// When
deploymentConfig.getSpec().getTemplate().getSpec().getContainers().get(0).setImage("openshift/hello-openshift:v3.8");
deploymentConfig = client.deploymentConfigs().inNamespace(session.getNamespace()).createOrReplace(deploymentConfig);
// Then
assertNotNull(deploymentConfig);

@nbn
Copy link
Author

nbn commented Oct 1, 2020

I have tried to check out and build master, but cannot get past the kubernetes-client project before it has a compilation failure of

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project kubernetes-client: Compilation failure: Compilation failure:
[ERROR] /C:/kubernetes-client/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/HandlersTest.java:[18,53] package io.fabric8.kubernetes.client.handlers.apps.v1 does not exist
[ERROR] /C:/kubernetes-client/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/ResourceHandlerTest.java:[25,53] package io.fabric8.kubernetes.client.handlers.core.v1 does not exist
[ERROR] -> [Help 1]

I can see the folder gets created, but it is empty. Is this some of the velocity template generators that fails?

Do you publish snapshots anywhere (bintray or something), so I won't need to compile?

@rohanKanojia
Copy link
Member

Could you please try https://jitpack.io/

@nbn
Copy link
Author

nbn commented Oct 1, 2020

Interesting tool, thanks.

Got it, and it seems to work on master. When is next release scheduled?

@nbn
Copy link
Author

nbn commented Oct 5, 2020

Have verified with 4.12.0 that everything works again, thanks.

@nbn nbn closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants