Skip to content

Commit b1f52e3

Browse files
authored
Merge pull request #431 from Danil-Grigorev/update-plugin-instructions-and-release-script
🌱 Update plugin instructions and release script
2 parents 3e0130f + d309c96 commit b1f52e3

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ upload-staging-artifacts: ## Upload release artifacts to the staging bucket
499499
update-helm-plugin-repo:
500500
./hack/update-plugin-yaml.sh $(RELEASE_TAG)
501501
./hack/update-helm-repo.sh $(RELEASE_TAG)
502+
./hack/publish-index-changes.sh $(RELEASE_TAG)
502503

503504
.PHONY: promote-images
504505
promote-images: $(KPROMO)

docs/book/src/02_installation/01_plugin.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,38 @@ The `cluster-api-operator` plugin can be installed using krew, the kubectl plugi
1212

1313
1. Add the cluster-api-operator plugin index to krew:
1414
```bash
15-
clusterctl krew index add operator https://github.com/kubernetes-sigs/cluster-api-operator.git
15+
kubectl krew index add operator https://github.com/kubernetes-sigs/cluster-api-operator.git
1616
```
1717

1818
2. Install the cluster-api-operator plugin:
1919
```bash
20-
clusterctl krew install operator/operator
20+
kubectl krew install operator/clusterctl-operator
2121
```
2222

2323
3. Verify the installation:
2424
```bash
25-
clusterctl operator
25+
kubectl operator
2626
```
2727

28-
This should print help information for the clusterctl operator plugin.
28+
This should print help information for the kubectl operator plugin.
2929

30-
The `cluster-api-operator` plugin is now installed and ready to use with both `kubectl` and `clusterctl`.
30+
The `cluster-api-operator` plugin is now installed and ready to use with `kubectl`.
31+
32+
### Optionally: installing as a `clusterctl` plugin
33+
Typically the plugin is installed under `~/.krew/bin/kubectl-operator`, which would be present under your `$PATH` after correct `krew` installation. If you want to use plugin with `clusterctl`, you need to rename this file to be prefixed with `clusterctl-` instead, like so:
34+
```bash
35+
cp ~/.krew/bin/kubectl-operator ~/.krew/bin/clusterctl-operator
36+
```
37+
38+
After that plugin is available to use as a `clusterctl` plugin:
39+
```bash
40+
clusterctl operator --help
41+
```
42+
43+
## Upgrade
44+
45+
To upgrade your plugin with the new release of `cluster-api-operator` you will need to run:
46+
47+
```bash
48+
kubectl krew upgrade
49+
```

hack/publish-index-changes.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
if [ $# -ne 1 ]; then
4+
echo "Usage: $0 RELEASE_TAG"
5+
exit 1
6+
fi
7+
8+
RELEASE_TAG="$1"
9+
BRANCH_NAME="index-${RELEASE_TAG}"
10+
COMMIT_MESSAGE="This PR updates index.yaml for ${RELEASE_TAG}. Automatically generated by make update-helm-repo."
11+
PR_TITLE="🌱 Update helm chart index.yaml to ${RELEASE_TAG}"
12+
PR_DESCRIPTION="**What this PR does / why we need it:**\n\nThis PR updates index.yaml for ${RELEASE_TAG}. Automatically generated by \`make update-helm-repo\`."
13+
14+
# Checkout index-${RELEASE_TAG} branch
15+
git checkout -b "${BRANCH_NAME}"
16+
17+
# Add files to commit
18+
git add plugins/clusterctl-operator.yaml index.yaml
19+
20+
# Commit changes with appropriate message
21+
git commit -m "${COMMIT_MESSAGE}"
22+
23+
# Push changes to origin
24+
git push origin "${BRANCH_NAME}"
25+
26+
if ! command -v gh &> /dev/null
27+
then
28+
echo "GitHub CLI (gh) is not installed."
29+
echo "Please open a pull request with the following details:"
30+
echo "Title: $PR_TITLE"
31+
echo -e "Description: \n$PR_DESCRIPTION"
32+
exit 0
33+
fi
34+
35+
# Open a PR with title and description
36+
gh pr create --title "${PR_TITLE}" --body "${PR_DESCRIPTION}"

0 commit comments

Comments
 (0)