GitOps with NSX Advanced Load Balancer and Jenkins

GitOps

GitOps, a term coined in 2017, describes the practice of performing infrastructure operations from a Git repository. In this practice, we easily develop the ability to re-deploy any broken infrastructure (like application managers), but that doesn’t really help infrastructure engineers.

From the perspective of an Infrastructure Engineer, Git has a great deal to offer us:

Applying GitOps

GitOps Summary

On Tooling

Before visiting this individual implementation, none of these tools are specific or non-replaceable. The practice is what matters more than the tooling, and there are many equivalents here:

GitOps is pretty easy to implement (mechanically speaking). Any code designed to deploy infrastructure will execute smoothly from source control when the CI tooling is completely set up. All of the examples provided in this article are simple and portable to other platforms.

On Practice

This is just an example to show how the work can be executed. The majority of the work in implementing GitOps lies with developing release strategy, testing, and peer review processes. The objective is to improve reliability, not to recover an application if it’s destroyed.

It does help deploy consistently to new facilities, though.

Let’s go!

Since we’ve already developed the code in a previous post, most of the work is already completed - the remaining portion is simply configuring a CI tool to execute and report.

A brief review of the code (https://github.com/ngschmidt/python-restify/blob/main/nsx-alb/apply_idempotent_profiles.py) shows it was designed to be run headless and create application profiles. Here are some key features for pipeline executed code to keep in mind:

Pipeline Execution

Here’s the plan. It’s an (oversimplified) example of a CI/CD pipeline - we don’t really need many of the features required by a CI tool here:

The configuration is not particularly complex because the code is designed for it:

Jenkins SCM

Jenkins Bindings

Jenkins Build Triggers

Jenkins Build Actions

This will perform unit testing first, then execute and provide a report on what changed.

Building from Code

The next phase to GitOps would be branch management. since the production or main branch now represents production, it’s not particularly wise to simply commit to it when we attempt to create a new feature or capability. We’re going to prototype next:

python3 -m restify -f nsx-alb/settings.json get_tls_profile --vars '{\"id\": \"clienttls-prototype-v0.1.0\"}' 

After the application, we’ll see the generated profiles here:

Avi Profiles

What’s the difference?

When discussing this approach with other infrastructure engineers, the answer is “not much”. GitOps is not useful without good practice. GitOps, put simply, makes disciplined process easier:

To summarize, I just provided a tool-oriented example, but the discipline and process is what matters. The same process would apply to:

The only thing missing is more systems with declarative APIs.