Skip to content

Commit 155879c

Browse files
committed
chart: get the chart in a working condition
1 parent d56128a commit 155879c

17 files changed

Lines changed: 1183 additions & 1 deletion
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release Helm Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'charts/**'
9+
workflow_dispatch:
10+
inputs:
11+
chart_version:
12+
description: 'Chart version to release (leave empty to use values in Chart.yaml)'
13+
required: false
14+
type: string
15+
app_version:
16+
description: 'App version to release (leave empty to use values in Chart.yaml)'
17+
required: false
18+
type: string
19+
20+
jobs:
21+
release-charts:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Configure Git
32+
run: |
33+
git config user.name "$GITHUB_ACTOR"
34+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
35+
36+
- name: Install Helm
37+
uses: azure/setup-helm@v3
38+
with:
39+
version: v3.12.3
40+
41+
- name: Update chart version if provided
42+
if: ${{ github.event.inputs.chart_version != '' }}
43+
run: |
44+
CHART_VERSION="${{ github.event.inputs.chart_version }}"
45+
APP_VERSION="${{ github.event.inputs.app_version }}"
46+
47+
if [ -n "$CHART_VERSION" ]; then
48+
echo "Updating chart version to $CHART_VERSION"
49+
sed -i "s/^version:.*/version: $CHART_VERSION/" charts/openvirtualcluster-operator/Chart.yaml
50+
fi
51+
52+
if [ -n "$APP_VERSION" ]; then
53+
echo "Updating app version to $APP_VERSION"
54+
sed -i "s/^appVersion:.*/appVersion: \"$APP_VERSION\"/" charts/openvirtualcluster-operator/Chart.yaml
55+
fi
56+
57+
- name: Update dependencies
58+
run: |
59+
for chart in charts/*; do
60+
if [ -d "$chart" ]; then
61+
echo "Updating dependencies for $chart"
62+
helm dependency update "$chart"
63+
fi
64+
done
65+
66+
- name: Package Helm Charts
67+
run: |
68+
mkdir -p .cr-release-packages
69+
for chart in charts/*; do
70+
if [ -d "$chart" ]; then
71+
echo "Packaging $chart"
72+
helm package "$chart" -d .cr-release-packages
73+
fi
74+
done
75+
76+
- name: Create index file
77+
run: |
78+
helm repo index .cr-release-packages --url https://openvirtualcluster.github.io/openvirtualcluster-operator/
79+
cp .cr-release-packages/index.yaml .
80+
# Copy the HTML index page to the release directory
81+
cp charts/index.html .cr-release-packages/
82+
83+
- name: Deploy to GitHub Pages
84+
uses: peaceiris/actions-gh-pages@v3
85+
with:
86+
github_token: ${{ secrets.GITHUB_TOKEN }}
87+
publish_dir: .cr-release-packages
88+
keep_files: true
89+
90+
- name: Update README with Helm Chart Info
91+
run: |
92+
# Create or update index section in the main README
93+
if [ -f "README.md" ]; then
94+
# Extract chart info
95+
CHART_NAME=$(grep -m 1 "name:" charts/openvirtualcluster-operator/Chart.yaml | awk '{print $2}')
96+
CHART_VERSION=$(grep -m 1 "version:" charts/openvirtualcluster-operator/Chart.yaml | awk '{print $2}')
97+
APP_VERSION=$(grep -m 1 "appVersion:" charts/openvirtualcluster-operator/Chart.yaml | awk '{print $2}' | tr -d '"')
98+
99+
# Check if Helm Chart Installation section exists
100+
if grep -q "## Helm Chart Installation" README.md; then
101+
# Update existing section
102+
sed -i '/## Helm Chart Installation/,/```/c\## Helm Chart Installation\n\nThe OpenVirtualCluster Operator can be installed via Helm chart:\n\n```bash\n# Add the OpenVirtualCluster Helm repository\nhelm repo add openvirtualcluster https://openvirtualcluster.github.io/openvirtualcluster-operator/\n\n# Update your Helm repositories\nhelm repo update\n\n# Install the chart\nhelm install openvirtualcluster openvirtualcluster/openvirtualcluster-operator --version '"$CHART_VERSION"'\n```\n\nCurrent chart version: '"$CHART_VERSION"' (App version: '"$APP_VERSION"')' README.md
103+
else
104+
# Add new section before the License section or at the end
105+
if grep -q "## License" README.md; then
106+
sed -i '/## License/i\## Helm Chart Installation\n\nThe OpenVirtualCluster Operator can be installed via Helm chart:\n\n```bash\n# Add the OpenVirtualCluster Helm repository\nhelm repo add openvirtualcluster https://openvirtualcluster.github.io/openvirtualcluster-operator/\n\n# Update your Helm repositories\nhelm repo update\n\n# Install the chart\nhelm install openvirtualcluster openvirtualcluster/openvirtualcluster-operator --version '"$CHART_VERSION"'\n```\n\nCurrent chart version: '"$CHART_VERSION"' (App version: '"$APP_VERSION"')\n\n' README.md
107+
else
108+
echo -e "\n## Helm Chart Installation\n\nThe OpenVirtualCluster Operator can be installed via Helm chart:\n\n\`\`\`bash\n# Add the OpenVirtualCluster Helm repository\nhelm repo add openvirtualcluster https://openvirtualcluster.github.io/openvirtualcluster-operator/\n\n# Update your Helm repositories\nhelm repo update\n\n# Install the chart\nhelm install openvirtualcluster openvirtualcluster/openvirtualcluster-operator --version $CHART_VERSION\n\`\`\`\n\nCurrent chart version: $CHART_VERSION (App version: $APP_VERSION)\n" >> README.md
109+
fi
110+
fi
111+
112+
# Commit the changes
113+
git add README.md
114+
git commit -m "Update Helm chart installation instructions to version $CHART_VERSION" || true
115+
git push origin main || true
116+
fi

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.23 as builder
2+
FROM golang:1.24 as builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,24 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
132132
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
133133
$(KUSTOMIZE) build config/default > dist/install.yaml
134134

135+
.PHONY: build-chart
136+
build-chart: manifests generate kustomize ## Generate Helm chart templates from Kustomize configs.
137+
@echo "Generating Helm chart templates from Kustomize configurations..."
138+
@mkdir -p charts/openvirtualcluster-operator/templates
139+
@mkdir -p charts/openvirtualcluster-operator/crds
140+
141+
@echo "Copying CRDs to chart directory..."
142+
@cp config/crd/bases/* charts/openvirtualcluster-operator/crds/
143+
144+
@echo "Generating RBAC templates..."
145+
@$(KUSTOMIZE) build config/rbac > charts/openvirtualcluster-operator/templates/rbac-kustomize.yaml
146+
147+
@echo "Generating manager templates..."
148+
@$(KUSTOMIZE) build config/manager > charts/openvirtualcluster-operator/templates/manager-kustomize.yaml
149+
150+
@echo "Converting Kustomize output to Helm templates..."
151+
@$(SHELL) ./hack/kustomize-to-helm.sh
152+
135153
##@ Deployment
136154

137155
ifndef ignore-not-found

charts/index.html

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>OpenVirtualCluster Helm Charts</title>
7+
<style>
8+
body {
9+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
10+
line-height: 1.6;
11+
color: #333;
12+
max-width: 800px;
13+
margin: 0 auto;
14+
padding: 20px;
15+
}
16+
h1 {
17+
color: #2C3E50;
18+
border-bottom: 2px solid #eaecef;
19+
padding-bottom: 10px;
20+
}
21+
h2 {
22+
color: #3498DB;
23+
margin-top: 30px;
24+
}
25+
a {
26+
color: #3498DB;
27+
text-decoration: none;
28+
}
29+
a:hover {
30+
text-decoration: underline;
31+
}
32+
.chart-container {
33+
background-color: #f8f9fa;
34+
border-radius: 5px;
35+
padding: 15px;
36+
margin-bottom: 20px;
37+
}
38+
code {
39+
background-color: #f8f9fa;
40+
padding: 2px 5px;
41+
border-radius: 3px;
42+
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
43+
}
44+
pre {
45+
background-color: #f8f9fa;
46+
padding: 15px;
47+
border-radius: 5px;
48+
overflow-x: auto;
49+
}
50+
.footer {
51+
margin-top: 50px;
52+
padding-top: 20px;
53+
border-top: 1px solid #eaecef;
54+
font-size: 0.9em;
55+
}
56+
</style>
57+
</head>
58+
<body>
59+
<h1>OpenVirtualCluster Helm Charts</h1>
60+
61+
<p>Welcome to the OpenVirtualCluster Helm Chart repository. This repository hosts Helm charts for deploying OpenVirtualCluster components in Kubernetes clusters.</p>
62+
63+
<h2>Available Charts</h2>
64+
65+
<div class="chart-container">
66+
<h3>openvirtualcluster-operator</h3>
67+
<p>The OpenVirtualCluster Operator manages virtual Kubernetes clusters within a host Kubernetes cluster.</p>
68+
<p>This chart deploys the operator that watches VirtualCluster custom resources and manages their lifecycle.</p>
69+
<p><strong>Installation:</strong></p>
70+
<pre><code>helm repo add openvirtualcluster https://openvirtualcluster.github.io/openvirtualcluster-operator/
71+
helm repo update
72+
helm install openvirtualcluster openvirtualcluster/openvirtualcluster-operator</code></pre>
73+
<p><a href="https://github.com/OpenVirtualCluster/openvirtualcluster-operator/tree/main/charts/openvirtualcluster-operator">View Chart Source</a></p>
74+
</div>
75+
76+
<h2>Usage</h2>
77+
78+
<p>Add the Helm repository to your Helm client:</p>
79+
<pre><code>helm repo add openvirtualcluster https://openvirtualcluster.github.io/openvirtualcluster-operator/
80+
helm repo update</code></pre>
81+
82+
<p>List the charts in the repository:</p>
83+
<pre><code>helm search repo openvirtualcluster</code></pre>
84+
85+
<h2>Documentation</h2>
86+
87+
<p>For more information and detailed documentation, please visit the <a href="https://github.com/OpenVirtualCluster/openvirtualcluster-operator">OpenVirtualCluster GitHub repository</a>.</p>
88+
89+
<div class="footer">
90+
<p>OpenVirtualCluster is an open source project.</p>
91+
<p>This Helm chart repository is updated automatically by GitHub Actions upon new releases.</p>
92+
</div>
93+
94+
<script>
95+
// Simple script to fetch the latest chart version from index.yaml and update the page
96+
fetch('./index.yaml')
97+
.then(response => response.text())
98+
.then(text => {
99+
const match = text.match(/openvirtualcluster-operator-([\d\.]+)\.tgz/);
100+
if (match && match[1]) {
101+
const version = match[1];
102+
document.querySelectorAll('.chart-container h3').forEach(el => {
103+
if (el.textContent === 'openvirtualcluster-operator') {
104+
el.textContent = `openvirtualcluster-operator (v${version})`;
105+
}
106+
});
107+
}
108+
})
109+
.catch(error => console.error('Error fetching index.yaml:', error));
110+
</script>
111+
</body>
112+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v2
2+
name: openvirtualcluster-operator
3+
description: A Helm chart for OpenVirtualCluster Operator
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
keywords:
8+
- kubernetes
9+
- virtual cluster
10+
- k8s
11+
- vcluster
12+
- operator
13+
maintainers:
14+
- name: OpenVirtualCluster Team
15+
url: https://github.com/OpenVirtualCluster/openvirtualcluster-operator
16+
home: https://github.com/OpenVirtualCluster/openvirtualcluster-operator
17+
sources:
18+
- https://github.com/OpenVirtualCluster/openvirtualcluster-operator
19+
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/kubernetes/icon/color/kubernetes-icon-color.svg
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# OpenVirtualCluster Operator Helm Chart
2+
3+
This Helm chart installs the OpenVirtualCluster Operator in your Kubernetes cluster.
4+
5+
## Prerequisites
6+
7+
- Kubernetes 1.19+
8+
- Helm 3.0+
9+
10+
## Installing the Chart
11+
12+
To install the chart with the release name `my-release`:
13+
14+
```bash
15+
helm install my-release ./charts/openvirtualcluster-operator
16+
```
17+
18+
> **Tip**: List all releases using `helm list`
19+
20+
## Uninstalling the Chart
21+
22+
To uninstall/delete the `my-release` deployment:
23+
24+
```bash
25+
helm delete my-release
26+
```
27+
28+
## Configuration
29+
30+
The following table lists the configurable parameters of the OpenVirtualCluster Operator chart and their default values.
31+
32+
| Parameter | Description | Default |
33+
| --------- | ----------- | ------- |
34+
| `replicaCount` | Number of replicas | `1` |
35+
| `image.repository` | Image repository | `ghcr.io/openvirtualcluster/openvirtualcluster-operator` |
36+
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
37+
| `image.tag` | Image tag | `latest` |
38+
| `imagePullSecrets` | Image pull secrets | `[]` |
39+
| `nameOverride` | Override the name of the chart | `""` |
40+
| `fullnameOverride` | Override the full name of the chart | `""` |
41+
| `serviceAccount.create` | If true, create a new service account | `true` |
42+
| `serviceAccount.annotations` | Annotations for service account | `{}` |
43+
| `serviceAccount.name` | Service account name to use, if not set and create is true, a name is generated | `""` |
44+
| `podAnnotations` | Pod annotations | `{}` |
45+
| `podSecurityContext` | Pod security context | `{}` |
46+
| `securityContext` | Container security context | `{}` |
47+
| `resources` | CPU/memory resource requests/limits | `{}` |
48+
| `nodeSelector` | Node selector labels | `{}` |
49+
| `tolerations` | List of tolerations | `[]` |
50+
| `affinity` | Node affinity | `{}` |
51+
| `operator.leaderElection` | Enable leader election | `false` |
52+
| `operator.webhook` | Enable webhook server | `false` |
53+
| `operator.logLevel` | Log level | `info` |
54+
| `operator.metricsBindAddress` | Metrics bind address | `"0"` |
55+
| `operator.secureMetrics` | Enable secure metrics | `true` |
56+
| `operator.healthProbeBindAddress` | Health probe bind address | `":8081"` |
57+
| `operator.enableHTTP2` | Enable HTTP/2 | `false` |
58+
| `crds.install` | Install CRDs | `true` |
59+
| `rbac.create` | Create RBAC resources | `true` |
60+
| `metrics.enabled` | Enable metrics | `true` |
61+
| `metrics.serviceMonitor.enabled` | Enable ServiceMonitor for Prometheus Operator | `false` |
62+
| `metrics.serviceMonitor.additionalLabels` | Additional labels for ServiceMonitor | `{}` |
63+
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
64+
65+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
66+
67+
For example:
68+
69+
```bash
70+
helm install my-release \
71+
--set operator.leaderElection=true \
72+
./charts/openvirtualcluster-operator
73+
```
74+
75+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example:
76+
77+
```bash
78+
helm install my-release -f values.yaml ./charts/openvirtualcluster-operator
79+
```
80+
81+
> **Tip**: You can use the default [values.yaml](values.yaml)

0 commit comments

Comments
 (0)