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

Question about first deployment in k8s #38

Closed
virtualb0x opened this issue Jan 31, 2024 · 4 comments
Closed

Question about first deployment in k8s #38

virtualb0x opened this issue Jan 31, 2024 · 4 comments
Labels
triage requires review

Comments

@virtualb0x
Copy link

Hello.

I've deployed kobold in k8s cluster using file

https://github.com/bluebrown/kobold/releases/latest/download/kobold-manifests.yaml

Also I added there ingress, but no changes for creds or configs were made:

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kobold-ingress
spec:
  ingressClassName: nginx
  rules:
  - host: "kobold.apps.ip-bla-blal.link"
    http:
      paths:
      - path: /api
        pathType: Prefix
        backend:
          service:
            name: kobold-api
            port:
              number: 80
      - path: /webook 
        pathType: Prefix
        path: "/webhook"
        backend:
          service:
            name: kobold-webhook
            port:
              number: 80

address kobold.apps.ip-bla-blal.link/api/docs is working for me
But curling kobold.apps.ip-bla-blal.link/webhook returns 404
Also I didn't find any services for metrics to be exposed, despite there is a descripton in README

Can you please tell me some things:

  1. Is the endpoint kobold.apps.ip-bla-blal.link/webhook is reachable in normal cases when kobold deployed right? Or how can I check if the kobold server is working ok?
  2. How can I see the metrics?
  3. Can I webhook kobold from artifactory docker registry? I mean of you checked it out
@github-actions github-actions bot added the triage requires review label Jan 31, 2024
@bluebrown
Copy link
Owner

bluebrown commented Jan 31, 2024

Hi, sorry, I will try to add better docs:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kobold-ingress
spec:
  ingressClassName: nginx
  rules:
  - host: "kobold.apps.ip-bla-blal.link"
    http:
      paths:
      - path: /events
        pathType: Exact
        backend:
          service:
            name: kobold-webhook
            port:
              number: 80
      - path: /
        pathType: Prefix
        backend:
          service:
            name: kobold-api
            port:
              number: 80

It should be something like this. And then you send events to kobold.apps.ip-bla-blal.link/events?chan=<my-channel>. And you can view the metrics at kobold.apps.ip-bla-blal.link/metrics.

Yes, you can set up webhooks on dockerhub. But docker hub doesn't include the digest.

Also note that you need to take care of protecting the endpoints. I.e. you can use your ingress controller to use basic auth.

@virtualb0x
Copy link
Author

virtualb0x commented Feb 2, 2024

Thanks a lot for rapid answer!

I've managed to receive webhooks.
Unfortunately, due to our internal problems I cant send webhooks from artifactory yet. But I hope I'll soon resolve these problems.

But still I'm trying to emulate how kobold can change tags.

I've created connection to our gitlab. Also I've done some annotations to my deployment.yaml:

  template:
    metadata:
      labels:
        app: tiny-webhook
    spec:
      containers:
      - name: tiny-webhook
        image: artifactory.corp.domain.link:443/infrastructure-docker-repo/tiny_webhook_listener # kobold: tag: ^0.0.3; type: semver
        imagePullPolicy: IfNotPresent
        command: ["python3", "webhook_listener.py"]

And I'm trying to send synthetic webhook like

curl -X POST  "http://kobold.corp.domain.link/events?chan=c" -vvv  -d "artifactory.corp.domain.link:443/infrastructure-docker-repo/tiny_webhook_listener:0.0.2@sha256:220611111e8c9bbe242e9dc1367c0fa89eef83f26203ee3f7c3764046e02b248" 

Pretend kobold recieved data that new image was pushed

and still I receive nothing
Logs:

{"time":"2024-02-02T11:38:27.064465871Z","level":"INFO","msg":"task queued","channel":"c","dec":false,"error":null}
{"time":"2024-02-02T11:39:27.563140661Z","level":"INFO","msg":"task group dispatched","fingerprint":"f3ee030efb3382da5ff3207887ff114e84028e03"}
{"time":"2024-02-02T11:39:27.581945798Z","level":"INFO","msg":"task group done","fingerprint":"f3ee030efb3382da5ff3207887ff114e84028e03","status":"success"}

My config is:

  kobold.toml: |
    version = "2"

    [[channel]]
    name = "a"
    decoder = "builtin.dockerhub@v1"

    [[channel]]
    name = "b"
    decoder = "builtin.dstribution@v1"

    [[channel]]
    name = "c"
    decoder = "builtin.lines@v1"

    [[pipeline]]
    name = "example"
    repo_uri = "git@gitlab.corp.domain.link:tdp/do/iaac/testrepojira.git@main/tiny_webhook"
    dest_branch = "feature/DO-3779"
    channels = ["a", "b", "c"]

Am I doing smth wrong and how can I check if it is changing my tags?

Mucр appreciate your answer

@bluebrown
Copy link
Owner

Your supplied version doesn't meet the constraint https://go.dev/play/p/XTjhdq2oyTO.

@virtualb0x
Copy link
Author

Thanks a lot! You helped me so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage requires review
Projects
None yet
Development

No branches or pull requests

2 participants