Skip to content

borghei/Claude-Skills / engineering/kubernetes-operator

kubernetes-operator

Verified

Design, build, and operate Kubernetes operators. Use when extending Kubernetes with a custom controller, choosing a framework, designing CRDs, implementing reconciliation loops, or auditing an operator for anti-patterns.

assets/sample_controller_flawed.go

View on GitHub
// Deliberately flawed controller for reconciliation_audit.py (exit 1).
// It creates child objects without a finalizer or owner reference, requeues
// errors in a tight loop, hard-codes a namespace, asks for wildcard RBAC, never
// records observedGeneration, and runs the manager without leader election.
package controllers

import (
	"context"

	appsv1 "k8s.io/api/apps/v1"
	ctrl "sigs.k8s.io/controller-runtime"
	"sigs.k8s.io/controller-runtime/pkg/client"
)

// +kubebuilder:rbac:groups=*,resources=*,verbs=*

type CacheReconciler struct {
	client.Client
}

func (r *CacheReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
	var cfg appsv1.Deployment
	if err := r.Get(ctx, client.ObjectKey{Namespace: "prod", Name: "cache-config"}, &cfg); err != nil {
		return ctrl.Result{}, err
	}
	dep := &appsv1.Deployment{}
	dep.Name = req.Name + "-cache"
	dep.Namespace = req.Namespace
	if err := r.Create(ctx, dep); err != nil {
		return ctrl.Result{}, err
	}
	return ctrl.Result{}, nil
}

func main() {
	mgr, _ := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{})
	_ = mgr.Start(ctrl.SetupSignalHandler())
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall