Skip to content

Commit

Permalink
Merge pull request #47 from rustycl0ck/kpt
Browse files Browse the repository at this point in the history
Integrate `kpt` with Kustomize resources
  • Loading branch information
tkuchiki authored Oct 29, 2021
2 parents 0b4381e + 98c65e3 commit f547b22
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 349 deletions.
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,36 @@ $ kubectl apply -f config/samples/spanner_v1alpha1_spannerautoscaler.yaml
### KPT
Spanner Autoscaler can be installed using [KPT](https://github.com/GoogleContainerTools/kpt).
Spanner Autoscaler can be installed using [KPT](https://kpt.dev/installation/).
The installation has 2 steps:
1. Fetch package
2. Create Custom Resource
1. Deploy the operator through `kpt`
2. Create a Custom Resource for managing a spanner instance
#### 1. Fetch package
#### 1. Deploy the operator
```
$ mkdir tmp
$ kpt pkg get https://github.com/mercari/spanner-autoscaler tmp/
```
```console
$ kpt pkg get https://github.com/mercari/spanner-autoscaler/[email protected] spanner-autoscaler
$ kpt live init spanner-autoscaler/kpt
$ kpt live install-resource-group
#### 2. Create Custom Resource
## Append '--dry-run' to the below line to just
## check the resources which will be created
$ kustomize build spanner-autoscaler/kpt | kpt live apply -
## To uninstall, use the following
$ kustomize build spanner-autoscaler/kpt | kpt live destroy -
```
$ kubectl apply -R -f tmp/kpt
> :information_source: **TIP:** Instead of `kpt`, you can also use `kubectl` directly to apply the resources with
> ```console
> $ kustomize build spanner-autoscaler/default | kubectl apply -f -
> ```
> These resources can then be adopted by `kpt` by using the `--inventory-policy=adopt` flag while using `kpt live apply` command. [More info](https://kpt.dev/reference/cli/live/apply/?id=flags).
#### 2. Create a Custom Resource
```console
$ kubectl apply -f spanner-autoscaler/samples/spanner_v1alpha1_spannerautoscaler.yaml
```
### (Optional) Setting GKE Workload Identity
Expand Down
6 changes: 6 additions & 0 deletions config/kpt/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: spanner-autoscaler
info:
description: Autoscaler for Google Cloud Spanner
4 changes: 4 additions & 0 deletions config/kpt/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ../default
- Kptfile

31 changes: 0 additions & 31 deletions kpt/Kptfile

This file was deleted.

163 changes: 0 additions & 163 deletions kpt/crd/spannerautoscalers.spanner.mercari.com.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions kpt/deployment/deployment.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions kpt/namespace.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions kpt/role/cluster_role.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions kpt/role/cluster_role_binding.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions kpt/role/role.yaml

This file was deleted.

Loading

0 comments on commit f547b22

Please sign in to comment.