Turn Helm Charts into a Flinkwerk Product
This guide explains how to use open-source Helm charts to create and share a Flinkwerk product in the Flinkwerk Marketplace.
Introduction
What makes Flinkwerk unique is that a Flinkwerk project can easily inherit code and deployment configuration from an existing application. This inheritance mechanism works with Flinkwerk products as well as Helm charts.
Helm charts package applications for deployment on Kubernetes clusters. All of the best open-source applications have been packaged as Helm charts and are publicly available, with over 6,000 of them on Artifacthub. Plus, Flinkwerk takes care of the Kubernetes deployment routines for you.
All of this means that you can quickly build an immediately-deployable custom cloud solution on top of existing Helm charts in Flinkwerk.
Example product
Let's take the open-source NGINX Helm chart provided by Bitnami and turn it into a Flinkwerk product. This chart is available in Artifacthub at https://artifacthub.io/packages/helm/bitnami/nginx.
The benefit of having this NGINX chart available as a product in Flinkwerk Marketplace is that others will be able to inherit it in their Flinkwerk project without going through the configuration steps shown below. Plus, you will have made sure that the Helm chart deploys smoothly in Flinkwerk.
Step 1: Initialize your Flinkwerk project
First, initialize your Flinkwerk project via the Flinkwerk CLI.
Upon intialization, the Flinkwerk Config file and other necessary resources will be created for you in your project root folder.
Make sure you replace my-account
with your Flinkwerk login name in the following initialization command.
flinkwerk init --owner=<my-account> --name=nginx-base
info
Since Git technologies are used under the hood by Flinkwerk CLI, this also creates - if not already present - a local Git repository.
Step 2: Define the Flinkwerk project and product configuration
The following Flinkwerk Config directives define the deployment parameters of your Flinkwerk project as well as the distribution parameters of your Flinkwerk product. Please add them to the .flinkwerk/config.yml
file in your project root.
owner: <my-account>
name: nginx-base
product:
type: app
price: 0
from:
type: helm
sku: bitnami/nginx
repository: "https://charts.bitnami.com/nginx"
global:
review:
type: cluster
sku: flinkwerk/trial
environments:
staging:
cluster: review
Step 3: Configure Helm values
Helm Charts store deployment parameters in so-called Helm values files.
Flinkwerk allows you to dynamically override Helm values. You can do this using the from
configuration field for the Helm charts from which your product inherits.
Most notably, the hostname
Ingress property as defined in the bitnami/nginx
Helm chart must be overwritten. This will enable Flinkwerk to either automatically insert the default Flinkwerk project domain flinkwerk.dev
as a value for hostname
or a custom domain defined by someone using your NGINX product in their project. The respective value will be provided by the environment variable $FLINKWERK_DOMAIN
Create a file .flinkwerk/helm/project.yaml
with the following content:
ingress:
hostname: $FLINKWERK_DOMAIN
enabled: true
Step 4: Test the deployment of your future product
Before you can offer your new product in Flinkwerk Marketplace, you must ensure that you test the deployment of the custom configured Helm chart in Flinkwerk.
The Flinkwerk CLI command deploy
deploys the current Git branch into the environment you defined in .flinkwerk/config.yml
. As you can see there, a staging
environment is configured under the the environments
field. This deploys your project to a cluster named review
which will be provisioned as per the flinkwerk/trial
cluster product. In this example, as no custom domain is configured, the deployed project will be accessible under the default flinkwerk.dev
domain.
Deploy your project to the cluster:
flinkwerk deploy
The NGINX instance configured in your project will be accessible at the URL below (following Flinkwerk's preview URL conventions):
https://main--nginx-base.review.<my-account>.flinkwerk.dev
info
Every change you want to be deployed must first be committed in the (at least locally available) Git repository of your Flinkwerk project.
Step 5: Distribute your product
Finally, you are ready to offer your product in Flinkwerk Marketplace. After this, others will be able to use your product by referencing its SKU, as will be explained later.
This example project has the owner <my-account>
and is named nginx-base
. This arrangement will result in the the product becoming available under the SKU <my-account>/nginx-base
in Flinkwerk Marketplace.
Share your product with just one command:
flinkwerk distribute
Appendix: Third-party usage of your product
As stated above, others will now be able to use your product. To do so, they will first have to initialize a Flinkwerk project, just like you did, but they will use their own Flinkwerk account instead, of course.
flinkwerk init --owner=<other-account> --name=nginx
Next, they configure their project to inherit your product by providing its SKU <my-account>/nginx-base
in the from
field.
owner: <other-account>
name: nginx
from:
type: app
sku: <my-account>/nginx-base
global:
other-review:
type: cluster
sku: flinkwerk/trial
environments:
other-staging:
cluster: other-review
All of this configuration is basically the same as yours, except that users of your product will use their own isolated cluster and environment in their projects.
Once configured, users of your product will execute the command below:
flinkwerk deploy # Deploy the branch to the cluster
They will then be able to access a running instance of your product at the URL below:
https://main--nginx-base.review.<other-account>.flinkwerk.dev
Conclusion
This guide walked you through the steps to quickly build a custom cloud solution on top of existing Helm charts in Flinkwerk. Once you have tried out the steps above, you should be comfortable applying the same steps to your own application development and distribution.
To learn more about the topics discussed in this guide, visit the following pages: