Skip to content

workflow example

Víctor Cuadrado Juan edited this page Nov 3, 2022 · 1 revision

workflow example: new feature in kubewarden-controller + helm charts

This is a walkthrough on how I completed the changes in PR https://github.com/kubewarden/kubewarden-controller/pull/304, which included:

  • kubewarden-controller: bump go 1.19, refactor of opentelemetry export code.
  • helm-charts: fixes, and add tls.insecure
  • docs
  • tests: deploy Kubewarden stack + opentelemetry stack, test by hand

Needed tasks

    1. Changes to controller repo
    $ cd /home/vic/suse/kw/kubewarden-controller
    $ git pull
    $ git checkout -b bump-controller
    
    # loop of code changes, commit them, etc
    $ make build
    $ make test
  • 2a. Create container image

    # create container image
    $ IMG=controller:viccuad-opentelemetry make docker-build
    $ docker tag controller:viccuad-opentelemetry ghcr.io/viccuad/test/controller:viccuad-opentelemetry
    $ docker push ghcr.io/viccuad/test/controller:viccuad-opentelemetry
  • 2b. Run controller binary outside of the cluster against a cluster Follow https://github.com/kubewarden/kubewarden-controller/blob/main/CONTRIBUTING.md#running. In this case, with opentelemetry, it's not worth it to expose the opentelemetry-collector outside of the cluster, to try and make the controller outside of the cluster connect to it.

  1. Changes to helm chart kubewarden-controller This ones: https://github.com/kubewarden/helm-charts/pull/136

    $ cd /home/vic/suse/kw/helm-charts
    $ git pull
    $ git checkout -b opentemeletry
    # loop of code changes, commit them, etc
    
    make generate-values
    make check-generated-values
    
  2. Deploy kubewarden stack + opentelemetry stack Following instructions from https://github.com/kubewarden/kubewarden-controller/pull/304#issue-1391142647, I deploy the helm charts from the helm-charts/charts/ folder to test my changes.

    Apart from the new values that are added , I need to configure the helm charts to test the relevant parts, with a values.yaml:

    ---
    # kubewarden-controller-opentelemtry.yaml
    telemetry:
      enabled: True
      metrics:
        port: 8080
      tracing:
        jaeger:
          endpoint: "my-open-telemetry-collector.jaeger.svc.cluster.local:14250"
          tls: # new 
            insecure: true # new
    ---
    # my-controller-image.yaml
    image:
      repository: ghcr.io/viccuad/test/controller
      tag: viccuad-opentelemetry
    ---
    # kubewarden-defaults-opentelemtry.yaml
    policyServer:
      telemetry:
        enabled: True

    I deploy cert-manager, jaeger, opentelemetry, configure their resources as listed in that comment.

    I deploy the kubewarden-controller chart by passing the 2 values files with --values kubewarden-controlleropentelemtry.yaml --values my-controller-image.yaml. Both files could clash on setting values, and would need to be merged, but not on this case.

    I deploy kubewarden-defaults with --values kubewarden-defaults-opentelemetry.yaml.

  3. Test by hand. Or run specific e2e tests, that I would have just written for this feature.

  4. Push branches to my remotes on GH, open PRs, iterate on feedback

Clone this wiki locally