keel-hq / keel

Kubernetes Operator to automate Helm, DaemonSet, StatefulSet & Deployment updates
https://keel.sh
Mozilla Public License 2.0
2.45k stars 282 forks source link

Helm3 does not seems picking image updates #567

Open mansing2 opened 3 years ago

mansing2 commented 3 years ago

We have recently upgrade Helm v2 to v3 and I'm in the middle of testing just one chart with Keel and I don't see the latest image is being pulled.

I also want to know if keel triggers the help upgrade or it will just replace to deployment whose image is updated, as we are deploying two additional jobs with one Deployment.

I have installed the keel using helm install keel keel/keel --set helmProvider.version="v3" as I have got helm3 installed.

values.yaml

helmProvider:
  version: "v3"
  enabled: true

image:
  repository: karolisr/webhook-demo
  tag: 0.0.8
  pullPolicy: IfNotPresent
keel:
  policy: all
  trigger: poll
  pollSchedule: "@every 3m" 
  images:
    - repository: image.repository # [1]
      tag: image.tag  # [2]

Chart.yaml

apiVersion: v2
name: test-service
version: 2.0.0
maintainers:
  - name: DevOps

deployment.yaml from templates

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
  annotations:
    keel.sh/policy: {{ .Values.keel.policy  }}
    keel.sh/trigger: {{ .Values.keel.trigger }}
    keel.sh/pollSchedule: {{ .Values.keel.pollSchedule | quote }}
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: mansing
        image: {{ print .Values.image.repository ":" .Values.image.tag | quote }}

Logs from keel pod. I don't see helm version being set here in the logs.

time="2020-12-21T12:50:50Z" level=info msg="extension.credentialshelper: helper registered" name=aws
time="2020-12-21T12:50:50Z" level=info msg="extension.credentialshelper: helper registered" name=gcr
time="2020-12-21T12:50:50Z" level=info msg="bot: registered" name=slack
time="2020-12-21T12:50:50Z" level=info msg="keel starting..." arch=amd64 build_date=2020-06-07T155004Z go_version=go1.14.2 os=linux revision=82ba1d50 version=0.16.1
time="2020-12-21T12:50:51Z" level=info msg="initializing database" database_path=/data/keel.db type=sqlite3
time="2020-12-21T12:50:51Z" level=info msg="extension.notification.auditor: audit logger configured" name=auditor
time="2020-12-21T12:50:51Z" level=info msg="notificationSender: sender configured" sender name=auditor
time="2020-12-21T12:50:51Z" level=info msg="provider.kubernetes: using in-cluster configuration"
time="2020-12-21T12:50:51Z" level=info msg="provider.defaultProviders: provider 'kubernetes' registered"
time="2020-12-21T12:50:51Z" level=info msg="extension.credentialshelper: helper registered" name=secrets
time="2020-12-21T12:50:51Z" level=info msg="bot.slack.Configure(): Slack approval bot is not configured"
time="2020-12-21T12:50:51Z" level=error msg="bot.Run(): can not get configuration for bot [slack]"
time="2020-12-21T12:50:51Z" level=info msg="authentication is not enabled, admin HTTP handlers are not initialized"
time="2020-12-21T12:50:51Z" level=info msg="webhook trigger server starting..." port=9300
time="2020-12-21T12:50:51Z" level=info msg="trigger.poll.manager: polling trigger configured"
time="2020-12-21T12:50:51Z" level=info msg=started context=watch resource=statefulsets
time="2020-12-21T12:50:51Z" level=info msg=started context=watch resource=daemonsets
time="2020-12-21T12:50:51Z" level=info msg=started context=watch resource=cronjobs
time="2020-12-21T12:50:51Z" level=info msg=started context=buffer
time="2020-12-21T12:50:51Z" level=info msg=started context=watch resource=deployments

Am I missing anything here? any suggestion would be highly appreciable.

mansing2 commented 3 years ago

The first issue has been resolved, there were a typo and fields missing from the deployment. However, the helm revision still shows as 1

Now what I'm looking for is to trigger Helm upgrade every time a new image is pushed so that it also triggers the other two jobs that are supposed to be executed every time the main deployment is updated.

Anything on this please?

dza89 commented 3 years ago

I have the same issue, this works again when setting image tag of keel to latest.

mansing2 commented 3 years ago

@dza89 - Are you saying overall upgrade is now possible through the keel, I still see it is open https://github.com/keel-hq/keel/pull/547/

dza89 commented 3 years ago

I don't know what the overal upgrade is. I guess it a helm upgrade?

But images work fine if you change the tag to latest, you'll see this in the logs:

time="2021-05-14T11:50:26Z" level=info msg="provider.defaultProviders: provider 'helm3' registered"

and you will also get new jobs from the helm3 provider if keel is configured of course.

mansing2 commented 3 years ago

@dza89 - What I meant is, I have a helm chart with one deployment and two jobs. My requirement is when a new image is made available, the deployment as well as the jobs should be triggered for an upgrade. That was not happening.

dza89 commented 3 years ago

Oh sorry, I missed your additional information. Forget what I said!