k3s-io / helm-controller

Apache License 2.0
391 stars 85 forks source link

incorrect timeout parsing #160

Closed ibrokethecloud closed 2 years ago

ibrokethecloud commented 2 years ago

We are leveraging helm-controller via rke2 in harvester, and have noticed that the timeout duration is not parsed correctly when being passed as env variables to the job

for example, sample HelmChart CRD

apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
  creationTimestamp: "2022-09-29T03:32:25Z"
  finalizers:
  - wrangler.cattle.io/helm-controller
  generation: 2
  name: vm-import-controller
  namespace: harvester-system
  ownerReferences:
  - apiVersion: harvesterhci.io/v1beta1
    kind: Addon
    name: vm-import-controller
    uid: 5cfce8e3-70f8-48ae-840e-e1081812a9f2
  resourceVersion: "106365"
  uid: 97e7da21-9def-402a-94f2-f6254802ec06
spec:
  chart: harvester-vm-import-controller
  repo: http://harvester-cluster-repo.cattle-system.svc/charts
  timeout: 10m0s
  valuesContent: |
    image:
      tag: v0.1.0
  version: 0.1.1-rc1
status:
  jobName: helm-install-vm-import-controller

The generated job is as follows:

   spec:
      containers:
      - args:
        - install
        - --repo
        - http://harvester-cluster-repo.cattle-system.svc/charts
        - --version
        - 0.1.1-rc1
        env:
        - name: NAME
          value: vm-import-controller
        - name: VERSION
          value: 0.1.1-rc1
        - name: REPO
          value: http://harvester-cluster-repo.cattle-system.svc/charts
        - name: HELM_DRIVER
          value: secret
        - name: CHART_NAMESPACE
          value: harvester-system
        - name: CHART
          value: harvester-vm-import-controller
        - name: HELM_VERSION
        - name: TARGET_NAMESPACE
          value: harvester-system
        - name: TIMEOUT
          value: '&Duration{Duration:10m0s,}'
        - name: NO_PROXY
          value: .svc,.cluster.local,10.52.0.0/16,10.53.0.0/16
        - name: FAILURE_POLICY
          value: reinstall
        image: rancher/klipper-helm:v0.7.3-build20220613
        imagePullPolicy: IfNotPresent
        name: helm
brandond commented 2 years ago

This was fixed in https://github.com/k3s-io/helm-controller/pull/150 but i don't believe it's been pulled into any releases yet. I'm hoping to get it into this months.

Closings this as fixed, but will reference it when updating the controller embedded in k3s and rke2.