Example#

This section tries to give a full picture example of how chartpress is used.

Note

The files used in this sections are available in minimal-working-example.zip.

Requirements#

The following binaries must be in your PATH:

Project structure#

.
├── chartpress.yaml
├── Dockerfile
├── helm
│   └── minimal-working-example
│       ├── Chart.yaml
│       ├── templates
│       │   └── deployment.yaml
│       └── values.yaml
└── README.md

Building#

During building, chartpress will

  • re-write the Helm chart version

  • create a new container image

  • re-write the Helm values with the new container image tag

To build, run

chartpress

Note

During development, it is recommended to configure the Docker context to be the same used by the Kubernetes cluster.

Installing#

Note

Remember to verify the Kubernetes context that you are using with

kubectl config get-contexts

If the Kubernetes context is incorrect, select the correct context with

kubectl config use-context CONTEXT_NAME

where CONTEXT_NAME is the name of the correct context.

Installing is a step that does not involve chartpress. To install, run

helm upgrade \
    minimal-working-example \
    ./helm/minimal-working-example \
    --create-namespace \
    --force \
    --install

If the installation goes well, you will have a pod running.

kubectl get pods
NAME                                       READY   STATUS    RESTARTS   AGE
minimal-working-example-78b6b8b87c-lhbl9   1/1     Running   0          2m52s

Cleaning#

First, uninstall the Helm release.

helm uninstall \
    minimal-working-example

Last, undo the changes in the Helm chart.

chartpress --reset