Skip to content

feat: linuxaid-agent operator + masterless puppet apply on Kubernetes nodes#1

Open
ashish1099 wants to merge 8 commits into
mainfrom
worktree-linuxaid-enforce
Open

feat: linuxaid-agent operator + masterless puppet apply on Kubernetes nodes#1
ashish1099 wants to merge 8 commits into
mainfrom
worktree-linuxaid-enforce

Conversation

@ashish1099

Copy link
Copy Markdown
Member

Run LinuxAid on Kubernetes nodes without a puppetserver.

  • linuxaid-agent operator: daemon creating one agent Job per node every interval (default 4h); --node <name> for a one-off run, skipped if the node's Job already exists.
  • run-openvox --apply: masterless puppet apply from a control-repo clone pinned to a tag, with the chart values as the global hiera layer.
  • linuxaid-agent helm chart (deploy/chart/linuxaid-agent): linuxaid.tag pins the checkout and is injected as common::system::openvox::environment; free-form hiera: values become the per-cluster node data.

Tracking: Obmondo/KubeAid#68

run-openvox has always run report-only (`puppet agent -t --noop`),
even though puppet.conf unconditionally sets `noop = true`. There was
no way to actually apply changes through the CLI itself.

Add an opt-in --enforce flag: when set, run-openvox runs
`puppet agent -t --no-noop --detailed-exitcodes` instead, which
overrides the config-level noop setting and applies changes. Default
behavior (flag unset) is unchanged. The connectivity gate, ServerPing,
and last-run-report wrapper around the puppet invocation are
untouched.

This flag is consumed by the launcher image added in this branch
(Dockerfile / deploy/entrypoint.sh), which gates it behind an ENFORCE
env var and defaults to report-only.
Adds a multi-stage Dockerfile that builds the static linuxaid-cli
binary and packages it into a minimal alpine runtime (bash +
util-linux for nsenter). The image is a delivery/scheduling shell
only: deploy/entrypoint.sh stages the binary onto the host and runs
the agent inside the host's namespaces via nsenter, because
package/user/sudo management must happen on the host, not inside the
container.

The entrypoint installs a pre-signed obmondo-clientcert (mounted into
the pod) into the host's puppet SSL tree under CERTNAME, writes a
minimal puppet.conf, and runs run-openvox, gating the --enforce flag
added in the previous commit behind an ENFORCE env var (default false,
report-only). The image ships no linuxaid-install — the cert is
provided pre-signed, so there is nothing to enroll — and fails fast if
the openvox agent isn't already installed on the host.

Intended to run as a per-node Kubernetes Job with hostPID and
privileged/CAP_SYS_ADMIN for nsenter, and /opt/obmondo hostPath mounted
for binary staging.
Add cmd/linuxaid-agent, an in-cluster controller that lists nodes over the k8s REST API (SA token + CA, no client-go) and creates one per-node agent Job each run; a deterministic name means a still-running Job is skipped (no-concurrency).

Split the image build: Dockerfile builds the host agent (linuxaid-cli + nsenter entrypoint), Dockerfile.launcher builds the minimal non-root linuxaid-agent controller.
…aemon

The operator reconciles one agent Job per node immediately and then every
--interval (default 4h), re-reading the rotated SA token per request. A
single node can be triggered on demand with --node <name>, which skips
cleanly when that node's Job already exists.
--apply compiles the catalog locally from the cloned control-repo
(--environmentpath/--openvox-environment) with the Helm-values data as the
global hiera layer (--hiera-config), skipping puppetserver resolution and
connectivity gating. Exit-code policy is shared with agent mode.
…es-as-hiera

Apply mode (CONTROL_REPO_URL set) shallow-clones the repo at
CONTROL_REPO_REF into the /opt/obmondo hostPath, stages the mounted
ConfigMap values and a generated global-layer hiera.yaml next to it, and
runs linuxaid-cli run-openvox --apply on the host. Agent mode is unchanged;
the runtime image gains git and openssh-client for the in-container clone.
linuxaid.tag pins the control-repo checkout and is injected into the
rendered hiera ConfigMap as common::system::openvox::environment; the
free-form hiera block is the cluster-wide node data. Templates cover the
operator Deployment and its ServiceAccount/RBAC (nodes get+list, jobs
create).
OBMONDO_SKIP_CONNECTIVITY_METRICS disables writing the .prom textfile on
hosts without the node_exporter textfile collector (e.g. Kubernetes nodes),
so a failed write cannot abort the run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant