Skip to content

Commit 6c7d8ed

Browse files
authored
feat: Modify policy categories (#3)
* ci: Modify pipelines and issue templates * feat: Create new policy categories * ci: Fix typo * ci: Fix bug report * ci: Fix bug report * ci: Modify CONTRIBUTING.md
1 parent a5ffdd5 commit 6c7d8ed

22 files changed

Lines changed: 98 additions & 85 deletions

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Please note we have a code of conduct, please follow it in all your interactions
66

77
## Pull Request Process
88

9-
1. Update the README.md with details of changes including example hcl blocks and [example files](./examples) if appropriate.
9+
1. Document your changes in the chart's README.md.gotmpl. The README.md will be generated from it by the pre-commit hook in the next step.
1010
2. Run pre-commit hooks `pre-commit run -a`.
11-
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release. The terraform-aws-vpc maintainers take care of updating the CHANGELOG as they merge.
11+
3. Once all outstanding comments and checklist items have been addressed, your contribution will be merged! Merged PRs will be included in the next release.
1212

1313
## Checklists for contributions
1414

1515
- [ ] Add [semantics prefix](#semantic-pull-requests) to your PR or Commits.
1616
- [ ] CI tests are passing
17-
- [ ] README.md has been updated after any changes. The variables and outputs in the README.md has been generated (using the `terraform_docs` pre-commit hook).
17+
- [ ] README.md has been updated after any changes. The variables and outputs in the README.md has been generated (using the `helm-docs` pre-commit hook)
1818
- [ ] Run pre-commit hooks `pre-commit run -a`
1919

2020
## Semantic Pull Requests

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ body:
88
- type: markdown
99
attributes:
1010
value: >
11-
**Thank you for wanting to report a bug!**
11+
**Thank you for reporting a bug!**
1212
1313
Verify first that your issue is not [already reported on
1414
GitHub][issue search].
@@ -20,77 +20,68 @@ body:
2020
label: Summary
2121
description: Explain the problem briefly below.
2222
placeholder: >-
23-
When I try to do X with teraform module from the main branch on GitHub, Y
24-
breaks in a way Z under the env E. Here are all the details I know
23+
When I try to do X with the Helm chart from the main branch on GitHub,
24+
Y breaks in a way Z under the env E. Here are all the details I know
2525
about this problem...
2626
validations:
2727
required: true
2828

2929
- type: dropdown
3030
attributes:
3131
label: Issue Type
32-
description: >
33-
Please select the single available option in the drop-down.
34-
35-
<details>
36-
<summary>
37-
<em>Why?</em>
38-
</summary>
39-
40-
We would do it by ourselves but unfortunatelly, the curent
41-
edition of GitHub Issue Forms Alpha does not support this yet 🤷
42-
43-
44-
_We will make it easier in the future, once GitHub
45-
supports dropdown defaults. Promise!_
46-
47-
</details>
32+
description: Issue type
4833
options:
4934
- Bug Report
5035
validations:
5136
required: true
5237

38+
- type: input
39+
attributes:
40+
label: Chart version
41+
description: Input the chart version
42+
placeholder: v0.1.0
43+
validations:
44+
required: true
45+
5346
- type: textarea
5447
attributes:
55-
label: Terraform Version
56-
description: >-
57-
Paste verbatim output from `terraform --version` below, under
58-
the prompt line. Please don't wrap it with tripple backticks — your
59-
whole input will be turned into a code snippet automatically.
48+
label: Helm version
49+
description: Paste the output of `helm version`
6050
render: console
6151
placeholder: |
62-
$ terraform --version
63-
Terraform v1.1.4
64-
on linux_amd64
65-
+ provider registry.terraform.io/cloudposse/utils v0.17.23
66-
+ provider registry.terraform.io/hashicorp/aws v4.13.0
67-
+ provider registry.terraform.io/hashicorp/helm v2.5.1
68-
+ provider registry.terraform.io/hashicorp/kubernetes v2.11.0
52+
$ helm version
53+
version.BuildInfo{Version:"v3.10.2", GitCommit:"50f003e5ee8704ec937a756c646870227d7c8b58", GitTreeState:"clean", GoVersion:"go1.18.8"}
6954
validations:
7055
required: true
7156

7257
- type: textarea
7358
attributes:
74-
label: Steps to Reproduce
75-
description: |
76-
Describe exactly how to reproduce the problem, using a minimal test-case.
77-
78-
**HINT:** You can paste https://gist.github.com links for larger files.
79-
value: |
80-
<!--- Paste example terraform code between quotes below -->
81-
```hcl (paste below)
59+
label: Kubectl version
60+
description: Paste the output of `kubectl version`
61+
render: console
62+
placeholder: |
63+
$ kubectl version
64+
...
65+
validations:
66+
required: true
8267

83-
```
68+
- type: textarea
69+
attributes:
70+
label: Steps to reproduce
71+
description: Enter details about how to reproduce the bug.
72+
placeholder: |
73+
1. In this environment...
74+
2. With this config...
75+
3. Run '...'
76+
4. See error...
8477
validations:
8578
required: true
8679

8780
- type: textarea
8881
attributes:
8982
label: Expected Results
90-
description: >-
91-
Describe what you expected to happen when running the steps above.
92-
placeholder: >-
93-
I expected X to happen because I assumed Y.
83+
description: Describe what you expected to happen.
84+
placeholder: I expected X to happen because I assumed Y.
9485
validations:
9586
required: true
9687

@@ -99,10 +90,22 @@ body:
9990
label: Actual Results
10091
description: |
10192
Describe what actually happened.
102-
103-
Paste verbatim command output and don't wrap it with tripple backticks — your
104-
whole input will be turned into a code snippet automatically.
93+
Paste verbatim command output or any other details.
10594
render: console
106-
placeholder: Terrafom command output...
95+
placeholder: Helm command output...
10796
validations:
10897
required: true
98+
99+
- type: textarea
100+
attributes:
101+
label: Custom values or parameters?
102+
description: Add any parameter used via `--set` or as a `values.yaml` customization.
103+
validations:
104+
required: false
105+
106+
- type: textarea
107+
attributes:
108+
label: Additional information
109+
description: Tell us anything else you think we should know.
110+
validations:
111+
required: false

.github/workflows/helm-lint-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: pull_request
44

55
jobs:
66
lint-test:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-22.04
88
steps:
99
- name: Checkout
1010
uses: actions/checkout@v3
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: actions/setup-python@v4
2020
with:
21-
python-version: '3.9'
21+
python-version: '3.11'
2222
check-latest: true
2323

2424
- name: Set up chart-testing
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Create kind cluster
4040
if: steps.list-changed.outputs.changed == 'true'
41-
uses: helm/kind-action@v1.5.0
41+
uses: helm/kind-action@v1.7.0
4242

4343
- name: Install Kyverno
4444
id: install-kyverno
@@ -52,7 +52,7 @@ jobs:
5252
run: ct install --target-branch ${{ github.event.repository.default_branch }}
5353

5454
linter-artifacthub:
55-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-22.04
5656
container:
5757
image: artifacthub/ah
5858
options: --user root

charts/kyverno-policies/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.2.0
1919

2020
# Maintainers
2121
maintainers:

charts/kyverno-policies/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
Helm chart for deployment of Kyverno policies
44

5-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
5+
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
66

77
## Description
88
Helm chart to deploy Kyverno policies.
99
Policy categories:
10+
- **bestPractices** - Policies which validate and enforce Kubernetes best practices
1011
- **podSecurityBaseline** - https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline
1112
- **podSecurityRestricted** - https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
12-
- **other**
13+
- **other** - All other policies, may be split into separate categories in the future
14+
- **sample** - Policies that showcase a certain Kyverno functionality
1315

1416
## Installation
1517
````shell
@@ -174,7 +176,7 @@ policies:
174176
| fullnameOverride | string | `""` | fullnameOverride |
175177
| nameOverride | string | `""` | nameOverride |
176178
| policies | object | `{"blockStaleImages":{},"checkServiceAccount":{"background":false},"disableAutomountServiceAccountToken":{},"disablePodAutomountServiceAccountToken":{},"disableServiceDiscovery":{},"disallowAllSecrets":{},"disallowCapabilitiesStrict":{},"disallowDefaultNamespace":{},"disallowEmptyIngressHost":{},"disallowHostNamespaces":{},"disallowHostPath":{},"disallowHostPorts":{},"disallowPrivilegeEscalation":{},"disallowPrivilegedContainers":{},"disallowProcMount":{},"disallowSELinux":{},"preventNakedPods":{},"protectNodeTaints":{"background":false},"requireEncryptionAwsLoadBalancers":{},"requireLabels":{},"requireRoRootFs":{},"requireRunAsNonRoot":{},"requireRunAsNonRootUser":{},"restrictAppArmor":{},"restrictImageRegistries":{},"restrictIngressWildcard":{},"restrictNodePort":{},"restrictSeccompStrict":{},"restrictServiceExternalIps":{},"restrictSysctls":{},"restrictVolumeTypes":{}}` | Used to enable and override individual policies. Policy override takes precedence over category override. Policy name matches its filename. |
177-
| policyCategories | object | `{"other":{},"podSecurityBaseline":{},"podSecurityRestricted":{}}` | Used to enable policies in bulk per category. May override policy attributes for the entire category. |
179+
| policyCategories | object | `{"bestPractices":{},"other":{},"podSecurityBaseline":{},"podSecurityRestricted":{},"sample":{}}` | Used to enable policies in bulk per category. May override policy attributes for the entire category. |
178180
| validationFailureAction | string | `"Audit"` | Default validationFailureAction policy setting according to https://kyverno.io/docs/writing-policies/policy-settings/ |
179181
| validationFailureActionOverrides | list | `[]` | Default validationFailureActionOverrides policy setting according to https://kyverno.io/docs/writing-policies/policy-settings/ |
180182

charts/kyverno-policies/README.md.gotmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
## Description
88
Helm chart to deploy Kyverno policies.
99
Policy categories:
10+
- **bestPractices** - Policies which validate and enforce Kubernetes best practices
1011
- **podSecurityBaseline** - https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline
1112
- **podSecurityRestricted** - https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
12-
- **other**
13+
- **other** - All other policies, may be split into separate categories in the future
14+
- **sample** - Policies that showcase a certain Kyverno functionality
1315

1416
## Installation
1517
````shell
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
policyCategories:
2+
bestPractices:
3+
enabled: true
24
podSecurityBaseline:
35
enabled: true
46
podSecurityRestricted:
57
enabled: true
68
other:
79
enabled: true
10+
sample:
11+
enabled: true

charts/kyverno-policies/templates/other/disableAutomountServiceAccountToken.yaml renamed to charts/kyverno-policies/templates/bestPractices/disableAutomountServiceAccountToken.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $name := "disableAutomountServiceAccountToken" }}
2-
{{- $category := "other" }}
2+
{{- $category := "bestPractices" }}
33
{{- $policyValues := get .Values.policies $name }}
44
{{- $categoryValues := get .Values.policyCategories $category }}
55

