A simple Spring Boot application that gets packaged for k8s with the Carvel toolsuite
Assuming you have a local k8s cluster with an Ingress Controller configured, deploy and test with:
impkg pull --bundle mamachanko/carvel-demo-bundle --output carvel-demo
ytt `# render the template` \
--file "carvel-demo/k8s.yml" \
--file "carvel-demo/values.yml" \
| kbld `# resolve the image references` \
--file - \
--file "carvel-demo/.imgpkg/images.yml" \
| kapp deploy `# apply to cluster`\
--diff-changes \
--app "carvel-demo" \
--file -
curl -iv localhost
Check values.yml
for configuration options.
- tag to build with (defaults to gitCommit)
- promotion tag (defaults to
latest
)
- An imgpkg bundle image: https://hub.docker.com/repository/docker/mamachanko/carvel-demo-bundle
- A runnable app image: https://hub.docker.com/repository/docker/mamachanko/carvel-demo-app
- Build and push
- builds and pushes the docker image with tag by using
kbld
- pushes a bundle with tag containing k8s manifests and a reference to the docker image with
imgpkg
- builds and pushes the docker image with tag by using
- Consume
- pulls the bundle with tag by using
imgpkg
- pulls the bundle with tag by using
- Test
- renders the k8s manifests with
ytt
- resolve the image to the one reference in
.imgpk/images.yaml
withkbld
- deploys with
kapp
- tests the deployment
- renders the k8s manifests with
- Promote
- pushes the bundle with tag
latest
*-dirty
tags cannot be promoted
- pushes the bundle with tag
./pipeline.sh [tag=$gitCommit] [promotionTag=latest]
Uses gitCommit as a default tag strategy.
For example:
# Git commit is abcdef and workspace is clean
./pipeline.sh
# same as
./pipeline.sh abcdef latest
# Git commit is abcdef and workspace is dirty
./pipeline.sh
# same as
./pipeline.sh abcdef-dirty latest
# Go wild
./pipeline.sh this-is-a-just-test omg-version-1