k8s / Helm / GitOps
The k8s group turns your declarative workspace config
(re-shell.workspaces.yaml, v2) into deployment artifacts: Kubernetes manifests,
Helm charts, GitOps resources, a CRD and operator, and service-mesh configuration,
plus a rollback command for a running cluster.
re-shell k8s --help| Subcommand | Purpose |
|---|---|
generate |
Deployment, Service, HPA, NetworkPolicy and PodDisruptionBudget per service. |
helm generate |
A Helm chart (Chart.yaml, values.yaml, templates/). |
gitops generate |
ArgoCD Application or Flux resources, plus cert-manager TLS ingress. |
rollback <service> |
Roll a workload back (kubectl rollout undo, or helm rollback). |
crd |
The ReShellWorkspace CustomResourceDefinition and a sample resource. |
operator |
A Go (controller-runtime) operator that reconciles that CRD. |
mesh |
Istio or Linkerd resources (injection, mTLS, traffic policy). |
hpa, network-policy, pod-security, ingress, cluster, multi-cluster, multi-tenant, cicd |
Standalone generators; run --help. |
Every generator takes --out <dir>, --dry-run (render without writing) and
--json. Failures carry K8S_GENERATE_ERROR, HELM_GENERATE_ERROR or
GITOPS_GENERATE_ERROR.
Hardened by default
Section titled “Hardened by default”Generated workloads are written to pass the Pod Security Standard restricted
profile. Unless the workspace config says otherwise:
runAsNonRoot: truewith a non-zero uid (a config that setsrunAsNonRootand uid 0 is rejected),automountServiceAccountToken: false;readOnlyRootFilesystem: true(writable paths becomeemptyDirmounts), all capabilities dropped, no privilege escalation,RuntimeDefaultseccomp;- a rolling update that never drops below the desired replicas, a
PodDisruptionBudget, default-deny NetworkPolicy with intra-namespace allows; - probes and resource requests/limits as declared in the config.
k8s generate
Section titled “k8s generate”re-shell k8s generate --dry-run # render, write nothingre-shell k8s generate --out ./k8s --namespace acme # write manifestsre-shell k8s generate --jsonk8s helm generate
Section titled “k8s helm generate”re-shell k8s helm generate --out ./charts/appThe chart’s values.yaml carries per-service image, replicas, port, env, resources
and the pod security context, plus ingress and TLS settings.
k8s gitops generate
Section titled “k8s gitops generate”re-shell k8s gitops generate --tool argocd --repo-url https://github.com/acme/platform.gitre-shell k8s gitops generate --tool flux --repo-url https://github.com/acme/platform.git --chart-path ./charts/appre-shell k8s gitops generate --tool flux --source manifests # reconcile raw manifests instead of the chart--source chooses what the tool reconciles: helm (default; Flux gets a
GitRepository plus a HelmRelease with Helm remediation, so a failed release
is rolled back by Flux) or manifests (Flux Kustomization). --revision sets the
branch (default main).
k8s rollback
Section titled “k8s rollback”re-shell k8s rollback billing --namespace prod # previous revisionre-shell k8s rollback billing --to-revision 3 --method helm --release billingre-shell k8s rollback billing --dry-run --json--method auto (default) detects whether the Deployment belongs to a Helm release.
It waits for the rolled-back workload to become ready (--timeout, default 300 s) and
exits non-zero on any failure, including a rollout that never becomes ready.
--context selects a kubeconfig context.
k8s crd, k8s operator, k8s mesh
Section titled “k8s crd, k8s operator, k8s mesh”These are driven by the workspace config, not by a project name.
re-shell k8s crd --out ./crd # ReShellWorkspace CRD (schema derived from the v2 schema) + sample CRre-shell k8s operator --out ./operator --verify # Go operator; --verify runs go mod tidy, go build, go vetre-shell k8s mesh --mesh linkerd --namespace prod --out ./meshThe operator reconciles a ReShellWorkspace into Deployments and Services. --verify
fails if Go is missing or the build fails. The standalone script generators these
commands used to be are still available behind --legacy <project-name>.
What was verified
Section titled “What was verified”- Unit tests cover the manifest, chart, GitOps, CRD, operator, mesh and rollback generators.
- A live cluster.
scripts/k8s-live-check.shvalidates the generators against a real cluster (KUBECONFIG): it generates everything from a fixture workspace, runshelm lint --strictandhelm template, validates every manifest withkubeconform, applies the manifests into a namespace enforcing Pod Securityrestricted, waits for rollout, upgrades to a broken image, runsre-shell k8s rollback(kubectl and Helm) and checks recovery, installs the CRD and validates good and bad custom resources, and builds and runs the Go operator. Steps 1 to 8 ran against a local k3s cluster during development. - Not run locally: the Flux (and Argo CD) sync step. It needs registry egress that
the development environment blocks. It runs in the
k8s-liveworkflow against akindcluster (the workflow passes on GitHub, PR #395); Argo CD is not installed there, so the ArgoApplicationmanifest is validated against its CRD schema withkubeconformonly.
Related: cloud, observe, security
Section titled “Related: cloud, observe, security”- cloud: Terraform generation for AWS, Azure and GCP.
- observe: metrics, tracing, logging, alerting.
- security: scanning, policy-as-code, compliance.
See also
Section titled “See also”- Architecture: Monorepo: where the v2 workspace config lives.
- JSON Contract: error codes.