Skip to content

Commit b7be2c0

Browse files
authored
Improve config, tests and docs (#12)
Improve config, tests and docs
1 parent 096a686 commit b7be2c0

33 files changed

+314
-278
lines changed

.github/CODEOWNERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @ThomasVitale

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Tell us about a problem you are experiencing
44
title: ''
5-
labels: bug
5+
labels: bug, triage
66
assignees: ''
77

88
---
@@ -19,10 +19,8 @@ assignees: ''
1919
**Anything else you would like to add:**
2020
[Additional information that will assist in solving the issue.]
2121

22-
**Additional context:**
23-
Add any other context about the problem here.
24-
2522
**Environment:**
2623

27-
- Kubernetes version (execute `kubectl version`):
28-
- kapp-controller version (execute `kubectl get deployment -n kapp-controller kapp-controller -o yaml` and the annotation is `kbld.k14s.io/images`):
24+
* Kubernetes version (execute `kubectl version`):
25+
* kctrl version (execute `kctrl version`):
26+
* kapp-controller version (execute `kubectl get deployment -n kapp-controller kapp-controller -o yaml` and the annotation is `kbld.k14s.io/images`):

.github/ISSUE_TEMPLATE/feature-request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest an idea for this project
44
title: ''
5-
labels: enhancement
5+
labels: enhancement, triage
66
assignees: ''
77

88
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Other issue or question
3+
about: Free form issue or question
4+
title: ''
5+
labels: triage
6+
assignees: ''
7+
8+
---

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
registry-server: ghcr.io
1919
registry-username: ${{ github.actor }}
2020
image: ${{ github.repository }}
21-
version: 0.6.2+kadras.1
21+
version: 0.6.2+kadras.2
2222
secrets:
2323
pull-request-token: ${{ secrets.GH_ORG_PAT }}

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ jobs:
88
name: Configuration Tests
99
permissions:
1010
contents: read
11-
uses: kadras-io/github-reusable-workflows/.github/workflows/package-test-config.yml@main
12-
with:
13-
command: make test-config
11+
uses: kadras-io/github-reusable-workflows/.github/workflows/carvel-package-test-config.yml@main
1412

1513
test-integration:
1614
name: Integration Tests
15+
strategy:
16+
matrix:
17+
k8s_version: [v1.24, v1.25, v1.26]
1718
permissions:
1819
contents: read
19-
uses: kadras-io/github-reusable-workflows/.github/workflows/package-test-integration.yml@main
20+
uses: kadras-io/github-reusable-workflows/.github/workflows/carvel-package-test-integration.yml@main
2021
with:
21-
command: make test-integration
22+
k8s_version: ${{ matrix.k8s_version }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
### Carvel ###
22
carvel-artifacts/
33
repo/
4+
schema-openapi.yml
5+
6+
### KUTTL ###
7+
test/integration/kubeconfig
8+
test/integration/kuttl-artifacts
9+
kubeconfig
410

511
# Binaries for programs and plugins
612
*.exe

MAINTAINERS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Maintainers
2+
3+
* Thomas Vitale | [ThomasVitale](https://github.com/ThomasVitale)

Makefile

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
1+
K8S_VERSION=v1.26
2+
3+
# Build package configuration
4+
build: package
5+
cd package && kctrl package init
6+
7+
# Prepare cluster for development workflow
8+
prepare: test/setup
9+
ytt -f test/setup/assets/namespace.yml | kapp deploy -a ns -f- -y
10+
ytt -f test/setup/assets/rbac.yml | kapp deploy -a rbac -f- -y
11+
kubectl config set-context --current --namespace=tests
12+
13+
# Inner development loop
14+
dev: package
15+
cd package && kctrl dev -f package-resources.yml --local -y
16+
17+
# Clean development environment
18+
clean:
19+
cd package && kctrl dev -f package-resources.yml --local -y --delete
20+
21+
# Process the configuration manifests with ytt
22+
ytt:
23+
ytt --file package/config
24+
125
# Use ytt to generate an OpenAPI specification
226
schema:
3-
ytt -f package/config/values-schema.yml --data-values-schema-inspect -o openapi-v3 > package/config/schema-openapi.yml
27+
ytt -f package/config/values-schema.yml --data-values-schema-inspect -o openapi-v3 > schema-openapi.yml
428

5-
# Check the ytt-annotated Kubernetes configuration
29+
# Check the ytt-annotated Kubernetes configuration and its validation
630
test-config:
7-
ytt --file package/config
31+
ytt -f package/config | kubeconform -ignore-missing-schemas -summary
832

9-
# Run package tests
10-
test-integration: test/test.sh
11-
chmod +x test/test.sh
12-
./test/test.sh
33+
# Run package integration tests
34+
test-integration: test/integration
35+
kubectl kuttl test --config test/integration/kuttl-test.yml --kind-config test/setup/kind/$(K8S_VERSION)/kind-config.yml

README.md

Lines changed: 59 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,121 @@
11
# Metrics Server
22

3-
<a href="https://slsa.dev/spec/v0.1/levels"><img src="https://slsa.dev/images/gh-badge-level3.svg" alt="The SLSA Level 3 badge"></a>
3+
![Test Workflow](https://github.com/kadras-io/package-for-kpack/actions/workflows/test.yml/badge.svg)
4+
![Release Workflow](https://github.com/kadras-io/package-for-kpack/actions/workflows/release.yml/badge.svg)
5+
[![The SLSA Level 3 badge](https://slsa.dev/images/gh-badge-level3.svg)](https://slsa.dev/spec/v0.1/levels)
6+
[![The Apache 2.0 license badge](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7+
[![Follow us on Twitter](https://img.shields.io/static/v1?label=Twitter&message=Follow&color=1DA1F2)](https://twitter.com/kadrasIO)
48

5-
This project provides a [Carvel package](https://carvel.dev/kapp-controller/docs/latest/packaging) for [Metrics Server](https://github.com/kubernetes-sigs/metrics-server), a scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
9+
A Carvel package for [Metrics Server](https://github.com/kubernetes-sigs/metrics-server), a scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
610

7-
## Prerequisites
11+
## 🚀&nbsp; Getting Started
12+
13+
### Prerequisites
814

915
* Kubernetes 1.24+
1016
* Carvel [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl) CLI.
1117
* Carvel [kapp-controller](https://carvel.dev/kapp-controller) deployed in your Kubernetes cluster. You can install it with Carvel [`kapp`](https://carvel.dev/kapp/docs/latest/install) (recommended choice) or `kubectl`.
1218

1319
```shell
1420
kapp deploy -a kapp-controller -y \
15-
-f https://github.com/vmware-tanzu/carvel-kapp-controller/releases/latest/download/release.yml
21+
-f https://github.com/carvel-dev/kapp-controller/releases/latest/download/release.yml
1622
```
1723

18-
## Installation
24+
### Installation
1925

20-
First, add the [Kadras package repository](https://github.com/kadras-io/kadras-packages) to your Kubernetes cluster.
26+
Add the Kadras [package repository](https://github.com/kadras-io/kadras-packages) to your Kubernetes cluster:
2127

2228
```shell
2329
kubectl create namespace kadras-packages
24-
kctrl package repository add -r kadras-repo \
30+
kctrl package repository add -r kadras-packages \
2531
--url ghcr.io/kadras-io/kadras-packages \
2632
-n kadras-packages
2733
```
2834

29-
Then, install the Metrics Server package.
35+
<details><summary>Installation without package repository</summary>
36+
The recommended way of installing the Metrics Server package is via the Kadras <a href="https://github.com/kadras-io/kadras-packages">package repository</a>. If you prefer not using the repository, you can add the package definition directly using <a href="https://carvel.dev/kapp/docs/latest/install"><code>kapp</code></a> or <code>kubectl</code>.
3037

3138
```shell
32-
kctrl package install -i metrics-server \
33-
-p metrics-server.packages.kadras.io \
34-
-v 0.6.2+kadras.1 \
35-
-n kadras-packages
39+
kubectl create namespace kadras-packages
40+
kapp deploy -a metrics-server-package -n kadras-packages -y \
41+
-f https://github.com/kadras-io/package-for-metrics-server/releases/latest/download/metadata.yml \
42+
-f https://github.com/kadras-io/package-for-metrics-server/releases/latest/download/package.yml
3643
```
44+
</details>
3745

38-
### Verification
39-
40-
You can verify the list of installed Carvel packages and their status.
46+
Install the Metrics Server package:
4147

4248
```shell
43-
kctrl package installed list -n kadras-packages
49+
kctrl package install -i metrics-server \
50+
-p metrics-server.packages.kadras.io \
51+
-v ${VERSION} \
52+
-n kadras-packages
4453
```
4554

46-
### Version
55+
> **Note**
56+
> You can find the `${VERSION}` value by retrieving the list of package versions available in the Kadras package repository installed on your cluster.
57+
>
58+
> ```shell
59+
> kctrl package available list -p metrics-server.packages.kadras.io -n kadras-packages
60+
> ```
4761
48-
You can get the list of Metrics Server versions available in the Kadras package repository.
62+
Verify the installed packages and their status:
4963
5064
```shell
51-
kctrl package available list -p metrics-server.packages.kadras.io -n kadras-packages
65+
kctrl package installed list -n kadras-packages
5266
```
5367
54-
## Configuration
68+
## 📙&nbsp; Documentation
5569

56-
The Metrics Server package has the following configurable properties.
70+
Documentation, tutorials and examples for this package are available in the [docs](docs) folder.
71+
For documentation specific to Metrics Server, check out [github.com/kubernetes-sigs/metrics-server](https://github.com/kubernetes-sigs/metrics-server).
5772

58-
| Value | Required/Optional | Description |
59-
|-------|-------------------|-------------|
60-
| `metricsServer.createNamespace` | Optional | Whether to create namespace specified for metrics-server. Default value is `true`. |
61-
| `metricsServer.namespace` | Optional | The namespace value used by older templates, will be overwriten if top level namespace is present, kept for backward compatibility. Default value is `null`. |
62-
| `metricsServer.config.securePort` | Optional | TThe HTTPS secure port used by metrics-server. Default: `4443`. |
63-
| `metricsServer.config.updateStrategy` | Optional | TThe update strategy of the metrics-server deployment. Default: `RollingUpdate` |
64-
| `metricsServer.config.probe.failureThreshold` | Optional | Probe failureThreshold of metrics-server deployment. Default: `3`. |
65-
| `metricsServer.config.probe.periodSeconds` | Optional | Probe period of metrics-server deployment. Default: `10` . |
66-
| `metricsServer.config.apiServiceInsecureTLS`| Optional | Whether to enable insecure TLS for metrics-server api service. Default: `True`. |
73+
## 🎯&nbsp; Configuration
6774

68-
You can define your configuration in a `values.yml` file.
75+
The Metrics Server package can be customized via a `values.yml` file.
6976

7077
```yaml
7178
metricsServer:
7279
config:
7380
securePort: 4443
7481
```
7582
76-
Then, reference it from the `kctrl` command when installing or upgrading the package.
83+
Reference the `values.yml` file from the `kctrl` command when installing or upgrading the package.
7784

7885
```shell
7986
kctrl package install -i metrics-server \
8087
-p metrics-server.packages.kadras.io \
81-
-v 0.6.2+kadras.1 \
88+
-v ${VERSION} \
8289
-n kadras-packages \
8390
--values-file values.yml
8491
```
8592

86-
## Upgrading
87-
88-
You can upgrade an existing package to a newer version using `kctrl`.
93+
### Values
8994

90-
```shell
91-
kctrl package installed update -i metrics-server \
92-
-v <new-version> \
93-
-n kadras-packages
94-
```
95-
96-
You can also update an existing package with a newer `values.yml` file.
97-
98-
```shell
99-
kctrl package installed update -i metrics-server \
100-
-n kadras-packages \
101-
--values-file values.yml
102-
```
103-
104-
## Other
95+
The Metrics Server package has the following configurable properties.
10596

106-
The recommended way of installing the Metrics Server package is via the [Kadras package repository](https://github.com/kadras-io/kadras-packages). If you prefer not using the repository, you can install the package by creating the necessary Carvel `PackageMetadata` and `Package` resources directly using [`kapp`](https://carvel.dev/kapp/docs/latest/install) or `kubectl`.
97+
<details><summary>Configurable properties</summary>
10798

108-
```shell
109-
kubectl create namespace kadras-packages
110-
kapp deploy -a metrics-server-package -n kadras-packages -y \
111-
-f https://github.com/kadras-io/package-for-metrics-server/releases/latest/download/metadata.yml \
112-
-f https://github.com/kadras-io/package-for-metrics-server/releases/latest/download/package.yml
113-
```
99+
| Value | Required/Optional | Description |
100+
|-------|-------------------|-------------|
101+
| `metricsServer.createNamespace` | Optional | Whether to create namespace specified for metrics-server. Default value is `true`. |
102+
| `metricsServer.namespace` | Optional | The namespace value used by older templates, will be overwriten if top level namespace is present, kept for backward compatibility. Default value is `null`. |
103+
| `metricsServer.config.securePort` | Optional | TThe HTTPS secure port used by metrics-server. Default: `4443`. |
104+
| `metricsServer.config.updateStrategy` | Optional | TThe update strategy of the metrics-server deployment. Default: `RollingUpdate` |
105+
| `metricsServer.config.probe.failureThreshold` | Optional | Probe failureThreshold of metrics-server deployment. Default: `3`. |
106+
| `metricsServer.config.probe.periodSeconds` | Optional | Probe period of metrics-server deployment. Default: `10` . |
107+
| `metricsServer.config.apiServiceInsecureTLS`| Optional | Whether to enable insecure TLS for metrics-server api service. Default: `True`. |
114108

115-
## Support and Documentation
109+
</details>
116110

117-
For support and documentation specific to Metrics Server, check out [https://github.com/kubernetes-sigs/metrics-server](https://github.com/kubernetes-sigs/metrics-server).
111+
## 🛡️&nbsp; Security
118112

119-
## References
113+
The security process for reporting vulnerabilities is described in [SECURITY.md](SECURITY.md).
120114

121-
This package is based on the original Metrics Server package used in [Tanzu Community Edition](https://github.com/vmware-tanzu/community-edition) before its retirement.
115+
## 🖊️&nbsp; License
122116

123-
## Supply Chain Security
117+
This project is licensed under the **Apache License 2.0**. See [LICENSE](LICENSE) for more information.
124118

125-
This project is compliant with level 3 of the [SLSA Framework](https://slsa.dev).
119+
## 🙏&nbsp; Acknowledgments
126120

127-
<img src="https://slsa.dev/images/SLSA-Badge-full-level3.svg" alt="The SLSA Level 3 badge" width=200>
121+
This package is inspired by the original kpack package used in the [Tanzu Community Edition](https://github.com/vmware-tanzu/community-edition) project before its retirement.

0 commit comments

Comments
 (0)