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

[Bug]: GitRepository.idpbuilder.cnoe.io "argocd" is invalid: spec.provider.gitURL: Invalid value: "": spec.provider.gitURL in body should match '^https?:\/\/.+$' #425

Closed
cmoulliard opened this issue Oct 23, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@cmoulliard
Copy link
Contributor

cmoulliard commented Oct 23, 2024

Issue

When we create a new new cluster (using podman as container engine), we got different errors

Command used:

KIND_EXPERIMENTAL_PROVIDER=podman idpbuilder create \
        --color \
        --build-name konflux \
        --recreate

Errors

We have potentially several issues OR one having the following side effects here:

Error 1 - spec.provider.gitURL: Invalid value

Oct 24 09:09:13 ERROR Reconciler error controller=localbuild controllerGroup=idpbuilder.cnoe.io controllerKind=Localbuild name=konflux name=konflux reconcileID=332f25c8-136d-465b-b517-db93baa3defd err=reconciling bootstrap apps creating argocd repo CR: GitRepository.idpbuilder.cnoe.io "argocd" is invalid: spec.provider.gitURL: Invalid value: "": spec.provider.gitURL in body should match '^https?:\/\/.+$'
Screenshot 2024-10-24 at 09 32 11

Error 2 - panic: runtime error: invalid memory address or nil pointer dereference

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x101ab2c8c]

goroutine 948 [running]:
code.gitea.io/sdk/gitea.(*Client).SetBasicAuth(0x0, {0x14001484310, 0xa}, {0x14000d4f0b0, 0x28})
        /Users/cmoullia/go/pkg/mod/code.gitea.io/sdk/[email protected]/client.go:168 +0x2c
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.getGiteaToken({0x1025e84b0, 0x140000d6730}, {0x140011d3d10, 0x24}, {0x14001484310, 0xa}, {0x14000d4f0b0, 0x28})
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/gitea.go:183 +0x18c
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.(*LocalbuildReconciler).setGiteaToken(_, {_, _}, {{{0x1020e42c7, 0x6}, {0x101c863bc, 0x2}}, {{0x14000734920, 0x10}, {0x0, ...}, ...}, ...}, ...)
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/gitea.go:166 +0x198

Error 3 - Timeout

Oct 24 08:17:35 INFO Checking if we should shutdown controller=localbuild controllerGroup=idpbuilder.cnoe.io controllerKind=Localbuild name=konflux name=konflux reconcileID=bb8dd1fb-c992-4470-9faa-0acf53bf5734 
Oct 24 08:17:40 INFO installing bootstrap apps to ArgoCD controller=localbuild controllerGroup=idpbuilder.cnoe.io controllerKind=Localbuild name=konflux name=konflux reconcileID=063c7301-b510-42fd-bc4a-852fc90ab0b9 
Oct 24 08:17:40 INFO Checking if we should shutdown controller=localbuild controllerGroup=idpbuilder.cnoe.io controllerKind=Localbuild name=konflux name=konflux reconcileID=063c7301-b510-42fd-bc4a-852fc90ab0b9 
Oct 24 08:17:48 ERROR Reconciler error controller=gitrepository controllerGroup=idpbuilder.cnoe.io controllerKind=GitRepository name=argocd namespace=idpbuilder-konflux namespace=idpbuilder-konflux name=argocd reconcileID=b0376a2d-e967-4c8c-a046-beb44c0af4de err=initializing git provider: Get "https://gitea.cnoe.localtest.me:8443/api/v1/version": context deadline exceeded (Client.Timeout exceeded while awaiting headers) 
O

Screenshot 2024-10-24 at 08 14 20

Error 4 - tls

