Skip to content

Commit

Permalink
docs: update documentation for helm and kustomize
Browse files Browse the repository at this point in the history
  • Loading branch information
piraces committed Sep 17, 2022
1 parent 0cfc859 commit 0eb83dc
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/marketplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: kube-score action step
uses: piraces/[email protected].2
uses: piraces/[email protected].3
with:
manifests-folders: './sample-manifests/sample-manifests/*.yaml,./sample-manifests/sample-policy-manifest/*.yaml'
ignore-exit-code: 'true'
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: kube-score action step
uses: piraces/[email protected].2
uses: piraces/[email protected].3
with:
manifests-folders: './sample-manifests/sample-manifests/*.yaml,./sample-manifests/sample-policy-manifest/*.yaml'
ignore-exit-code: 'true'
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: kube-score action step
uses: piraces/[email protected].2
uses: piraces/[email protected].3
with:
manifests-folders: './sample-manifests/sample-manifests/*.yaml,./sample-manifests/sample-policy-manifest/*.yaml'
ignore-exit-code: 'true'
Expand Down
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,72 @@ This action does not contain outputs. Only if `output-file` is provided, then a
- name: Checkout
uses: actions/checkout@v2
- name: kube-score check
uses: piraces/[email protected].2
uses: piraces/[email protected].3
with:
manifests-folders: './manifests/*.yml'
```

## Usage with Helm or Kustomize
[![Action CI (Helm)](https://github.com/piraces/kube-score-ga/actions/workflows/test-action-helm.yml/badge.svg)](https://github.com/piraces/kube-score-ga/actions/workflows/test-action-helm.yml)

[![Action CI (Kustomize)](https://github.com/piraces/kube-score-ga/actions/workflows/test-action-kustomize.yml/badge.svg)](https://github.com/piraces/kube-score-ga/actions/workflows/test-action-kustomize.yml)

**This action and kube-score itself can work with the output of [helm](https://helm.sh/) and [kustomize](https://kustomize.io/)**, some examples are provided in the workflows `.github/workflows/test-action-helm.yml` and `.github/workflows/test-action-kustomize.yml` which runs can be seen clicking in the badges above.

**It is important to note that kube-score only parses static `yaml`**. Nevertheless, since `helm` and `kustomize` produce them, we can use the tool to scan them.

### Helm

In the case for Helm, we can previously build the desired template, redirect the output to a file and then executing the action. For example:

```
- name: Checkout
uses: actions/checkout@v2
- uses: azure/setup-helm@v3
name: Setup Helm
with:
token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest'
id: install
- name: Make temporal output directory
run: mkdir -p out/helm
- name: Helm Template to standard template
run: helm template .\sample-manifests\helm\example-chart > ./out/helm/sample-helm.yaml
- name: kube-score check
uses: piraces/[email protected]
with:
manifests-folders: './out/helm/*.yml'
```

In this case we are doing the same behaviour of the following command:
```bash
helm template .\sample-manifests\helm\example-chart | kube-score score -
```

# Kustomize

The case for Kustomize is mostly the same as Helm, we can previously build the desired template, redirect the output to a file and then executing the action. For example:

```
- name: Checkout
uses: actions/checkout@v2
- uses: azure/setup-kubectl@v3
id: install
- name: Make temporal output directory
run: mkdir -p out/kustomize
- name: kustomize build to standard template
run: kubectl kustomize sample-manifests/kustomize/overlays/production > ./out/kustomize/sample-kustomize.yaml
- name: kube-score check
uses: piraces/[email protected]
with:
manifests-folders: './out/kustomize/*.yml'
```

In this case we are doing the same behaviour of the following command:
```bash
kustomize build sample-manifests/kustomize/overlays/production | kube-score score -
```

Or with `kubectl`:
```bash
kubectl kustomize sample-manifests/kustomize/overlays/production | kube-score score -
```

0 comments on commit 0eb83dc

Please sign in to comment.