Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
registry-server: ghcr.io
registry-username: ${{ github.actor }}
image: ${{ github.repository }}
version: 0.6.1
version: 0.6.1+kadras.1
secrets:
pull-request-token: ${{ secrets.GH_ORG_PAT }}
119 changes: 71 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,52 @@

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.

## Components

* Metrics Server

## Prerequisites

* Install the [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl) CLI to manage Carvel packages in a convenient way.
* Ensure [kapp-controller](https://carvel.dev/kapp-controller) is deployed in your Kubernetes cluster. You can do that with Carvel
[`kapp`](https://carvel.dev/kapp/docs/latest/install) (recommended choice) or `kubectl`.
* Kubernetes 1.24+
* Carvel [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl) CLI.
* 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`.

```shell
kapp deploy -a kapp-controller -y \
-f https://github.com/vmware-tanzu/carvel-kapp-controller/releases/latest/download/release.yml
```
```shell
kapp deploy -a kapp-controller -y \
-f https://github.com/vmware-tanzu/carvel-kapp-controller/releases/latest/download/release.yml
```

## Installation

You can install the Metrics Server package directly or rely on the [Kadras package repository](https://github.com/arktonix/carvel-packages)
(recommended choice).
First, add the [Kadras package repository](https://github.com/arktonix/kadras-packages) to your Kubernetes cluster.

Follow the [instructions](https://github.com/arktonix/carvel-packages) to add the Kadras package repository to your Kubernetes cluster.
```shell
kubectl create namespace kadras-packages
kctrl package repository add -r kadras-repo \
--url ghcr.io/arktonix/kadras-packages \
-n kadras-packages
```

If you don't want to use the Kadras package repository, you can create the necessary `PackageMetadata` and
`Package` resources for the Metrics Server package directly.
Then, install the Metrics Server package.

```shell
kubectl create namespace carvel-packages
kapp deploy -a metrics-server-package -n carvel-packages -y \
-f https://github.com/arktonix/package-for-metrics-server/releases/latest/download/metadata.yml \
-f https://github.com/arktonix/package-for-metrics-server/releases/latest/download/package.yml
```
```shell
kctrl package install -i metrics-server \
-p metrics-server.packages.kadras.io \
-v 0.6.1+kadras.1 \
-n kadras-packages
```

Either way, you can then install the Metrics Server package using [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl).
### Verification

```shell
kctrl package install -i metrics-server \
-p metrics-server.packages.kadras.io \
-v 0.6.1 \
-n carvel-packages
```
You can verify the list of installed Carvel packages and their status.

You can retrieve the list of available versions with the following command.
```shell
kctrl package installed list -n kadras-packages
```

```shell
kctrl package available list -p metrics-server.packages.kadras.io
```
### Version

You can check the list of installed packages and their status as follows.
You can get the list of Metrics Server versions available in the Kadras package repository.

```shell
kctrl package installed list -n carvel-packages
```
```shell
kctrl package available list -p metrics-server.packages.kadras.io -n kadras-packages
```

## Configuration

Expand All @@ -71,25 +65,54 @@ The Metrics Server package has the following configurable properties.

You can define your configuration in a `values.yml` file.

```yaml
metricsServer:
```yaml
metricsServer:
config:
securePort: 4443
```
securePort: 4443
```

Then, reference it from the `kctrl` command when installing or upgrading the package.

```shell
kctrl package install -i metrics-server \
```shell
kctrl package install -i metrics-server \
-p metrics-server.packages.kadras.io \
-v 0.6.1 \
-n carvel-packages \
-v 0.6.1+kadras.1 \
-n kadras-packages \
--values-file values.yml
```
```

## Upgrading

You can upgrade an existing package to a newer version using `kctrl`.

```shell
kctrl package installed update -i metrics-server \
-v <new-version> \
-n kadras-packages
```

You can also update an existing package with a newer `values.yml` file.

```shell
kctrl package installed update -i metrics-server \
-n kadras-packages \
--values-file values.yml
```

## Other

The recommended way of installing the Metrics Server package is via the [Kadras package repository](https://github.com/arktonix/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`.

```shell
kubectl create namespace kadras-packages
kapp deploy -a metrics-server-package -n kadras-packages -y \
-f https://github.com/arktonix/package-for-metrics-server/releases/latest/download/metadata.yml \
-f https://github.com/arktonix/package-for-metrics-server/releases/latest/download/package.yml
```

## Documentation
## Support and Documentation

For documentation specific to Metrics Server, check out [https://github.com/kubernetes-sigs/metrics-server](https://github.com/kubernetes-sigs/metrics-server).
For support and documentation specific to Metrics Server, check out [https://github.com/kubernetes-sigs/metrics-server](https://github.com/kubernetes-sigs/metrics-server).

## References

Expand Down
5 changes: 5 additions & 0 deletions package/config/kapp-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
apiVersion: kapp.k14s.io/v1alpha1
kind: Config

minimumRequiredVersion: 0.50.0

#! Rebase rules explicitly define how kapp should merge resources during an update.
#! See more about the resource merge method: https://carvel.dev/kapp/docs/latest/merge-method.
rebaseRules:
- path: [spec, caBundle]
type: remove
Expand Down
27 changes: 27 additions & 0 deletions package/config/overlays/registry-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")

#@ secret_name = "private-registry-secret"

#! This Secret will be populated by secretgen-controller with the credentials
#! to authenticate with the container registry (if authentication is required).
---
apiVersion: v1
kind: Secret
metadata:
name: #@ secret_name
namespace: #@ data.values.namespace
annotations:
secretgen.carvel.dev/image-pull-secret: ""
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: e30K

#@overlay/match by=overlay.subset({"kind":"Deployment","metadata":{"namespace":data.values.namespace}}),expects="1+"
---
spec:
template:
spec:
#@overlay/match missing_ok=True
imagePullSecrets:
- name: #@ secret_name
1 change: 0 additions & 1 deletion package/config/values-schema.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#@data/values-schema

#@schema/desc "OpenAPIv3 Schema for metrics-server"
---
#@schema/desc "The namespace in which metrics-server is deployed"
namespace: kube-system
Expand Down
12 changes: 0 additions & 12 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,12 @@ while [ $(kubectl get configmap --no-headers | wc -l) -eq 0 ] ; do
sleep 3
done

echo -e "\n🔌 Installing test dependencies..."

if [ -f test/test-dependencies ]; then
kapp deploy -a test-dependencies -f test/test-dependencies -y
fi

echo -e "📦 Deploying Carvel package...\n"

cd package
kctrl dev -f package-resources.yml --local -y
cd ..

echo -e "💾 Installing test data..."

if [ -f test/test-data ]; then
kapp deploy -a test-data -f test/test-data -y
fi

echo -e "🎮 Verifying package..."

status=$(kapp inspect -a metrics-server.app --status --json | jq '.Lines[1]' -)
Expand Down