Skip to content

Commit f1e956d

Browse files
committed
Updated plugin.yaml file after replacing deprecated configurations
1 parent 22fd591 commit f1e956d

File tree

5 files changed

+176
-69
lines changed

5 files changed

+176
-69
lines changed

docs/ADRs/001-helm-values-manager.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,107 @@ We have decided to implement the **Helm Values Manager** as a **Helm plugin writ
2626

2727
## YAML Structure
2828

29+
The configuration follows this structure:
30+
2931
```yaml
32+
version: "1.0" # Schema version
3033
release: my-release
3134

3235
deployments:
3336
dev:
3437
secrets_backend: aws_secrets_manager
38+
secrets_config:
39+
region: us-west-2
40+
secret_prefix: "/dev/myapp/"
41+
auth:
42+
type: env # Use AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
43+
# Alternative: type: file, path: "~/.aws/credentials"
44+
# Alternative: type: direct
45+
# access_key_id: "AKIA..."
46+
# secret_access_key: "xyz..."
47+
48+
staging:
49+
secrets_backend: google_secret_manager
50+
secrets_config:
51+
project_id: "my-gcp-project"
52+
secret_prefix: "myapp-staging-"
53+
auth:
54+
type: file
55+
path: "/path/to/gcp-service-account.json"
56+
# Alternative: type: env, credential_env: "GOOGLE_APPLICATION_CREDENTIALS"
57+
# Alternative: type: direct
58+
# credentials_json: "{...}"
59+
3560
prod:
3661
secrets_backend: azure_key_vault
62+
secrets_config:
63+
vault_url: "https://my-prod-vault.vault.azure.net"
64+
auth:
65+
type: managed_identity # Use Azure Managed Identity
66+
# Alternative: type: service_principal
67+
# tenant_id: "${AZURE_TENANT_ID}"
68+
# client_id: "${AZURE_CLIENT_ID}"
69+
# client_secret: "${AZURE_CLIENT_SECRET}"
70+
71+
local:
72+
secrets_backend: git_secret
73+
secrets_config:
74+
gpg_key: "${GPG_KEY}" # GPG key for decryption
75+
secret_files_path: "./.gitsecret" # Path to git-secret files
76+
auth:
77+
type: file
78+
path: "~/.gnupg/secring.gpg"
79+
# Alternative: type: env
80+
# passphrase_env: "GIT_SECRET_PASSPHRASE"
81+
# Alternative: type: direct
82+
# passphrase: "your-passphrase"
3783

3884
config:
3985
- key: DATABASE_URL
4086
path: global.database.url
87+
description: "Database connection string for the application"
4188
required: true
4289
sensitive: true
4390
values:
4491
dev: "mydb://dev-connection"
92+
staging: "mydb://staging-connection"
4593
prod: "mydb://prod-connection"
94+
local: "mydb://localhost"
95+
4696
- key: LOG_LEVEL
4797
path: global.logging.level
98+
description: "Application logging verbosity level"
4899
required: false
49100
sensitive: false
50101
values:
51102
dev: "debug"
103+
staging: "info"
52104
prod: "warn"
105+
local: "debug"
53106
```
54107
108+
### Secret Backend Configuration
109+
110+
The configuration supports multiple secret backend types with flexible authentication methods:
111+
112+
1. **Authentication Methods**:
113+
- `env`: Use environment variables
114+
- `file`: Use credential files
115+
- `direct`: Direct credential specification (not recommended for production)
116+
- `managed_identity`: For cloud-native authentication (Azure)
117+
118+
2. **Supported Secret Backends**:
119+
- AWS Secrets Manager
120+
- Google Secret Manager
121+
- Azure Key Vault
122+
- git-secret (for local development)
123+
124+
3. **Authentication Patterns**:
125+
- Environment variables for cloud credentials
126+
- Credential files for service accounts
127+
- Direct credentials (development only)
128+
- Managed identities for cloud services
129+
55130
## Consequences
56131
- The project will be built as a Helm plugin with Python as the core language.
57132
- Secret backends must be configured separately for security compliance.

plugin.yaml

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,70 +5,19 @@ description: |-
55
This plugin helps you manage Helm values and secrets across different environments
66
while supporting multiple secret backends like AWS Secrets Manager, Azure Key Vault,
77
and HashiCorp Vault.
8-
command: "$HELM_PLUGIN_DIR/bin/wrapper.sh"
8+
platformCommand:
9+
- os: linux
10+
arch: amd64
11+
command: "$HELM_PLUGIN_DIR/bin/wrapper.sh"
12+
- os: darwin
13+
arch: amd64
14+
command: "$HELM_PLUGIN_DIR/bin/wrapper.sh"
15+
- os: darwin
16+
arch: arm64
17+
command: "$HELM_PLUGIN_DIR/bin/wrapper.sh"
18+
- os: windows
19+
arch: amd64
20+
command: "$HELM_PLUGIN_DIR/bin/wrapper.bat"
921
hooks:
10-
install: |
11-
#!/bin/bash
12-
13-
# Check if Python 3.8 or higher is available
14-
python_version=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
15-
required_version="3.8"
16-
17-
if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" = "$required_version" ]; then
18-
# Python version is >= 3.8, proceed with installation
19-
python3 -m pip install -e .
20-
else
21-
echo "Error: Python 3.8 or higher is required (found $python_version)"
22-
exit 1
23-
fi
24-
25-
mkdir -p $HELM_PLUGIN_DIR/bin
26-
27-
# Create Python script with error handling
28-
cat > $HELM_PLUGIN_DIR/bin/helm_values_manager.py << 'EOF'
29-
#!/usr/bin/env python3
30-
import sys
31-
import os
32-
33-
try:
34-
sys.path.insert(0, os.path.join(os.environ["HELM_PLUGIN_DIR"], "lib"))
35-
from helm_values_manager import helm_values_manager
36-
except ImportError as e:
37-
print(f"Error: Failed to import helm_values_manager: {e}", file=sys.stderr)
38-
print("This might be due to missing dependencies or incorrect installation.", file=sys.stderr)
39-
sys.exit(1)
40-
except Exception as e:
41-
print(f"Error: {e}", file=sys.stderr)
42-
sys.exit(1)
43-
44-
if __name__ == '__main__':
45-
sys.exit(helm_values_manager())
46-
EOF
47-
48-
# Create wrapper script with error handling
49-
cat > $HELM_PLUGIN_DIR/bin/wrapper.sh << 'EOF'
50-
#!/bin/sh
51-
52-
# Ensure HELM_PLUGIN_DIR is set
53-
if [ -z "$HELM_PLUGIN_DIR" ]; then
54-
echo "Error: HELM_PLUGIN_DIR environment variable is not set"
55-
exit 1
56-
fi
57-
58-
# Ensure the Python script exists
59-
if [ ! -f "$HELM_PLUGIN_DIR/bin/helm_values_manager.py" ]; then
60-
echo "Error: helm_values_manager.py not found"
61-
exit 1
62-
fi
63-
64-
# Run the Python script with proper error handling
65-
python3 "$HELM_PLUGIN_DIR/bin/helm_values_manager.py" "$@"
66-
EOF
67-
68-
chmod +x $HELM_PLUGIN_DIR/bin/helm_values_manager.py
69-
chmod +x $HELM_PLUGIN_DIR/bin/wrapper.sh
70-
71-
echo "helm-values-manager plugin installed successfully"
72-
update: |
73-
#!/bin/sh
74-
pip install --target $HELM_PLUGIN_DIR/lib --upgrade .
22+
install: "scripts/install.sh"
23+
update: "scripts/update.sh"

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ dev = [
3838
"pre-commit>=3.6.0",
3939
]
4040

41-
[project.scripts]
42-
helm-values-manager = "helm_values_manager:helm_values_manager"
43-
4441
[tool.black]
4542
line-length = 100
4643
target-version = ['py38']

scripts/install.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Check if Python 3.8 or higher is available
4+
python_version=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
5+
required_version="3.8"
6+
7+
if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" = "$required_version" ]; then
8+
# Python version is >= 3.8, proceed with installation
9+
python3 -m pip install -e .
10+
else
11+
echo "Error: Python 3.8 or higher is required (found $python_version)"
12+
exit 1
13+
fi
14+
15+
mkdir -p $HELM_PLUGIN_DIR/bin
16+
17+
# Create Python script with error handling
18+
cat > $HELM_PLUGIN_DIR/bin/helm_values_manager.py << 'EOF'
19+
#!/usr/bin/env python3
20+
import sys
21+
import os
22+
23+
try:
24+
sys.path.insert(0, os.path.join(os.environ["HELM_PLUGIN_DIR"], "lib"))
25+
from helm_values_manager import helm_values_manager
26+
except ImportError as e:
27+
print(f"Error: Failed to import helm_values_manager: {e}", file=sys.stderr)
28+
print("This might be due to missing dependencies or incorrect installation.", file=sys.stderr)
29+
sys.exit(1)
30+
except Exception as e:
31+
print(f"Error: {e}", file=sys.stderr)
32+
sys.exit(1)
33+
34+
if __name__ == '__main__':
35+
sys.exit(helm_values_manager())
36+
EOF
37+
38+
# Create wrapper script with error handling
39+
cat > $HELM_PLUGIN_DIR/bin/wrapper.sh << 'EOF'
40+
#!/bin/sh
41+
42+
# Ensure HELM_PLUGIN_DIR is set
43+
if [ -z "$HELM_PLUGIN_DIR" ]; then
44+
echo "Error: HELM_PLUGIN_DIR environment variable is not set"
45+
exit 1
46+
fi
47+
48+
# Ensure the Python script exists
49+
if [ ! -f "$HELM_PLUGIN_DIR/bin/helm_values_manager.py" ]; then
50+
echo "Error: helm_values_manager.py not found"
51+
exit 1
52+
fi
53+
54+
# Run the Python script with proper error handling
55+
python3 "$HELM_PLUGIN_DIR/bin/helm_values_manager.py" "$@"
56+
EOF
57+
58+
# Create Windows wrapper script
59+
cat > $HELM_PLUGIN_DIR/bin/wrapper.bat << 'EOF'
60+
@echo off
61+
setlocal
62+
63+
if "%HELM_PLUGIN_DIR%"=="" (
64+
echo Error: HELM_PLUGIN_DIR environment variable is not set
65+
exit /b 1
66+
)
67+
68+
if not exist "%HELM_PLUGIN_DIR%\bin\helm_values_manager.py" (
69+
echo Error: helm_values_manager.py not found
70+
exit /b 1
71+
)
72+
73+
python "%HELM_PLUGIN_DIR%\bin\helm_values_manager.py" %*
74+
EOF
75+
76+
chmod +x $HELM_PLUGIN_DIR/bin/helm_values_manager.py
77+
chmod +x $HELM_PLUGIN_DIR/bin/wrapper.sh
78+
79+
echo "helm-values-manager plugin installed successfully"

scripts/update.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Update the plugin using pip
4+
pip install --target $HELM_PLUGIN_DIR/lib --upgrade .
5+
6+
# Re-run the install script to ensure all files are properly set up
7+
$HELM_PLUGIN_DIR/scripts/install.sh

0 commit comments

Comments
 (0)