- Notifications
You must be signed in to change notification settings - Fork 320
Issue 1296 fix cf labels not working#1306
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
xiaocongli commented Oct 6, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
linux-foundation-easyclabot commented Oct 6, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
JNKielmann commented Oct 7, 2025
This is the relevant issue describing the problem this PR tries to fix: #1296 |
theghost5800 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @Kehrlann Could you please take a look at this PR and run integration tests with this change, thanks!
Kehrlann commented Oct 7, 2025
Got it. I'm away this week. Will pick this up on Monday. |
integration-test/src/test/java/org/cloudfoundry/operations/ApplicationsTest.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
...perations/src/main/java/org/cloudfoundry/operations/applications/_ManifestV3Application.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Kehrlann commented Oct 10, 2025
@xiaocongli Please update the verification for the test, for example something like: this.cloudFoundryOperations .applications() .pushManifestV3(PushManifestV3Request.builder().manifest(manifest).build()) .then( this.cloudFoundryOperations .applications() .get(GetApplicationRequest.builder().name(applicationName).build()) ) .map(ApplicationDetail::getId) .flatMap(id -> this.client .applicationsV3() .get( org.cloudfoundry.client.v3.applications.GetApplicationRequest.builder() .applicationId(id) .build() ) ) .as(StepVerifier::create) .expectNextMatches(createdApp -> labels.equals(createdApp.getMetadata().getLabels()) && annotations.equals(createdApp.getMetadata().getAnnotations())) .expectComplete() .verify(Duration.ofMinutes(5));Feel free to write your own verification. |
...perations/src/main/java/org/cloudfoundry/operations/applications/_ManifestV3Application.javaShow resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
xiaocongli commented Oct 11, 2025
Hi @Kehrlann, Here is my understanding:
My points:
If V3 metadata have to be verified in operations layer, I guess the only way is to introduce a cross-layer read-back by injecting CloudFoundryClient into the operations test and calling I've also done a local test with help from @JNKielmann via a small app ManifestV3manifest = ApplicationManifestUtilsV3.read(input)Input yaml: --- applications: - name: demo-appmemory: 256Minstances: 1buildpacks: - java_buildpackenv: JAVA_OPTS: "-Xss512k"metadata: labels: owner: team-afeature: manifest-labelsexample.com/component: webapp.kubernetes.io/name: demo-appannotations: description: "Sample app to reproduce manifest metadata behavior"Depending on latest 5.14.0.RELEASE, i got manifest as below: --- applications: - buildpacks: - java_buildpackenv: JAVA_OPTS: -Xss512kinstances: 1memory: 256Mname: demo-appversion: 1With my local generated 4 cloudfoundry-xxx-5.15.0.BUILD-SNAPSHOT.jar, the output manifest was below(the different order of annotations and labels should not be a problem): --- applications: - buildpacks: - java_buildpackenv: JAVA_OPTS: -Xss512kinstances: 1memory: 256Mmetadata: annotations: description: Sample app to reproduce manifest metadata behaviorlabels: owner: team-afeature: manifest-labelsapp.kubernetes.io/name: demo-appexample.com/component: webname: demo-appversion: 1Please correct me if anything is wrong. :) |
xiaocongli commented Oct 11, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Like some of the other tests, what I am not sure is the version number in |
Kehrlann commented Oct 13, 2025
Hey @xiaocongli ! Thanks for the detailed answer.
Ideally, that would be true, and we would only be testing black-box style. That's what we would strive for if we started from scratch and had more bandwidth to work on this. But that's not the case, and not all APIs are implemented using the Operations abstraction. Currently, it's inconvenient to test the full behavior at that layer. So either we implement what we need to test it (probably too much work), or we accept that there is some mixing of concerns in our integration tests. You'll notice that the client is already injected in operations tests multiple times:
Given the shape of the project, "mixing layers" is a tradeoff I'll make gladly.
Yes, some metadata tests exist in
Ah, that's a remnant from older times from this project. I don't think it's super relevant anymore. The name mentions That's not great, now that this project is maintained beyond just Pivotal/... we should probably rename these PCF numbers to And, ideally, for v3 tests we'd have an annotation that checks for a specific v3 API, version but that's not implemented. Currently we use the v2 |
…anefest metadata after pushing
xiaocongli commented Oct 13, 2025
Hi @Kehrlann, I added the integration test code accordingly :) |
Kehrlann commented Oct 13, 2025
Thank you for your contribution, and your patience! |
6667c56 into cloudfoundry:mainUh oh!
There was an error while loading. Please reload this page.
According to the Cloud Foundry documentation on manifest metadata,
labelsandannotationsmust be nested under themetadatasection. In the current cf-java-client, they are placed directly under the application node, which is incorrect. As a result, attribute values are lost when using CF labels to identify extra component attributes.