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

vRA Custom Resource push problem #552

Open
oporanski opened this issue Dec 2, 2024 Discussed in #550 · 4 comments · May be fixed by #555
Open

vRA Custom Resource push problem #552

oporanski opened this issue Dec 2, 2024 Discussed in #550 · 4 comments · May be fixed by #555
Assignees
Labels
area/artifact-manager Relates to the `artifact-manager` maven module effort/low kind/bug Something isn't working lang/java Related to Java Code priority/medium triage/not-a-bug The bugfix that was submitted, is not an actual bug, or is expected behavior

Comments

@oporanski
Copy link

Discussed in #550

Originally posted by oporanski December 2, 2024
Question

I'm stuck with version 2.39.0. every time i try to upgrade vRBT and i try to run my pipeline i always get the error below.
It seems that vRA project try to delete existing Dynamic Type (Custom Resource). vRA do not allow to delete Custom Resource if any instances exist. The error you see is a try to push back the code to this same instance it was taken form!

Is this a issue with my pipeline or a known issue with vRBT?
BTW is thee any build tools documentation and some more information what newer versions offer than what i can see in releases What's Changed If you are not a vRBT developer its not possible to understand this.

Error:
02:19:43.700 [main] INFO com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore - Importing custom resource BMS...
02:19:43.749 [main] INFO com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore - Custom resource 'BMS' already exists and has ID '3f691877-1bbb-4ac8-bbc1-acd2220b71c0'
02:19:43.750 [main] INFO com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore - Trying to delete custom resource 'BMS' first.
02:19:43.750 [main] INFO com.vmware.pscoe.iac.artifact.rest.RestClientVraNg - Deleting custom resource with id '3f691877-1bbb-4ac8-bbc1-acd2220b71c0'
Exception in thread "main" java.lang.RuntimeException: Error executing POST to server: java.lang.RuntimeException : Could not delete custom resource with name 'BMS' (id:3f691877-1bbb-4ac8-bbc1-acd2220b71c0).
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.importCustomResource(VraNgCustomResourceStore.java:316)
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.importContent(VraNgCustomResourceStore.java:177)
at com.vmware.pscoe.iac.artifact.VraNgPackageStore.importPackage(VraNgPackageStore.java:274)
at com.vmware.pscoe.iac.artifact.VraNgPackageStore.importAllPackages(VraNgPackageStore.java:139)

@Michaelpalacce Michaelpalacce added kind/bug Something isn't working triage/research Research is needed by a maintainer or a contributor java Pull requests that update Java code labels Dec 3, 2024
@Michaelpalacce Michaelpalacce self-assigned this Dec 3, 2024
@Michaelpalacce
Copy link
Collaborator

@oporanski When you opeend up the bug, there was a template that you needed to fill, giving us important information we need.

@Michaelpalacce
Copy link
Collaborator

So, what you are seeing is actually correct. There is an error, but it's just a log. The execution actually continues and you should see: Will attempt to update Custom Resource after it.

The logic for handling Custom resources is quite complex, but the thing that actually matters is that as you noticed you cannot delete a Custom Resource if it's in use.

So what we attempt to do is "update" the Custom Resource with what you have locally and we hope it works.

@Michaelpalacce
Copy link
Collaborator

You can look at the VraNgCustomResourcesStore > importCustomResource for more info... it's complex but there are a lot of comments and logs for this

@Michaelpalacce Michaelpalacce added triage/not-a-bug The bugfix that was submitted, is not an actual bug, or is expected behavior and removed triage/research Research is needed by a maintainer or a contributor labels Dec 3, 2024
@oporanski
Copy link
Author

Sorry i did not know that there is a template
Ok the problem is that if i upgrade to version Above 2.39 this generates an error that stop maven process completely
Full log below. Is there a way to avoid this behavior?