Oct 24 09:22:49 ERROR Reconciler error controller=gitrepository controllerGroup=idpbuilder.cnoe.io controllerKind=GitRepository name=argocd namespace=idpbuilder-konflux namespace=idpbuilder-konflux name=argocd reconcileID=a1caaf98-bda9-4cce-ad00-4c9f53ecc407 err=updating repository contents: pushing to git: Get "https://gitea.cnoe.localtest.me:8443/giteaAdmin/idpbuilder-konflux-argocd.git/info/refs?service=git-receive-pack": net/http: TLS handshake timeout 

Tests

I did a couple of tests on MacOS - ARM64 using either podman or docker locally and here is what I oberserved

Docker

Docker client: 27.2.0
Docker engine: 4.34.2
where the VM has 12 CPU and max 12 GB of RAM

I didn't get such errors when I created 2 times a cluster

Podman

Podman engine (uses AppleHV): 5.0.3
Podman Client: 5.2.4

I got the errors reported here using: CPU: 6 and Max memory 8 GB of RAM

I din't get the errors except one time the error 1 using CPU: 12 and memory 12 GB of RAM

@cmoulliard cmoulliard added the bug Something isn't working label Oct 23, 2024
@cmoulliard
Copy link
Contributor Author

All the PODS have been well created !
Screenshot 2024-10-23 at 19 02 05

@cmoulliard
Copy link
Contributor Author

I think that we have an issue when se set the gitea auth

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x101ab2c8c]

goroutine 948 [running]:
code.gitea.io/sdk/gitea.(*Client).SetBasicAuth(0x0, {0x14001484310, 0xa}, {0x14000d4f0b0, 0x28})
        /Users/cmoullia/go/pkg/mod/code.gitea.io/sdk/[email protected]/client.go:168 +0x2c
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.getGiteaToken({0x1025e84b0, 0x140000d6730}, {0x140011d3d10, 0x24}, {0x14001484310, 0xa}, {0x14000d4f0b0, 0x28})
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/gitea.go:183 +0x18c
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.(*LocalbuildReconciler).setGiteaToken(_, {_, _}, {{{0x1020e42c7, 0x6}, {0x101c863bc, 0x2}}, {{0x14000734920, 0x10}, {0x0, ...}, ...}, ...}, ...)
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/gitea.go:166 +0x198
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.(*LocalbuildReconciler).ReconcileGitea(0x14000528960, {0x1025e84b0, 0x140000d6730}, {{{0x0?, 0x0?}, {0x0?, 0x0?}}}, 0x14000c27a00)
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/gitea.go:132 +0x898
github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.(*LocalbuildReconciler).installCorePackages.func1()
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/controller.go:118 +0xa8
created by github.com/cnoe-io/idpbuilder/pkg/controllers/localbuild.(*LocalbuildReconciler).installCorePackages in goroutine 817
        /Users/cmoullia/code/cnoe/fork-idpbuilder/pkg/controllers/localbuild/controller.go:116 +0x340

@nabuskey
Copy link
Collaborator

Hmm this isn't good. Looks like we are not checking for nil somehow. We will have to investigate.

@nabuskey
Copy link
Collaborator

spec.provider.gitURL: Invalid value

This is usually harmless. It just means the Gitea repository is not ready and do not have an repository to associate yet. We can improve logging here.

For nil ref, gitea.NewClient apparently calls the server. Under situations with resource contentions, this could return nil. We shouldn't call that function.

@nabuskey
Copy link
Collaborator

nabuskey commented Oct 24, 2024

Nil ref should be fixed now. Errors three and four seem to be related to resource contentions where we cannot get the response we need in reasonable time. We assume gitea and k8s can respond in 30 seconds per request.

@cmoulliard
Copy link
Contributor Author

I did some tests on a Virtual VM (on ly macos) having 8GB of RAM and 6 CPU and using your fix (= Git Client) and didn't get anymore the errors 2, 3.

Remark: Error 1 still happens but is not blocking. A better log message should help the users @nabuskey to understand what it happens under the hood

@nabuskey

@cmoulliard
Copy link
Contributor Author

I will close this ticket as fixed and another ticket exists also to better log the message

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

No branches or pull requests

2 participants