-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Steve Hipwell <steve.hipwell@proagrica.com>
- Loading branch information
1 parent
ab84346
commit c379e31
Showing
21 changed files
with
637 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Lint and Test Charts | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "charts/**" | ||
|
||
jobs: | ||
lint-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Set up chart-testing | ||
uses: helm/chart-testing-action@v2.0.1 | ||
|
||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
run: | | ||
changed=$(ct list-changed) | ||
if [[ -n "$changed" ]]; then | ||
echo "::set-output name=changed::true" | ||
fi | ||
- name: Run chart-testing (lint) | ||
run: ct lint | ||
|
||
- name: Create Kind cluster | ||
uses: helm/kind-action@v1.0.0 | ||
if: steps.list-changed.outputs.changed == 'true' | ||
|
||
- name: Run chart-testing (install) | ||
run: ct install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Release Charts | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
release: | ||
if: startsWith(github.ref, "refs/tags/v") | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.5.2 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.1.0 | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
CR_RELEASE_NAME_TEMPLATE: "metrics-server-helm-chart-{{ .Version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/_output | ||
metrics-server | ||
!charts/metrics-server | ||
.cover | ||
|
||
# Vim-related files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
name: metrics-server | ||
description: Metrics Server is a scalable, efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines. | ||
type: application | ||
version: 3.0.0 | ||
appVersion: 0.4.2 | ||
keywords: | ||
- kubernetes | ||
- metrics-server | ||
- metrics | ||
home: https://github.com/kubernetes-sigs/metrics-server | ||
icon: https://avatars.githubusercontent.com/u/36015203?s=400&v=4 | ||
sources: | ||
- https://github.com/kubernetes-sigs/metrics-server | ||
maintainers: | ||
- name: stevehipwell | ||
email: steve.hipwell@gmail.com | ||
annotations: | ||
artifacthub.io/changes: | | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Kubernetes Metrics Server | ||
|
||
[Metrics Server](https://github.com/kubernetes-sigs/metrics-server/) is a scalable, efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines. | ||
|
||
## Installing the Chart | ||
|
||
Before you can install the chart you will need to add the `metrics-server` repo to [Helm](https://helm.sh/). | ||
|
||
```shell | ||
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/ | ||
``` | ||
|
||
After you've installed the repo you can install the chart. | ||
|
||
```shell | ||
helm upgrade --install metrics-server/metrics-server | ||
``` | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the _Metrics Server_ chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | | ||
| `image.repository` | Image repository. | `k8s.gcr.io/metrics-server/metrics-server` | | ||
| `image.tag` | Image tag. | `v{{ .Chart.AppVersion }}` | | ||
| `image.pullPolPcy` | Image pull policy. | `IfNotPresent` | | ||
| `imagePullSecrets` | Image pull secrets. | `[]` | | ||
| `nameOverride` | Override the `name` of the chart. | `nil` | | ||
| `fullnameOverride` | Override the `fullname` of the chart. | `nil` | | ||
| `serviceAccount.create` | If `true`, create a new `serviceaccount`. | `true` | | ||
| `serviceAccount.annotations` | Annotations to add to the service account. | `{}` | | ||
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the _fullname_ template. | `nil` | | ||
| `rbac.create` | If `true`, create the RBAC resources. | `true` | | ||
| `rbac.pspEnabled` | If `true`, create a `PodSecurityPolicy` resource. | `false` | | ||
| `apiService.create` | If `true`, create the `v1beta1.metrics.k8s.io` API service. You typically want this enabled! If you disable API service creation you have to manage it outside of this chart for e.g horizontal pod autoscaling to work with this release. | `false` | | ||
| `podAnnotations` | Annotations to add to the pod. | `{}` | | ||
| `podLabels` | Labels to add to the pod. | `{}` | | ||
| `podSecurityContext` | Security context for the pod. | `{}` | | ||
| `securityContext` | Security context for the _metrics-server_ container. | _See values.yaml_ | | ||
| `priorityClassName` | Priority class name to use. | `system-cluster-critical` | | ||
| `hostNetwork.enabled` | If `true`, start _metric-server_ in hostNetwork mode. You would require this enabled if you use alternate overlay networking for pods and API server unable to communicate with metrics-server. As an example, this is required if you use Weave network on EKS. | `false` | | ||
| `replicas` | Number of replicas to run. | `1` | | ||
| `args` | Additional arguments to pass to the _metrics-server_ command. | `[]` | | ||
| `livenessProbe` | Liveness probe. | See _values.yaml_ | | ||
| `readinessProbe` | Readiness probe. | See _values.yaml_ | | ||
| `service.type` | Service type. | `ClusterIP` | | ||
| `service.port` | Service port. | `443` | | ||
| `service.annotations` | Annotations to add to the service. | `{}` | | ||
| `service.labels` | Labels to add to the service. | `{}` | | ||
| `resources` | Resource requests and limits. | `{}` | | ||
| `nodeSelector` | Node labels for pod assignment. | `{}` | | ||
| `tolerations` | Toleration labels for pod assignment. | `[]` | | ||
| `affinity` | Affinity settings for pod assignment. | `{}` | | ||
| `podDisruptionBudget.enabled` | If `true`, create `PodDisruptionBudget` resource. | `{}` | | ||
| `podDisruptionBudget.minAvailable` | Set the `PodDisruptionBugdet` minimum available pods. | `nil` | | ||
| `podDisruptionBudget.maxUnavailable` | Set the `PodDisruptionBugdet` maximum unavailable pods. | `nil` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
The metric server has been deployed. | ||
{{ if .Values.apiService.create }} | ||
In a few minutes you should be able to list metrics using the following | ||
command: | ||
|
||
kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes" | ||
{{ else }} | ||
NOTE: You have disabled the API service creation for this release. The metrics | ||
API will not work with this release unless you configure the metrics API | ||
service outside of this Helm chart. | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "metrics-server.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "metrics-server.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "metrics-server.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "metrics-server.labels" -}} | ||
helm.sh/chart: {{ include "metrics-server.chart" . }} | ||
{{ include "metrics-server.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "metrics-server.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "metrics-server.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "metrics-server.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "metrics-server.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if .Values.apiService.create -}} | ||
apiVersion: apiregistration.k8s.io/v1 | ||
kind: APIService | ||
metadata: | ||
name: v1beta1.metrics.k8s.io | ||
labels: | ||
{{- include "metrics-server.labels" . | nindent 4 }} | ||
spec: | ||
group: metrics.k8s.io | ||
groupPriorityMinimum: 100 | ||
insecureSkipTLSVerify: true | ||
service: | ||
name: {{ include "metrics-server.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
version: v1beta1 | ||
versionPriority: 100 | ||
{{- end -}} |
21 changes: 21 additions & 0 deletions
21
charts/metrics-server/templates/clusterrole-aggregated-reader.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ printf "system:%s-aggregated-reader" (include "metrics-server.name" .) }} | ||
labels: | ||
{{- include "metrics-server.labels" . | nindent 4 }} | ||
rbac.authorization.k8s.io/aggregate-to-admin: "true" | ||
rbac.authorization.k8s.io/aggregate-to-edit: "true" | ||
rbac.authorization.k8s.io/aggregate-to-view: "true" | ||
rules: | ||
- apiGroups: | ||
- metrics.k8s.io | ||
resources: | ||
- pods | ||
- nodes | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ printf "system:%s" (include "metrics-server.fullname" .) }} | ||
labels: | ||
{{- include "metrics-server.labels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
- nodes | ||
- nodes/stats | ||
- namespaces | ||
- configmaps | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
{{- if .Values.rbac.pspEnabled }} | ||
- apiGroups: | ||
- extensions | ||
- policy | ||
resources: | ||
- podsecuritypolicies | ||
resourceNames: | ||
- {{ printf "privileged-%s" (include "metrics-server.fullname" .) }} | ||
verbs: | ||
- use | ||
{{- end -}} | ||
{{- end -}} |
16 changes: 16 additions & 0 deletions
16
charts/metrics-server/templates/clusterrolebinding-auth-delegator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ printf "%s:system:auth-delegator" (include "metrics-server.fullname" .) }} | ||
labels: | ||
{{- include "metrics-server.labels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:auth-delegator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "metrics-server.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ printf "system:%s" (include "metrics-server.fullname" .) }} | ||
labels: | ||
{{- include "metrics-server.labels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:{{ template "metrics-server.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "metrics-server.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
Oops, something went wrong.