Skip to content

Commit

Permalink
chore: update usage sample (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato authored Mar 27, 2023
1 parent 83a018d commit 9120777
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

create-pr-to-update-kustomization:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Update kustomization
run: IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF:10} make release

- name: Create pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # used by gh
run: |
gh pr create -t "chore: update kustomization for install to ${GITHUB_REF:10}" -b ""
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,6 @@ e2e-with-kuttl:
.PHONY: e2e-with-ginkgo
e2e-with-ginkgo: ginkgo
$(GINKGO) e2e

release: kustomize
cd config/install && $(KUSTOMIZE) edit set image controller=${IMG}
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,41 @@ This is a go-based Kubernetes operator built with [operator-sdk](https://sdk.ope
```
```
kubectl apply -f mysql.yaml,mysqluser.yaml
kubectl apply -k https://github.com/nakamasato/mysql-operator/config/samples-on-k8s
```
1. Check secret for the MySQL user
1. Check `MySQLUser` and `Secret` for the MySQL user
```
kubectl get mysqluser
NAME PHASE REASON
nakamasato Ready Both secret and mysql user are successfully created.
```
```
kubectl get secret
NAME TYPE DATA AGE
mysql-mysql-sample-nakamasato Opaque 1 10s
```
1. Connect to MySQL with the secret
```
kubectl exec -it $(kubectl get po | grep mysql | head -1 | awk '{print $1}') -- mysql -unakamasato -p$(kubectl get secret mysql-mysql-sample-nakamasato -o jsonpath='{.data.password}' | base64 --decode)
```
1. Delete custom resources (`MySQL`, `MySQLUser`).
Example:
```
kubectl delete -f mysql.yaml,mysqluser.yaml
kubectl delete -k https://github.com/nakamasato/mysql-operator/config/samples-on-k8s
```
NOTICE: custom resources might get stuck if MySQL is deleted before (to be improved). → Remove finalizers to forcifully delete the stuck objects
`kubectl patch mysqluser <resource_name> -p '{"metadata":{"finalizers": []}}' --type=merge` or `kubectl patch mysql <resource_name> -p '{"metadata":{"finalizers": []}}' --type=merge` (Bug: https://github.com/nakamasato/mysql-operator/issues/162)
1. (Optional) Delete MySQL
```
kubectl delete -k https://github.com/nakamasato/mysql-operator/config/mysql
```
1. Uninstall
```
kubectl delete -k https://github.com/nakamasato/mysql-operator/config/default
kubectl delete -k https://github.com/nakamasato/mysql-operator/config/install
```
## Exposed Metrics
Expand Down
2 changes: 1 addition & 1 deletion config/install/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/nakamasato/mysql-operator
newTag: latest
newTag: v0.0.7

0 comments on commit 9120777

Please sign in to comment.