manusa / helm-java

Helm client for Java
https://www.marcnuri.com
Apache License 2.0
15 stars 6 forks source link

Add support for disabling OpenAPI validation while installing Helm Charts #129

Closed rohanKanojia closed 2 months ago

rohanKanojia commented 3 months ago

helm install seems to have DisableOpenAPIValidation flag in InstallOptions in helm/pkg/action/install.go

Flag Name Description
--disable-openapi-validation if set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema

I'm trying to implement tests using Kubernetes Mock Server in this pull request https://github.com/helm/helm/blob/main/pkg/action/install.go#L97 . However, Kubernetes Mock Server tests are failing as helm CLI seems to request /openapi endpoints

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jun 12, 2024 5:55:40 PM okhttp3.mockwebserver.MockWebServer$2 execute
INFO: MockWebServer[49529] starting to accept connections
Jun 12, 2024 5:55:40 PM okhttp3.mockwebserver.MockWebServer$2 execute
INFO: MockWebServer[40235] starting to accept connections
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /version HTTP/1.1 and responded: HTTP/1.1 200 OK protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /api/v1/namespaces/test/secrets?labelSelector=name%3Dtest-project%2Cowner%3Dhelm HTTP/1.1 and responded: HTTP/1.1 404 Client Error protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /version?timeout=32s HTTP/1.1 and responded: HTTP/1.1 200 OK protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /api?timeout=32s HTTP/1.1 and responded: HTTP/1.1 404 Client Error protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /apis?timeout=32s HTTP/1.1 and responded: HTTP/1.1 200 OK protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$Http2SocketHandler onStream
INFO: MockWebServer[40235] received request: GET /openapi/v2?timeout=32s HTTP/1.1 and responded: HTTP/1.1 404 Client Error protocol is h2
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$2 acceptConnections
INFO: MockWebServer[40235] done accepting connections: Socket closed
Jun 12, 2024 5:55:42 PM okhttp3.mockwebserver.MockWebServer$2 acceptConnections
INFO: MockWebServer[49529] done accepting connections: Socket closed

java.lang.IllegalStateException: unable to build kubernetes objects from release manifest: error validating "": error validating data: the server could not find the requested resource

It looks like it's failing during the validation step. I want to disable the validation however I don't see any configuration option to disable it.

I think InstallOptions should be updated with all available configuration options in helm Install struct