Add node-labeler helm chart
Change-Id: I286c283272a86eff81b479a9dad29eb2d958fecc
This commit is contained in:
parent
22efae206b
commit
d3f81d5c4a
11
charts/node-labeler/Chart.yaml
Executable file
11
charts/node-labeler/Chart.yaml
Executable file
@ -0,0 +1,11 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
name: node-labeler
|
||||
version: 0.5.3
|
||||
description: Node labeler for Kubernetes
|
||||
home: https://github.com/vexxhost/node-labeler
|
||||
maintainers:
|
||||
- name: Mohammed Naser
|
||||
email: mnaser@vexxhost.com
|
||||
url: https://github.com/mnaser
|
||||
appVersion: v0.1.1
|
41
charts/node-labeler/templates/_helpers.tpl
Executable file
41
charts/node-labeler/templates/_helpers.tpl
Executable file
@ -0,0 +1,41 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "node-labeler.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 "node-labeler.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 -}}
|
||||
|
||||
{{/*
|
||||
Generate basic labels
|
||||
*/}}
|
||||
{{- define "node-labeler.labels" }}
|
||||
app.kubernetes.io/name: {{ include "node-labeler.fullname" . }}
|
||||
app.kubernetes.io/instance: {{ include "node-labeler.chart" . }}
|
||||
app.kubernetes.io/version: {{ .Chart.Version }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "node-labeler.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
15
charts/node-labeler/templates/clusterrole.yaml
Executable file
15
charts/node-labeler/templates/clusterrole.yaml
Executable file
@ -0,0 +1,15 @@
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
labels:
|
||||
{{ include "node-labeler.labels" . | indent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
15
charts/node-labeler/templates/clusterrolebinding.yaml
Executable file
15
charts/node-labeler/templates/clusterrolebinding.yaml
Executable file
@ -0,0 +1,15 @@
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
labels:
|
||||
{{ include "node-labeler.labels" . | indent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
41
charts/node-labeler/templates/daemonset.yaml
Executable file
41
charts/node-labeler/templates/daemonset.yaml
Executable file
@ -0,0 +1,41 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{ include "node-labeler.labels" . | indent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{ include "node-labeler.labels" . | indent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{ include "node-labeler.labels" . | indent 8 }}
|
||||
spec:
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
serviceAccountName: {{ include "node-labeler.fullname" . }}
|
||||
containers:
|
||||
- name: node-labeler
|
||||
image: vexxhost/node-labeler:latest
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "50Mi"
|
||||
env:
|
||||
- name: NODE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 10%
|
8
charts/node-labeler/templates/serviceaccount.yaml
Executable file
8
charts/node-labeler/templates/serviceaccount.yaml
Executable file
@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "node-labeler.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{ include "node-labeler.labels" . | indent 4 }}
|
1
charts/node-labeler/values.yaml
Executable file
1
charts/node-labeler/values.yaml
Executable file
@ -0,0 +1 @@
|
||||
---
|
22
playbooks/node-labeler/pre.yaml
Executable file
22
playbooks/node-labeler/pre.yaml
Executable file
@ -0,0 +1,22 @@
|
||||
---
|
||||
# Copyright (c) 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
- name: helm-template
|
||||
helm_release_name: node-labeler
|
||||
helm_chart: ./charts/node-labeler
|
||||
helm_values_file: ./charts/node-labeler/values.yaml
|
40
playbooks/node-labeler/run.yaml
Executable file
40
playbooks/node-labeler/run.yaml
Executable file
@ -0,0 +1,40 @@
|
||||
---
|
||||
# Copyright (c) 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Get node name
|
||||
shell: kubectl get nodes -o=name | head -1
|
||||
register: _node_name
|
||||
until: _node_name is success
|
||||
retries: 60
|
||||
delay: 5
|
||||
failed_when: |
|
||||
{{ _node_name.stdout_lines | length == 0 }}
|
||||
|
||||
- name: Get the node labels
|
||||
shell: kubectl label {{ _node_name.stdout }} --list
|
||||
register: _node_labels
|
||||
|
||||
- name: Check the label node.vexxhost.com/vendor is set
|
||||
fail:
|
||||
msg: node.vexxhost.com/vendor label is missing.
|
||||
when: (_node_labels.stdout is search('node.vexxhost.com/vendor'))==False
|
||||
|
||||
- name: Check the label node.vexxhost.com/product is set
|
||||
fail:
|
||||
msg: node.vexxhost.com/product label is missing.
|
||||
when: (_node_labels.stdout is search('node.vexxhost.com/product'))==False
|
18
zuul.d/project.yaml
Executable file
18
zuul.d/project.yaml
Executable file
@ -0,0 +1,18 @@
|
||||
- job:
|
||||
name: helm-charts:node-labeler
|
||||
parent: apply-helm-charts
|
||||
pre-run: playbooks/node-labeler/pre.yaml
|
||||
run: playbooks/node-labeler/run.yaml
|
||||
vars:
|
||||
minikube_dns_resolvers: [1.1.1.1, 8.8.8.8]
|
||||
collect_kubernetes_logs_namespace: kube-system
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- chart-testing-lint
|
||||
- helm-charts:node-labeler
|
||||
gate:
|
||||
jobs:
|
||||
- chart-testing-lint
|
||||
- helm-charts:node-labeler
|
Loading…
Reference in New Issue
Block a user