Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History

09_required

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Using the 'required' Function

In this task, you will learn how to use the 'required' function.

INGRESS_IP environment variable is supposed to be set during the setup. You can always set it this way:

export INGRESS_IP=$(kubectl get svc ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[].ip}')

Inspect the Helm Chart

cd /workspaces/helm/09_required
tree .

Adapt the Deployment to the following

Edit ./my-chart/templates/deployment.yaml file:

---
containers:
  - name: my-nginx
    image: nginx:{{ required "A nginx version is required!" .Values.tag }}

Release the application

Note that you will get an error message.

helm install required ./my-chart

Try again with the tag provided.

helm install required ./my-chart --set tag=1.19.2

Wait until the pods are ready

kubectl wait pod -l app.kubernetes.io/instance=required --for=condition=ready --timeout=120s

Access the endpoint via

curl ${INGRESS_IP}

If you want to reach it via browser, you first need to port-forward ingress-nginx-controller service:

kubectl port-forward svc/ingress-nginx-controller -n ingress-nginx 80

Then, reach via below URLs:

echo "https://${CODESPACE_NAME}-80.app.github.dev/"

Cleanup

# delete the resources
helm uninstall required