Cloud Foundry brings a time-tested and proven developer experience to Kubernetes. It provides a modern means to deploy and operate applications running on Kubernetes-based infrastructure. Developers can use Cloud Foundry to deploy web applications built using any language or framework. Support for all the languages is available because of the use of Buildpacks internally to build immutable artifacts, in the form of OCI-compatible containers, from source code.
What are Container Registries?
A Container Registry is a space that helps users store and distribute container images. Typically, it is a collection of images built from a source, meant to be deployed to a container runtime. It is a cloud-based analog of the registry available locally. Hosting Container Registries enables software development teams to shift to a cloud-native means of CI/CD, application deployment, and general production excellence.
What is GitLab Container Registry?
The GitLab set of tools includes a container registry. It is a hosted registry built with open source tools that are secure and private. It can host OCI-compatible images and provides a fully-featured integration with GitLab. This allows users to manage all their GitLab DevOps tooling in one space. It is available in their free tier (as of this writing).
How does Cloud Foundry use GitLab Container Registries?
In order to deploy an app using Cloud Foundry, the command <cf push> is used.
Internally, this <cf push> command triggers a process that builds immutable artifacts in the form of OCI-compatible containers. Cloud Foundry uses buildpacks in order to generate these containers. Once built, the images are exported to a container registry specified when installing/configuring the Cloud Foundry instance over Kubernetes (using cf-for-k8s).
Users of Cloud Foundry have a choice in specifying which container registry they would like to use. Common choices are Docker Hub and Google Container Registry. For those using GitLab for their source code management, CI/CD, and another DevOps tooling, a natural choice available is the GitLab Container Registry.
What are the benefits of using GitLab Container Registries with Cloud Foundry?
- Organize all container images and deploy using cf push by simply referencing the image (and tags) within the container registry.
- Make use of GitLab Runner workflows to automate the process of creating images to be stored in the container registry.
- Allow your teams (already configured on GitLab) to collaborate around the container registry and optimize developer experience by reusing container layers.
How to integrate Cloud Foundry with the GitLab Container Registry?
You will need to first create an account on GitLab if you don’t have one. Create a Personal Access Token with read_registry and write_registry included in the scope for it.
When installing cf-for-k8s on your Kubernetes clusters, including the following values to an intermediary YAML file which will then be used to generate the final declarative syntax for the installation (cf-values.yml in the installation instructions) —
app_registry:
hostname: https://registry.gitlab.com
repository_prefix: "registry.gitlab.com/<username>/<project-name>"
username: "<username>"
password: "<personal-access-token>"
In summary, making use of the GitLab container registry along with Cloud Foundry can help transform your development practices into a modern and cloud-native one.