six-group / six-group/haproxy-operator

Proposal: Pre-validate haproxy.cfg before Secret update using a short-lived Job

Open
#234 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29
Forks
9
Avg merge
23h 55m
Merged PRs (30d)
16

Description

Hi !

To improve the safety and reliability of the Operator, I'm currently considering implementing the mechanism described below.
Would you be open to accepting a pull request for this once I have it ready?

If this approach doesn't align with the project's design direction, please feel free to reject the idea—no worries at all!

Configuration Validation Before Secret Update

Before the operator updates the runtime configuration Secret (<instance>-haproxy-config), it validates the generated haproxy.cfg using a short-lived Kubernetes Job:

  1. Build the generated haproxy.cfg and all referenced certificate/config files.

  2. Create a temporary validation Secret.

  3. Start a short-lived Job using the same image as the target HAProxy instance (spec.image, fallback haproxy:latest) and run:

    haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg

  4. If validation succeeds, update the runtime configuration Secret.

  5. If validation fails, do not update the runtime configuration Secret, and set the Error status on the Instance and related configuration resources.

  6. Clean up temporary validation resources (Job and Secret) automatically (via TTL) and explicitly by the operator.

Looking forward to hearing your thoughts!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the operator reconciliation path that generates haproxy.cfg and updates the runtime configuration Secret, then review how Instance and related configuration resources receive Error status. Define the validation Job and temporary Secret lifecycle, including success, failure, TTL, and explicit cleanup; done means invalid configurations leave the runtime Secret unchanged while valid ones update it safely.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.