vinzscam / backstage-chart

Backstage Helm Chart
27 stars 10 forks source link

Add some input validations to check if a container image is declared #16

Closed cmoulliard closed 2 years ago

cmoulliard commented 2 years ago

Issue

When we use the default chart's values and that we install the helm chart, then the process will fail as no default image is declared within the values.yaml file

backstage:
  image:
    registry: ""
    repository: ""
    tag: ""

Example of test

helm template --dry-run --debug my-release backstage/backstage
install.go:178: [debug] Original chart version: ""
install.go:195: [debug] CHART PATH: /Users/cmoullia/Library/Caches/helm/repository/backstage-0.3.0.tgz

---
# Source: backstage/templates/backstage-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-release-backstage
  namespace: "default"
  labels:
    app.kubernetes.io/name: backstage
    helm.sh/chart: backstage-0.3.0
    app.kubernetes.io/instance: my-release
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: backstage
  annotations:
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: backstage
      app.kubernetes.io/instance: my-release
      app.kubernetes.io/component: backstage
  template:
    metadata:
      labels:
        app.kubernetes.io/name: backstage
        helm.sh/chart: backstage-0.3.0
        app.kubernetes.io/instance: my-release
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/component: backstage
    spec:
      volumes:
      containers:
        - name: backstage-backend
          image: : ### EMPTY IMAGE NAME
          imagePullPolicy: "Always"
          command:
            - node
            - packages/backend

That will work if we execute this command

helm template --dry-run --debug my-release backstage/backstage \
  --set backstage.image.repository=backstage \
  --set backstage.image.registry=docker.io \
  --set backstage.image.tag=1.0

Proposition

We should add some helm input validation as described here or as reported by the helm doc

Originally posted by @cmoulliard in https://github.com/vinzscam/backstage-chart/issues/13#issuecomment-1179130249