featbit / featbit-charts

Helm Charts for FeatBit
MIT License
6 stars 6 forks source link

das-test-connection InvalidImageName #37

Closed alexbaeza closed 5 days ago

alexbaeza commented 1 month ago

I wanted to report an issue I have noticed in one of the helm-tests when the test is created the manifest file has an invalid definition this is because the test references: {{ .Values.busybox.image }} which renders "map[pullPolicy:IfNotPresent registry:docker.io repository:busybox tag:1.34]" rather than an {{ include "featbit.init-container.busybox.image" . }} which will render the correct structure.

09:34:14 ❯ k get events
LAST SEEN   TYPE      REASON          OBJECT                            MESSAGE
5m50s       Normal    Scheduled       pod/featbit-das-test-connection   Successfully assigned featbit/featbit-das-test-connection to lab-02
3m36s       Warning   Failed          pod/featbit-das-test-connection   Error: InvalidImageName
47s         Warning   InspectFailed   pod/featbit-das-test-connection   Failed to apply default image tag "map[pullPolicy:IfNotPresent registry:docker.io repository:busybox tag:1.34]": couldn't parse image name "map[pullPolicy:IfNotPresent registry:docker.io repository:busybox tag:1.34]": invalid reference format: repository name must be lowercase

Solution

A possible solution, Update the helm test to re-use the featbit.init-container.busybox.image and reference the busybox pull policy.

Although ideally it needs a bit more cleanup, perhaps some utils where the tooling images can be referenced from featbit.tooling.busybox.image this way we can ensure the same image is re-used accross all manifest files.

apiVersion: v1
kind: Pod
metadata:
  name: {{ include "das.svc.name" . }}-test-connection
  labels:
    {{- include "featbit-metadata-labels-common" . | nindent 4 }}
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: wget
      image: {{ include "featbit.init-container.busybox.image" . }}
      imagePullPolicy: {{ .Values.busybox.image.pullPolicy }}
      command: ['wget']
      args: ['{{ include "das.svc.name" . }}:{{ include "das.svc.port" .}}/api']
  restartPolicy: Never

This will then ensure that the test is successful

09:58:28 ❯ helm test featbit
NAME: featbit
LAST DEPLOYED: Sun Sep 29 09:57:26 2024
NAMESPACE: test
STATUS: deployed
REVISION: 1
TEST SUITE:     featbit-das-test-connection
Last Started:   Sun Sep 29 09:58:30 2024
Last Completed: Sun Sep 29 09:58:33 2024
Phase:          Succeeded
alexbaeza commented 1 month ago

I am not sure if contributions are accepted but I have raised this PR to address the issue: https://github.com/featbit/featbit-charts/pull/38

Many thanks