Skip to content

Commit a7b57d1

Browse files
add helm plugin config
1 parent 92751ad commit a7b57d1

File tree

4 files changed

+139
-16
lines changed

4 files changed

+139
-16
lines changed

README.md

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<a href="https://github.com/ChristofferNissen/helmper/releases/latest">Latest release</a>
1616
</p>
1717

18-
[![Go Report Card](https://goreportcard.com/badge/github.com/ChristofferNissen/helmper)](https://goreportcard.com/report/github.com/ChristofferNissen/helmper)
18+
[![Go Report Card](https://goreportcard.com/badge/github.com/ChristofferNissen/helmper)](https://goreportcard.com/report/github.com/ChristofferNissen/helmper)
1919
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ChristofferNissen/helmper/blob/main/LICENSE)
2020

2121
</p>
@@ -30,8 +30,7 @@ _DISCLAIMER: helmper is in beta, so stuff may change._
3030

3131
`helmper` is built with [Helm](<https://github.com/helm/helm>), [Oras](<https://github.com/oras-project/oras-go>), [Trivy](https://github.com/aquasecurity/trivy), [Copacetic](https://github.com/project-copacetic/copacetic) ([Buildkit](https://github.com/moby/buildkitd)) and [Cosign](https://github.com/sigstore/cosign).
3232

33-
34-
Helmper connects via gRPC to Trivy and Buildkit so you can run `helmper` without root privileges wherever you want.
33+
Helmper connects via gRPC to Trivy and Buildkit so you can run `helmper` without root privileges wherever you want.
3534

3635
`helmper` demonstrates exceptional proficiency in operating within controlled environments that might require Change Management and/or air-gapped networks. This expertise is particularly beneficial in industries subject to stringent regulations, such as Medical and Banking. `helmper` aims to ensure binary reproducibility of Helm Charts by storing all necessary artifacts in your registries.
3736

@@ -74,7 +73,7 @@ Helmper will import the charts, the charts listed as dependencies including all
7473

7574
**Note** Authentication
7675

77-
Helmper utilizes well known configuration options to interact with registries.
76+
Helmper utilizes well known configuration options to interact with registries.
7877

7978
When using the Helm SDK, Helmper will utilize the file defined by `HELM_REGISTRY_CONFIG` for picking up authentication credentials for registries
8079

@@ -148,7 +147,7 @@ The full documentation for Helmper can be found at [christoffernissen.github.io/
148147
149148
Helmper utilizes the Helm SDK to maintain full compatibility with both Helm Repositories and OCI registries for storing Helm Charts.
150149
151-
In practice, Helmper currently pushes charts and images to the same destination registry, so it must be OCI compliant.
150+
In practice, Helmper currently pushes charts and images to the same destination registry, so it must be OCI compliant.
152151
153152
Helmper utilizes `oras-go` to push OCI artifacts. Helmper utilizes the Helm SDK to push Helm Charts, as the Helm SDK sets the correct metadata attributes.
154153

@@ -171,9 +170,35 @@ For testing, Helmper is using the [CNCF Distribution]() registry.
171170

172171
## Install
173172

173+
### Helm plugin
174+
175+
#### Prerequisites
176+
177+
- Helm v3.x
178+
179+
#### Prerequisites for specific functionalities
180+
181+
- Copa - For image patching
182+
- Trivy - For image scanning and patching
183+
- Cosign - For image signing
184+
185+
#### Installation
186+
187+
```bash
188+
helm plugin install https://github.com/ChristofferNissen/helmper
189+
```
190+
191+
#### Usage
192+
193+
```bash
194+
helm helmper -f <config>
195+
```
196+
197+
### Binary
198+
174199
Simply pick the binary for your platform from the Release section on GitHub.
175200

176-
### Linux
201+
#### Linux
177202

178203
```bash
179204
VERSION=$(curl -Lso /dev/null -w %{url_effective} https://github.com/christoffernissen/helmper/releases/latest | grep -o '[^/]*$')
@@ -182,7 +207,7 @@ chmod +x helmper-linux-amd64
182207
sudo mv helmper-linux-amd64 /usr/local/bin/helmper
183208
```
184209

185-
### Mac OS
210+
#### Mac OS
186211

187212
```bash
188213
VERSION=$(curl -Lso /dev/null -w %{url_effective} https://github.com/christoffernissen/helmper/releases/latest | grep -o '[^/]*$')
@@ -191,28 +216,28 @@ chmod +x helmper-darwin-amd64
191216
sudo mv helmper-darwin-amd64 /usr/local/bin/helmper
192217
```
193218

194-
### Windows
219+
#### Windows
195220

196221
Extract the tar and launch the exe file.
197222

198223
## Scope
199224

200225
### In scope
201226

202-
* Helmper operates with OCI compliant artifacts and OCI compliant registries.
203-
* Helmper must remain without dependency on a container runtime daemon to work in containers without root privileges.
227+
- Helmper operates with OCI compliant artifacts and OCI compliant registries.
228+
- Helmper must remain without dependency on a container runtime daemon to work in containers without root privileges.
204229

205230
### Out of scope
206231

207-
* Helmper does not work with other Kubernetes package formats
208-
* Helmper authenticates with registries with the docker config. Therefore, Helmper will not have any proprietary libraries to facilitate authentication for any cloud providers. Simply use `docker login` or equivalent before running Helmper, and you should be authenticated for 3 hours for each registry.
232+
- Helmper does not work with other Kubernetes package formats
233+
- Helmper authenticates with registries with the docker config. Therefore, Helmper will not have any proprietary libraries to facilitate authentication for any cloud providers. Simply use `docker login` or equivalent before running Helmper, and you should be authenticated for 3 hours for each registry.
209234

210235
## Roadmap
211236

212-
* Operator Framework to enable using Helmper with GitOps in management clusters
213-
* Add option to import to registries via pipeline for compliance audit trail retention
214-
* SBOM
215-
* OpenTelemetry
237+
- Operator Framework to enable using Helmper with GitOps in management clusters
238+
- Add option to import to registries via pipeline for compliance audit trail retention
239+
- SBOM
240+
- OpenTelemetry
216241

217242
## Code of Conduct
218243

plugin.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "helmper"
2+
version: "0.3.0"
3+
usage: "Import Helm charts and container images to registry"
4+
description: |-
5+
This plugin helps you import Helm charts and their container images into any OCI-compliant Registry.
6+
Features:
7+
- Vulnerability scanning with Trivy
8+
- Automatic patching of vulnerable images with Copa
9+
- Optional artifact signing with cosign
10+
- Support for any OCI-compliant registry
11+
12+
Basic usage:
13+
$ helm helmper -f config.yaml
14+
15+
With signing:
16+
$ helm helmper -f config.yaml
17+
18+
command: "$HELM_PLUGIN_DIR/bin/helmper"
19+
hooks:
20+
install: "cd $HELM_PLUGIN_DIR; scripts/install.sh"
21+
update: "cd $HELM_PLUGIN_DIR; scripts/install.sh"
22+
uninstall: "cd $HELM_PLUGIN_DIR; scripts/uninstall.sh"

scripts/install.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
prerequisites=(cosign trivy copa)
6+
7+
# Check for prerequisites
8+
for command in $"${prerequisites[@]}"; do
9+
if ! command -v "$command" >/dev/null 2>&1; then
10+
echo "Warning: $command is not installed. Please install $command if you want to get the most of this plugin."
11+
fi
12+
done
13+
14+
# Create bin directory if it doesn't exist
15+
mkdir -p "$HELM_PLUGIN_DIR/bin"
16+
17+
# Install the tool
18+
19+
version=$(yq '.version' <"$HELM_PLUGIN_DIR/plugin.yaml")
20+
21+
# Determine the OS and architecture
22+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
23+
ARCH=$(uname -m)
24+
25+
case $ARCH in
26+
x86_64)
27+
ARCH="amd64"
28+
;;
29+
arm64)
30+
ARCH="arm64"
31+
;;
32+
*)
33+
echo "Unsupported architecture: $ARCH"
34+
exit 1
35+
;;
36+
esac
37+
38+
if [ "$OS" == "linux" ]; then
39+
BINARY_NAME="helmper-linux-$ARCH"
40+
elif [ "$OS" == "darwin" ]; then
41+
BINARY_NAME="helmper-darwin-$ARCH"
42+
else
43+
echo "Unsupported OS: $OS"
44+
exit 1
45+
fi
46+
47+
wget "https://github.com/ChristofferNissen/helmper/releases/download/v$version/$BINARY_NAME"
48+
mv "$BINARY_NAME" "$HELM_PLUGIN_DIR/bin/helmper"
49+
chmod +x "$HELM_PLUGIN_DIR/bin/helmper"
50+
51+
echo "Plugin installation completed successfully!"

scripts/uninstall.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Plugin installation directory
6+
if [ "$HELM_PLUGIN_DIR" != "" ]; then
7+
PLUGIN_DIR="$HELM_PLUGIN_DIR"
8+
else
9+
echo "Error: HELM_PLUGIN_DIR is not set"
10+
exit 1
11+
fi
12+
13+
# Remove the binary
14+
if [ -f "${PLUGIN_DIR}/bin/helmper" ]; then
15+
rm "${PLUGIN_DIR}/bin/helmper"
16+
echo "Removed plugin binary"
17+
fi
18+
19+
# Remove the bin directory if empty
20+
if [ -d "${PLUGIN_DIR}/bin" ] && [ "$(ls -A "$PLUGIN_DIR"/bin)" = "" ]; then
21+
rmdir "${PLUGIN_DIR}/bin"
22+
echo "Removed empty bin directory"
23+
fi
24+
25+
echo "Plugin uninstallation completed successfully!"

0 commit comments

Comments
 (0)