Skip to content

Commit

Permalink
updates to README
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebz committed Jun 2, 2021
1 parent 00f83bd commit 1e7aea9
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions package-examples/kustomize-pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is a simple package that shows how kpt packages can be used instead of remo

### Fetch the package

Get the example package on to local using `kpt pkg get`. Note that this package is for the example, wihin that package we are also fetch an nginx sub-package which is an alternative to having a remote base.
Get the example package on to local using `kpt pkg get`. Note that this package is for this example, wihin that package we are also using the nginx sub-package which is an alternative to having a remote base.

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt.git/package-examples/kustomize-pkg
Expand Down Expand Up @@ -67,7 +67,7 @@ namePrefix: dev-
You can see the final configuration that the patch is going to render. The major difference between this and in place edit is that you can't just go to the file and look at it in isolation, you need to run `kustomize build` and examine the final results.

```shell
$ kustomize build
$ kustomize build kustomize-pkg/overlays/dev

apiVersion: v1
kind: Service
Expand Down Expand Up @@ -135,4 +135,29 @@ upstreamLock:

### Apply the package

It's possible to use kustomize build and kpt live apply.
It's possible to use kustomize build and kpt live apply, but it does require passing the inventory to `kpt live apply` from `kustomize build` output. One of the base Kptfiles needs to be initialized with the inventory object. We will use the nginx base, but in real life exployment it might be better to initialize inventory on your root package.

```shell
$ kpt live init bases/nginx

initializing Kptfile inventory info (namespace: default)...success
```

We will also need to ensure that the Kptfile is a part of kustomize output and the simplest way to do it is just to add it to one of the kustomization.yaml files. In our case it's: kustomize-pkg/bases/nginx/kustomization.yaml

```yaml
resources:
- deployment.yaml
- svc.yaml
- Kptfile
```

Note that because Kpt has a powerful package merge it's possible to add and change files locally and still get upstream changes. In this case the kustomization.yaml doesn't exist in the upstream package, we added it locally only.

Kustomize build will need to be piped to kpt live apply:

```shell
$ kustomize build kustomize-pkg/overlays/dev | kpt live apply -

TODO - need to address the kpt live apply
```

0 comments on commit 1e7aea9

Please sign in to comment.