@@ -13,7 +13,7 @@ metadata:
1313
pod-policies.kyverno.io/autogen-controllers: {{ . }}
1414
{{- end }}
1515
policies.kyverno.io/title: Disable automountServiceAccountToken
16-
policies.kyverno.io/category: {{ $category }}, EKS Best Practices
16+
policies.kyverno.io/category: {{ $category }}
1717
policies.kyverno.io/severity: medium
1818
policies.kyverno.io/subject: ServiceAccount
1919
kyverno.io/kyverno-version: 1.6.0

charts/kyverno-policies/templates/other/disablePodAutomountServiceAccountToken.yaml renamed to charts/kyverno-policies/templates/bestPractices/disablePodAutomountServiceAccountToken.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $name := "disablePodAutomountServiceAccountToken" }}
2-
{{- $category := "other" }}
2+
{{- $category := "bestPractices" }}
33
{{- $policyValues := get .Values.policies $name }}
44
{{- $categoryValues := get .Values.policyCategories $category }}
55

@@ -13,7 +13,7 @@ metadata:
1313
pod-policies.kyverno.io/autogen-controllers: {{ . }}
1414
{{- end }}
1515
policies.kyverno.io/title: Disable automountServiceAccountToken
16-
policies.kyverno.io/category: {{ $category }}, EKS Best Practices
16+
policies.kyverno.io/category: {{ $category }}
1717
policies.kyverno.io/severity: medium
1818
policies.kyverno.io/subject: Pod
1919
kyverno.io/kyverno-version: 1.6.0

charts/kyverno-policies/templates/other/disableServiceDiscovery.yaml renamed to charts/kyverno-policies/templates/bestPractices/disableServiceDiscovery.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $name := "disableServiceDiscovery" }}
2-
{{- $category := "other" }}
2+
{{- $category := "bestPractices" }}
33
{{- $policyValues := get .Values.policies $name }}
44
{{- $categoryValues := get .Values.policyCategories $category }}
55

@@ -13,7 +13,7 @@ metadata:
1313
pod-policies.kyverno.io/autogen-controllers: {{ . }}
1414
{{- end }}
1515
policies.kyverno.io/title: Disable Service Discovery
16-
policies.kyverno.io/category: {{ $category }}, EKS Best Practices
16+
policies.kyverno.io/category: {{ $category }}
1717
policies.kyverno.io/subject: Pod
1818
kyverno.io/kyverno-version: 1.8.0-rc2
1919
kyverno.io/kubernetes-version: "1.24"

0 commit comments

Comments
 (0)