Request A Demo
Back to All Blog Articles

FlexDeploy loves Functions: Deploy Docker Containers with Fn Functions

This is the third article in the series on what makes FlexDeploy a perfect fit for container native technologies:

In this post I am going to show how FlexDeploy can use Fn Project functions to make this world better. FlexDeploy is going to deploy Docker containers to a K8s cluster with an Fn function by the means of this simple workflow:

In one of the previous posts of this series I showed how we can implement the Deploy step with kubectl, which is a K8s command line tool. That solution would work fine if we have a preconfigured end point capable of executing the deployment step. The endpoint should have preinstalled kubectl and it should have been preconfigured with K8s cluster credentials (or K8s contexts) for all environments (Dev, Test and Prod) where this workflow can deploy to. The idea of this post is to create a Docker container serving as an end point like that. So, I am going to package kubectl and my K8s cluster credentials into a container and use it to deploy stuff to K8s clusters. Having done that, we don’t depend on the endpoint anymore, we just need Docker. But in order to feel like a truly free man I am going to create an Fn function on top of this “deployer” container, so I don’t depend on Docker either. The details on how to create the deployer container and a function on top of it are available here.

So, let’s configure FlexDeploy to work with the deployer Fn function. The Deploy step of our workflow is a Shell plugin operation and it has the following code snippet:

curl $FN_APP_URL/deploy -d "$K8S_CONTEXT $DOCKER_IMAGE:$FD_PROJECT_VERSION"

It invokes a function on an Fn application passing two parameters: K8s context name (where to deploy) and Docker image name including tag version (what to deploy). The Fn application can be running anywhere you want on prem or in the cloud. If you prefer, you can run it on top of K8s cluster in the cloud as it is described here.

The function call relies on the following properties:

  • FN_APP_URL . This is an environment-instance workflow property referring to URL of Fn application. E.g. http://35.225.120.22:80/r/k8sdeployer
  • K8S_CONTEXT. This is an environment-instance workflow property providing name of the K8s context. The K8s context defines the target K8s cluster and credentials for it. E.g. context-gcloud1560-dev.
  • DOCKER_IMAGE. This is a project scoped workflow property containing name of the Docker image which is being deployed. The full name of the image includes tag version referring to the project version. E.g. eugeneflexagon/jsfrontend:1.0.23

Obviously, we don’t need any special end point for this workflow step. It can be easily executed on localhost.

Summary

In this simple example we demonstrated how FlexDeploy can leverage the power of serverless paradigm implemented by Fn Project. The deployment workflow is abstracted away from the end point infrastructure. The beauty of this solution is that the consumer of the function, the workflow step, just uses Rest API over http to get the application deployed and it does not care how and where this job will be done. But the workflow knows for sure that computing resources to execute the Deploy step will be utilized no longer than it is needed to get the job done.

That’s it!

Previous Post: Enrich Oracle Container Native Application Development Platform with FlexDeploy Pipelines

Next Post: FlexDeploy Loves Functions: Build Docker Containers with Fn Functions

Related Resources

Mastering Source Control: Streamlining Functional Setup Data Sync with FlexDeploy and Git Integration in Oracle FSM

Effective source control management (SCM) is pivotal in ensuring the seamless tracking and management of functional setup data. In this ...

Oracle Integration Cloud – Migrate Integrations, Connections and Lookups

Oracle Integration Cloud (OIC) serves as a unified platform for seamlessly integrating cloud and on-premises applications. FlexDeploy, a robust DevOps ...

Unlocking Precision in Oracle SaaS FSM: Dive into FlexDeploy’s Filter Criteria for Effortless Setup Migration

While Oracle’s Functional Setup Manager (FSM) UI facilitates export/import operations for transferring setups across environments, the process demands manual initiation, ...

Join DevOps leaders across the globe who receive analysis, tips, and trends in their inbox