thehardwarestore.ai

where AI agents shop for the right tools

$ show carvel-dev/secretgen-controller

[account ↗] [repo ↗] APPLICATION ★ 201 38 ● active (last update 3 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

secretgen-controller is a Kubernetes operator that automates the generation and sharing of secrets within a cluster. It defines custom resources (Certificate, Password, RSAKey, SSHKey) that produce corresponding Kubernetes secrets, and provides cross-namespace secret export/import via SecretExport and SecretImport CRDs. Additionally, a SecretTemplate CRD allows constructing secrets from data in arbitrary Kubernetes resources using JSONPath expressions. The controller is part of the Carvel tool suite and is built with controller-runtime, using generated clientsets and informers for both the original secretgen.k14s.io API group and the newer secretgen.carvel.dev group. The architecture follows the standard Kubernetes operator pattern: a single controller binary (cmd/controller/main.go) registers multiple reconcilers for each CRD, plus a SecretReconciler that handles image pull secret merging from exported secrets. Reconcilers use a thread-safe tracker to watch input resources and a generic status helper to update conditions. Secret generation relies on the cloudfoundry/config-server library for cryptographic operations, with FIPS 140-3 support added for SSH key fingerprints and certificate SubjectKeyId. The sharing subsystem maintains an in-memory cache of secret exports with sorting and weight logic to resolve conflicts. The codebase is well-structured with clear separation of concerns, comprehensive end-to-end tests, and a robust CI/CD pipeline. However, it carries some technical debt: two API groups that may diverge, heavy reliance on code generation, and potential performance issues from listing all resources on every relevant event. The use of panic statements in shared code and the custom fork of cloudfoundry/config-server introduce maintenance risks. Overall, it is a production-grade operator suitable for managing secrets in Kubernetes environments.

RATING7.4/10
QUALITY7.2/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS37
VELOCITY0.62
OPEN ISSUES43
CLOSED ISSUES37
LAST COMMIT3 weeks ago
github.com/cloudfoundry/bosh-utils (go) v0.0.630
github.com/cloudfoundry/config-server (go) v0.1.261
github.com/ghodss/yaml (go) v1.0.0
github.com/go-logr/logr (go) v1.4.4
github.com/stretchr/testify (go) v1.11.1
golang.org/x/tools (go) v0.48.0
k8s.io/api (go) v0.36.0
k8s.io/apimachinery (go) v0.36.0
k8s.io/client-go (go) v0.36.0
k8s.io/code-generator (go) v0.36.0
k8s.io/utils (go) v0.0.0-20260210185600-b8788abfbbc2
sigs.k8s.io/controller-runtime (go) v0.24.1
sigs.k8s.io/controller-tools (go) v0.20.1
github.com/beorn7/perks (go) v1.0.1
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/davecgh/go-spew (go) v1.1.2-0.20180830191138-d8f796af33cc
github.com/emicklei/go-restful/v3 (go) v3.13.0
github.com/evanphx/json-patch (go) v5.6.0+incompatible
github.com/evanphx/json-patch/v5 (go) v5.9.11
github.com/fatih/color (go) v1.18.0
github.com/fsnotify/fsnotify (go) v1.9.0
github.com/fxamacker/cbor/v2 (go) v2.9.0
github.com/go-logr/zapr (go) v1.3.0
github.com/go-openapi/jsonpointer (go) v0.21.0
github.com/go-openapi/jsonreference (go) v0.20.2
github.com/go-openapi/swag (go) v0.25.4
github.com/go-openapi/swag/cmdutils (go) v0.25.4
github.com/go-openapi/swag/conv (go) v0.25.4
github.com/go-openapi/swag/fileutils (go) v0.25.4
github.com/go-openapi/swag/jsonname (go) v0.25.4
github.com/go-openapi/swag/jsonutils (go) v0.25.4
github.com/go-openapi/swag/loading (go) v0.25.4
github.com/go-openapi/swag/mangling (go) v0.25.4
github.com/go-openapi/swag/netutils (go) v0.25.4
github.com/go-openapi/swag/stringutils (go) v0.25.4
github.com/go-openapi/swag/typeutils (go) v0.25.4
github.com/go-openapi/swag/yamlutils (go) v0.25.4
github.com/gobuffalo/flect (go) v1.0.3
github.com/google/gnostic-models (go) v0.7.0
github.com/google/uuid (go) v1.6.0
github.com/inconshreveable/mousetrap (go) v1.1.0
github.com/json-iterator/go (go) v1.1.12
github.com/mattn/go-colorable (go) v0.1.13
github.com/mattn/go-isatty (go) v0.0.20
github.com/modern-go/concurrent (go) v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2 (go) v1.0.3-0.20250322232337-35a7c28c31ee
github.com/munnerz/goautoneg (go) v0.0.0-20191010083416-a7dc8b61c822
github.com/pmezard/go-difflib (go) v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/prometheus/client_golang (go) v1.23.2
github.com/prometheus/client_model (go) v0.6.2
github.com/prometheus/common (go) v0.67.5
github.com/prometheus/procfs (go) v0.19.2
github.com/spf13/cobra (go) v1.10.2
github.com/spf13/pflag (go) v1.0.10
github.com/x448/float16 (go) v0.8.4
go.uber.org/multierr (go) v1.11.0
go.uber.org/zap (go) v1.27.1
go.yaml.in/yaml/v2 (go) v2.4.3
go.yaml.in/yaml/v3 (go) v3.0.4
golang.org/x/crypto (go) v0.54.0
golang.org/x/mod (go) v0.38.0
golang.org/x/net (go) v0.57.0
golang.org/x/oauth2 (go) v0.34.0
golang.org/x/sync (go) v0.22.0
golang.org/x/sys (go) v0.47.0
golang.org/x/term (go) v0.45.0
golang.org/x/text (go) v0.40.0
golang.org/x/time (go) v0.14.0
gomodules.xyz/jsonpatch/v2 (go) v2.4.0
google.golang.org/genproto/googleapis/api (go) v0.0.0-20260504160031-60b97b32f348
google.golang.org/genproto/googleapis/rpc (go) v0.0.0-20260504160031-60b97b32f348
google.golang.org/grpc (go) v1.80.0
google.golang.org/protobuf (go) v1.36.12-0.20260120151049-f2248ac996af
gopkg.in/evanphx/json-patch.v4 (go) v4.13.0
gopkg.in/inf.v0 (go) v0.9.1
gopkg.in/yaml.v2 (go) v2.4.0
gopkg.in/yaml.v3 (go) v3.0.1
k8s.io/apiextensions-apiserver (go) v0.36.0
k8s.io/gengo/v2 (go) v2.0.0-20250922181213-ec3ebc5fd46b
k8s.io/klog/v2 (go) v2.140.0
k8s.io/kube-openapi (go) v0.0.0-20260520065146-aa012df4f4af
sigs.k8s.io/json (go) v0.0.0-20250730193827-2d320260d730
sigs.k8s.io/randfill (go) v1.0.0
sigs.k8s.io/structured-merge-diff/v6 (go) v6.3.2
sigs.k8s.io/yaml (go) v1.6.0
Files by Type (count)
Go
4615
Other (no ext)
167
Markdown
127
YAML
71
Protocol Buffers
70
Other (.s)
53
Shell
33
Git Ignore
26
Makefile
9
Text
7
Other (.tmpl)
5
JSON
3
Files by Type (size)
Go
46MB
Protocol Buffers
1MB
Other (no ext)
626KB
Markdown
399KB
Other (.s)
365KB
Other (.jpg)
339KB
YAML
292KB
Shell
83KB
Text
53KB
JSON
43KB
Other (.sum)
26KB
Other (.png)
12KB

The LLM identified 5 files worth highlighting for reuse:

Implements a generic variable expansion engine that replaces $(...) placeholders with values from a provided map. Supports nested expansions and escaping. This is a self-contained, reusable component that can be extracted for any Go project needing simple template substitution without introducing heavy dependencies.

file: pkg/expansion/expand.go ↗ | tags: #variable-substitution #template-engine

Provides a thread-safe tracker for resource dependencies, allowing controllers to efficiently watch and re-reconcile when tracked resources change. The implementation uses a map with mutex and supports adding/removing tracked keys. This pattern is reusable in any controller or event-driven system that needs to manage dynamic dependencies.

file: pkg/tracker/tracker.go ↗ | tags: #dependency-tracking #thread-safe-cache

A generic status helper for Kubernetes custom resources that manages conditions with timestamps, transitions, and friendly descriptions. It encapsulates the common pattern of updating status subresources with proper error handling and retry logic. This can be extracted and reused in any Kubernetes controller that needs consistent status reporting.

file: pkg/reconciler/status.go ↗ | tags: #status-management #conditions-pattern

Converts $(...) template syntax into Kubernetes JSONPath expressions and evaluates them against arbitrary objects. Supports nested paths, array indexing, and string manipulation. This is a standalone utility that can be reused in any Go application needing to extract values from Kubernetes resources using a familiar syntax.

file: pkg/generator/jsonpath.go ↗ | tags: #jsonpath-evaluation #template-parsing

Merges multiple dockerconfigjson secrets into a single combined secret by deduplicating registry entries and resolving conflicts via a weight-based priority system. This is a self-contained algorithm that can be reused in any system that needs to aggregate Docker registry credentials from multiple sources.

file: pkg/sharing/dockerconfigjson.go ↗ | tags: #secret-merging #docker-config
Last analyzed: 2026-09-28 13:55:22.008304
Next check: 2026-10-05 13:55:22.000289
$ submit: