Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
helm-version: ['v4.0.4']
helm-version: ['v3.19.4', 'v4.0.4']
kubectl-version: ['latest']

steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*.dylib

# Plugin binary
helm-kustomize-plugin
helm-kustomize

# Test binary, built with `go test -c`
*.test
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
.PHONY: build clean test test-integration test-all install uninstall reinstall \
coverage-report coverage-clean

BINARY_NAME=helm-kustomize-plugin
BINARY_NAME=helm-kustomize
BUILD_DIR=dist
COVERAGE_THRESHOLD=80
COVERAGE_PROFILE=coverage.out
COVERAGE_HTML=coverage.html
COVERAGE_DIR=coverage

# Get Helm version and check if it's >= 4
HELM_VERSION_MAJOR := $(shell helm version --template='{{.Version}}' 2>/dev/null | sed -n 's/^v\([0-9]*\).*/\1/p')
HELM_MODERN_PLUGINS := $(shell [ "$(HELM_VERSION_MAJOR)" -ge "4" ] 2>/dev/null && echo "true" || echo "false")

build:
go fmt ./...
mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BINARY_NAME) .
cp plugin.yaml $(BUILD_DIR)/
ifeq ($(HELM_MODERN_PLUGINS),true)
helm plugin package dist --sign=false
endif

clean: coverage-clean uninstall
rm -rf $(BUILD_DIR)
Expand Down Expand Up @@ -52,10 +58,14 @@ coverage-clean:
rm -rf $(COVERAGE_DIR) $(COVERAGE_PROFILE) $(COVERAGE_HTML) helm-kustomize-*.tgz

install: build
ifeq ($(HELM_MODERN_PLUGINS),true)
helm plugin install $(BUILD_DIR)
endif

uninstall:
ifeq ($(HELM_MODERN_PLUGINS),true)
helm plugin uninstall helm-kustomize 2>/dev/null || true
endif

# Development: uninstall, rebuild, and reinstall
reinstall: uninstall build install
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# helm-kustomize-plugin
# helm-kustomize

A Helm post-renderer plugin to process kustomizations embedded inside a chart.

## Requirements

- Helm v4 (with subprocess runtime support for post-renderer plugins)
- kubectl (for `kubectl kustomize` command)
- Helm v3 or v4
- kubectl (latest)

## Installation

### Helm v4

Install from the [OCI registry](https://github.com/orgs/owhelm/packages/container/package/helm-kustomize):

1. `helm plugin install oci://ghcr.io/owhelm/helm-kustomize:latest`

### Helm v3

Download from the [OCI registry](https://github.com/orgs/owhelm/packages/container/package/helm-kustomize) and use the binary from inside there:

1. `oras pull ghcr.io/owhelm/helm-kustomize:latest`
2. Extract the tarball
3. Use `helm-kustomize-plugin` as `--post-renderer`
3. Use `helm-kustomize` as `--post-renderer`

## Design

Expand Down
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@
- [ ] Support for multiple kustomization files
- [ ] Configurable resource naming (alternative to `all.yaml`)
- [ ] Performance optimization for large charts
- [ ] Support helm v3
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/owhelm/helm-kustomize-plugin
module github.com/owhelm/helm-kustomize

go 1.25.5

Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"os"

"github.com/owhelm/helm-kustomize-plugin/internal/extractor"
"github.com/owhelm/helm-kustomize-plugin/internal/kustomize"
"github.com/owhelm/helm-kustomize-plugin/internal/parser"
"github.com/owhelm/helm-kustomize/internal/extractor"
"github.com/owhelm/helm-kustomize/internal/kustomize"
"github.com/owhelm/helm-kustomize/internal/parser"
)

// KustomizePostRenderer processes Helm manifests through kustomize transformations.
Expand Down
10 changes: 5 additions & 5 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ files:
resources:
- all.yaml
commonAnnotations:
managed-by: helm-kustomize-plugin
managed-by: helm-kustomize
`)

renderer := &KustomizePostRenderer{}
Expand All @@ -264,14 +264,14 @@ data:
kind: ConfigMap
metadata:
annotations:
managed-by: helm-kustomize-plugin
managed-by: helm-kustomize
name: my-config
---
apiVersion: v1
kind: Service
metadata:
annotations:
managed-by: helm-kustomize-plugin
managed-by: helm-kustomize
name: my-service
spec:
type: ClusterIP
Expand All @@ -280,14 +280,14 @@ apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
managed-by: helm-kustomize-plugin
managed-by: helm-kustomize
name: my-deployment
spec:
replicas: 2
template:
metadata:
annotations:
managed-by: helm-kustomize-plugin
managed-by: helm-kustomize
`

if output.String() != expected {
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ description: A Helm post-renderer plugin that applies Kustomize transformations
runtime: subprocess
runtimeConfig:
platformCommand:
- command: ${HELM_PLUGIN_DIR}/helm-kustomize-plugin
- command: ${HELM_PLUGIN_DIR}/helm-kustomize
20 changes: 12 additions & 8 deletions test-integration.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail

# Integration test for helm-kustomize-plugin
# Integration test for helm-kustomize
# Tests the plugin against the simple-app example

echo "Running integration test..."
Expand All @@ -13,16 +13,20 @@ if ! command -v yq &> /dev/null; then
exit 1
fi

# Ensure plugin is installed
if ! helm plugin list | grep -q helm-kustomize; then
echo "Error: helm-kustomize plugin not installed"
echo "Run 'make install' first"
exit 1
# Detect Helm version and choose appropriate post-renderer
HELM_VERSION_MAJOR=$(helm version --template='{{.Version}}' 2>/dev/null | sed -n 's/^v\([0-9]*\).*/\1/p')

if [ "$HELM_VERSION_MAJOR" -ge 4 ] 2>/dev/null; then
echo "Helm v${HELM_VERSION_MAJOR} detected - using plugin approach"
POST_RENDERER="helm-kustomize"
else
echo "Helm v${HELM_VERSION_MAJOR} detected - using direct binary"
POST_RENDERER="./dist/helm-kustomize"
fi

# Run helm template with the plugin
# Run helm template with the appropriate post-renderer
echo "Testing simple-app example..."
OUTPUT=$(helm template examples/simple-app --post-renderer helm-kustomize)
OUTPUT=$(helm template examples/simple-app --post-renderer "$POST_RENDERER")

# Check for expected transformations
FAILED=0
Expand Down