Skip to content

Commit 117d29f

Browse files
committed
Temp
Signed-off-by: Kim Christensen <[email protected]>
1 parent 4406d59 commit 117d29f

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed

CLAUDE.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a Kubernetes secrets plugin for [Porter](https://getporter.sh), a cloud-native application management tool. The plugin enables Porter to use Kubernetes secrets as a source for CredentialSets and stores sensitive data (parameter or output values) as secrets in Kubernetes clusters.
8+
9+
**Key Components:**
10+
- **Secrets Plugin**: Primary functionality for managing secrets in Kubernetes clusters
11+
- **Porter Integration**: Implements Porter's plugin interface for secrets management
12+
- **Kubernetes Client**: Direct integration with Kubernetes API for secret operations
13+
- **Dual Environment Support**: Works both inside and outside Kubernetes clusters
14+
15+
## Development Commands
16+
17+
### Build and Test
18+
```bash
19+
# Build the plugin
20+
mage Build
21+
22+
# Run all tests (unit + integration)
23+
mage Test
24+
25+
# Run only unit tests
26+
mage TestUnit
27+
28+
# Run local integration tests (using local Porter command)
29+
mage TestLocalIntegration
30+
31+
# Run operator integration tests (using Porter Operator)
32+
mage TestIntegration
33+
34+
# Cross-compile for all platforms
35+
mage XBuildAll
36+
```
37+
38+
### Development Environment Setup
39+
```bash
40+
# Install mage build tool
41+
go run mage.go ConfigureAgent
42+
43+
# Format code
44+
mage Fmt
45+
46+
# Vet code
47+
mage Vet
48+
49+
# Install plugin to local Porter environment
50+
mage Install
51+
52+
# Clean build artifacts and test clusters
53+
mage Clean
54+
```
55+
56+
### Testing Infrastructure
57+
```bash
58+
# Ensure KIND test cluster is running
59+
mage tests.EnsureTestCluster
60+
61+
# Deploy Porter Operator to test cluster
62+
mage DeployOperator
63+
64+
# Remove Porter Operator from test cluster
65+
mage DeleteOperator
66+
67+
# Setup namespace for testing
68+
mage SetupNamespace <namespace-name>
69+
70+
# Clean test data from clusters
71+
mage CleanTestdata
72+
```
73+
74+
## Architecture
75+
76+
### Plugin Structure
77+
- `cmd/kubernetes/`: Main plugin entry point and CLI commands
78+
- `pkg/kubernetes/`: Core plugin implementation
79+
- `config/`: Configuration handling for plugin settings
80+
- `secrets/`: Kubernetes secrets store implementation
81+
- `helper/`: Kubernetes client utilities
82+
- `mage/setup/`: Build and setup utilities
83+
- `tests/`: Integration and unit tests
84+
- `integration/local/`: Tests for local Porter command usage
85+
- `integration/operator/`: Tests for Porter Operator usage
86+
87+
### Key Interfaces
88+
- **SecretsProtocol**: Main plugin interface for Porter secrets operations
89+
- **Store**: Kubernetes secrets backend implementation
90+
- **Plugin**: HashiCorp go-plugin wrapper for Porter integration
91+
92+
### Configuration
93+
The plugin supports two deployment modes:
94+
1. **In-cluster**: Automatically detects namespace when running inside Kubernetes
95+
2. **Out-of-cluster**: Requires namespace configuration and kubeconfig access
96+
97+
### Dependencies
98+
- **Porter Framework**: v1.2.1 - Application packaging and deployment
99+
- **Kubernetes Client**: v0.32.1 - Direct K8s API interaction
100+
- **HashiCorp go-plugin**: Plugin architecture foundation
101+
- **CNAB**: Cloud Native Application Bundle specifications
102+
103+
## Testing Strategy
104+
105+
### Local Integration Tests
106+
- Tests Porter command execution with the plugin
107+
- Uses KIND cluster with local namespace isolation
108+
- Validates secret creation, retrieval, and credential resolution
109+
110+
### Operator Integration Tests
111+
- Tests plugin functionality within Porter Operator environment
112+
- Uses Ginkgo test framework for structured testing
113+
- Validates end-to-end installation workflows with Kubernetes secrets
114+
115+
### Test Requirements
116+
- KIND cluster for Kubernetes testing
117+
- Docker for container operations
118+
- Local Porter binary for integration testing
119+
- Ginkgo for operator integration tests
120+
121+
## Security Considerations
122+
123+
- Plugin requires `get`, `list`, `create`, `delete`, and `patch` permissions on secrets
124+
- Supports both service account (in-cluster) and kubeconfig (out-of-cluster) authentication
125+
- Secret values are stored with `value` key in Kubernetes secret data
126+
- Namespace isolation enforced for multi-tenant environments

magefile.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ func verifyVersionStamp() {
196196
func TestLocalIntegration() {
197197
mg.Deps(Build)
198198

199+
// Ensure cluster connection is available
200+
if !useCluster() {
201+
mgx.Must(fmt.Errorf("no test cluster available"))
202+
}
203+
199204
ctx, _ := kubectl("config", "current-context").OutputV()
200205
testLocalIntegration()
201206

0 commit comments

Comments
 (0)