02:21:27.290 [main] INFO com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore - Trying to delete custom resource 'BMS' first.
02:21:27.290 [main] INFO com.vmware.pscoe.iac.artifact.rest.RestClientVraNg - Deleting custom resource with id '3f691877-1bbb-4ac8-bbc1-acd2220b71c0'
Exception in thread "main" java.lang.RuntimeException: Error executing POST to server: java.lang.RuntimeException : Could not delete custom resource with name 'BMS' (id:3f691877-1bbb-4ac8-bbc1-acd2220b71c0).
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.importCustomResource(VraNgCustomResourceStore.java:316)
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.importContent(VraNgCustomResourceStore.java:177)
at com.vmware.pscoe.iac.artifact.VraNgPackageStore.importPackage(VraNgPackageStore.java:274)
at com.vmware.pscoe.iac.artifact.VraNgPackageStore.importAllPackages(VraNgPackageStore.java:139)
at com.vmware.pscoe.iac.artifact.VraNgPackageStore.importAllPackages(VraNgPackageStore.java:114)
at com.vmware.pscoe.iac.installer.Installer.main(Installer.java:993)
Caused by: java.lang.RuntimeException: Could not delete custom resource with name 'BMS' (id:3f691877-1bbb-4ac8-bbc1-acd2220b71c0).
at com.vmware.pscoe.iac.artifact.rest.RestClientVraNg.deleteCustomResource(RestClientVraNg.java:1202)
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.tryDeleteCustomResource(VraNgCustomResourceStore.java:352)
at com.vmware.pscoe.iac.artifact.store.vrang.VraNgCustomResourceStore.importCustomResource(VraNgCustomResourceStore.java:264)
... 5 more
Caused by: org.springframework.web.client.HttpClientErrorException: 400 Invalid/Unreachable FQDN or IP address: 400 Bad Request
content-type: application/json
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-content-type-options: nosniff
strict-transport-security: max-age=31536000 ; includeSubDomains
x-frame-options: SAMEORIGIN
x-xss-protection: 0
referrer-policy: no-referrer
x-envoy-upstream-service-time: 46
vary: Accept-Encoding
date: Tue, 03 Dec 2024 01:21:26 GMT
server: envoy
transfer-encoding: chunked

{"timestamp":"2024-12-03T01:21:27.338+0000","path":"/form-service/api/custom/resource-types/3f691877-1bbb-4ac8-bbc1-acd2220b71c0","status":400,"error":"Bad Request","message":"400 BAD_REQUEST "Resource type cannot be deleted as there are active resources attached to it: 'Custom.BMS'"","requestId":"be00e27d-1452895","@type":"org.springframework.web.server.ResponseStatusException"}
at com.vmware.pscoe.iac.artifact.rest.RestClientFactory$1.handleError(RestClientFactory.java:220)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:942)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:891)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:830)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:691)
at com.vmware.pscoe.iac.artifact.rest.RestClientVraNgPrimitive.deleteCustomResourcePrimitive(RestClientVraNgPrimitive.java:2551)
at com.vmware.pscoe.iac.artifact.rest.RestClientVraNg.deleteCustomResource(RestClientVraNg.java:1196)
... 7 more
[Pipeline] }
Deleting 1 temporary files
[Pipeline] // configFileProvider
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] deleteDir
[Pipeline] dir
Running in /var/lib/jenkins/workspace/vra-cd_development@tmp
[Pipeline] {
[Pipeline] deleteDir
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
[GitLab Pipeline Status] Notifying branch build status: FAILED vra-cd/development #579: There was a failure building this commit.
[GitLab Pipeline Status] Notified
Finished: FAILURE

@VenelinBakalov VenelinBakalov linked a pull request Dec 4, 2024 that will close this issue
9 tasks
@VenelinBakalov VenelinBakalov added lang/java Related to Java Code area/artifact-manager Relates to the `artifact-manager` maven module priority/medium effort/low and removed java Pull requests that update Java code labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/artifact-manager Relates to the `artifact-manager` maven module effort/low kind/bug Something isn't working lang/java Related to Java Code priority/medium triage/not-a-bug The bugfix that was submitted, is not an actual bug, or is expected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants