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

Getting NOT_FOUND error while uploading helm chart to GitHub Container Registry #2417

Closed
rohanKanojia opened this issue Oct 11, 2023 · 3 comments · Fixed by #2418
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented Oct 11, 2023

Describe the bug

Related to #2377

While uploading a helm chart to GitHub Container Registry, I keep getting 404 /Not found error like this:

[ERROR] k8s: Error performing helm push: java.lang.IllegalStateException: Failure in initiating upload request: Not Found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.065 s
[INFO] Finished at: 2023-10-11T10:45:21+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.14.0:helm-push (default-cli) on project jkube-helm-chart-upload-ghcr-demo: Failure in initiating upload request: Not Found

Upon closer inspection, I think it's due to passing an invalid Host header while doing OCI upload request. For a Url like ghcr.io, host is computed as ghcr.io:-1:
https://github.com/eclipse/jkube/blob/cc6d239259aab437655a8bfdb76f0328f1170a95/jkube-kit/resource/helm/src/main/java/org/eclipse/jkube/kit/resource/helm/oci/OCIRegistryClient.java#L128

We should only add port value if registry URL contains a valid port.

Eclipse JKube version

SNAPSHOT

Component

Kubernetes Maven Plugin

Apache Maven version

None

Gradle version

None

Steps to reproduce

Set up GitHub Container Registry and try pushing with this configuration:

      <plugin>
        <groupId>org.eclipse.jkube</groupId>
        <artifactId>kubernetes-maven-plugin</artifactId>
        <version>${jkube.version}</version>
        <configuration>
          <helm>
            <snapshotRepository>
              <name>GitHub</name>
              <url>https://ghcr.io/r0haaaan/helm</url>
              <type>OCI</type>
              <username>r0haaaan</username>
              <password>${env.GHCR_PASSWORD}</password>
            </snapshotRepository>
          </helm>
        </configuration>
      </plugin>

Expected behavior

Plugin should push to GitHub Container Registry without any problems

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

Linux

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

@manusa
Copy link
Member

manusa commented Oct 11, 2023

Do we need to specify any port at all?

@rohanKanojia rohanKanojia self-assigned this Oct 11, 2023
@rohanKanojia
Copy link
Member Author

It doesn't seem to be required for registries like ghcr.io but if we don't specify port for local docker registries like localhost:5000, I get this error:

[INFO] --- k8s:1.15-SNAPSHOT:helm-push (default-cli) @ jkube-helm-push-testing ---
[INFO] k8s: Creating Helm Chart "jkube-helm-push-testing" for Kubernetes
[INFO] k8s: Uploading Helm Chart "jkube-helm-push-testing" to local
[ERROR] k8s: Error performing helm push: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.net.ConnectException: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22.147 s
[INFO] Finished at: 2023-10-11T11:59:52+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.15-SNAPSHOT:helm-push (default-cli) on project jkube-helm-push-testing: java.util.concurrent.ExecutionException: java.net.ConnectException: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:80: Connection refused -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@manusa
Copy link
Member

manusa commented Oct 11, 2023

Yup, OK.
I think it'd be wise then to just set the port in case it's different than 80 or 443

@manusa manusa added this to the 1.15.0 milestone Oct 11, 2023
@manusa manusa moved this to In Progress in Eclipse JKube Oct 11, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Eclipse JKube Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants