(feat) Add Promtail and Netshoot addons (#1058)
* add promtail addon * Add Netshoot addon * update common to include envList for addons * Add basic promtail and netshoot unittests
This commit is contained in:
committed by
GitHub
parent
1346251bd0
commit
2b5fe533f6
@@ -15,4 +15,4 @@ maintainers:
|
||||
name: common
|
||||
sources: null
|
||||
type: library
|
||||
version: 8.0.10
|
||||
version: 8.0.11
|
||||
|
||||
@@ -12,8 +12,16 @@ imagePullPolicy: {{ .Values.codeserverImage.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.addons.codeserver.env }}
|
||||
env:
|
||||
{{- range $envList := .Values.addons.codeserver.envList }}
|
||||
{{- if and $envList.name $envList.value }}
|
||||
- name: {{ $envList.name }}
|
||||
value: {{ $envList.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for codeserver environment variable" }}
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
{{- with .Values.addons.codeserver.env }}
|
||||
{{- range $k, $v := . }}
|
||||
- name: {{ $k }}
|
||||
value: {{ $v | quote }}
|
||||
|
||||
@@ -9,8 +9,17 @@ imagePullPolicy: {{ .Values.netshootImage.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.addons.netshoot.env }}
|
||||
|
||||
env:
|
||||
{{- range $envList := .Values.addons.netshoot.envList }}
|
||||
{{- if and $envList.name $envList.value }}
|
||||
- name: {{ $envList.name }}
|
||||
value: {{ $envList.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for netshoot environment variable" }}
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
{{- with .Values.addons.netshoot.env }}
|
||||
{{- range $k, $v := . }}
|
||||
- name: {{ $k }}
|
||||
value: {{ $v | quote }}
|
||||
|
||||
@@ -12,8 +12,17 @@ imagePullPolicy: {{ .Values.promtailImage.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.addons.promtail.env }}
|
||||
|
||||
env:
|
||||
{{- range $envList := .Values.addons.promtail.envList }}
|
||||
{{- if and $envList.name $envList.value }}
|
||||
- name: {{ $envList.name }}
|
||||
value: {{ $envList.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for promtail environment variable" }}
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
{{- with .Values.addons.promtail.env }}
|
||||
{{- range $k, $v := . }}
|
||||
- name: {{ $k }}
|
||||
value: {{ $v | quote }}
|
||||
|
||||
@@ -726,8 +726,8 @@ addons:
|
||||
# -- All variables specified here will be added to the vpn sidecar container
|
||||
# See the documentation of the VPN image for all config values
|
||||
envList: []
|
||||
# name: someenv
|
||||
# value: somevalue
|
||||
#- name: someenv
|
||||
# value: somevalue
|
||||
|
||||
# -- Provide a customized vpn configuration file to be used by the VPN.
|
||||
configFile:
|
||||
@@ -750,6 +750,12 @@ addons:
|
||||
# -- Set any environment variables for code-server here
|
||||
env: {}
|
||||
# TZ: UTC
|
||||
|
||||
# -- All variables specified here will be added to the codeserver sidecar container
|
||||
# See the documentation of the codeserver image for all config values
|
||||
envList: []
|
||||
#- name: someenv
|
||||
# value: somevalue
|
||||
# -- Set codeserver command line arguments.
|
||||
# Consider setting --user-data-dir to a persistent location to preserve code-server setting changes
|
||||
args:
|
||||
@@ -825,6 +831,11 @@ addons:
|
||||
enabled: false
|
||||
# -- Set any environment variables for promtail here
|
||||
env: {}
|
||||
# -- All variables specified here will be added to the promtail sidecar container
|
||||
# See the documentation of the promtail image for all config values
|
||||
envList: []
|
||||
#- name: someenv
|
||||
# value: somevalue
|
||||
# -- Set promtail command line arguments
|
||||
args: []
|
||||
# -- The URL to Loki
|
||||
@@ -852,6 +863,11 @@ addons:
|
||||
|
||||
# -- Set any environment variables for netshoot here
|
||||
env: {}
|
||||
# -- All variables specified here will be added to the netshoot sidecar container
|
||||
# See the documentation of the netshoot image for all config values
|
||||
envList: []
|
||||
#- name: someenv
|
||||
# value: somevalue
|
||||
|
||||
securityContext:
|
||||
capabilities:
|
||||
|
||||
@@ -133,3 +133,128 @@
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
|
||||
- variable: promtail
|
||||
label: "Promtail"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: enabled
|
||||
label: "enabled"
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
show_subquestions_if: true
|
||||
subquestions:
|
||||
- variable: envList
|
||||
label: "Promtail environment Variables"
|
||||
schema:
|
||||
type: list
|
||||
show_if: [["type", "!=", "disabled"]]
|
||||
default: []
|
||||
items:
|
||||
- variable: loki
|
||||
label: "Loki URL"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: envItem
|
||||
label: "Environment Variable"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: name
|
||||
label: "Name"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: value
|
||||
label: "Value"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: args
|
||||
label: "Promtail ecommand line arguments"
|
||||
schema:
|
||||
type: list
|
||||
show_if: [["type", "!=", "disabled"]]
|
||||
default: []
|
||||
items:
|
||||
- variable: arg
|
||||
label: "Arg"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: logs
|
||||
label: "Log Paths"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: name
|
||||
label: "Name"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: path
|
||||
label: "Path"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: volumeMounts
|
||||
label: "volumeMounts"
|
||||
description: "At least 1 volumeMount is required!"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: name
|
||||
label: "Name"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: mountPath
|
||||
label: "mountPath"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: readOnly
|
||||
label: "readOnly"
|
||||
schema:
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
hidden: true
|
||||
|
||||
- variable: netshoot
|
||||
label: "Netshoot"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: enabled
|
||||
label: "enabled"
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
show_subquestions_if: true
|
||||
subquestions:
|
||||
- variable: envList
|
||||
label: "Netshoot environment Variables"
|
||||
schema:
|
||||
type: list
|
||||
show_if: [["type", "!=", "disabled"]]
|
||||
default: []
|
||||
items:
|
||||
- variable: envItem
|
||||
label: "Environment Variable"
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: name
|
||||
label: "Name"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
- variable: value
|
||||
label: "Value"
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class Test < ChartTest
|
||||
@@chart = Chart.new('charts/library/common-test')
|
||||
|
||||
describe @@chart.name do
|
||||
describe 'addon::netshoot' do
|
||||
it 'defaults to disabled' do
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
netshootContainer = containers.find{ |c| c["name"] == "netshoot" }
|
||||
|
||||
assert_nil(netshootContainer)
|
||||
end
|
||||
|
||||
it 'netshoot can be enabled' do
|
||||
values = {
|
||||
addons: {
|
||||
netshoot: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chart.value values
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
netshootContainer = containers.find{ |c| c["name"] == "netshoot" }
|
||||
|
||||
refute_nil(netshootContainer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class Test < ChartTest
|
||||
@@chart = Chart.new('charts/library/common-test')
|
||||
|
||||
describe @@chart.name do
|
||||
describe 'addon::promtail' do
|
||||
it 'defaults to disabled' do
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
promtailContainer = containers.find{ |c| c["name"] == "promtail" }
|
||||
|
||||
assert_nil(promtailContainer)
|
||||
end
|
||||
|
||||
it 'promtail can be enabled' do
|
||||
values = {
|
||||
addons: {
|
||||
promtail: {
|
||||
enabled: true,
|
||||
volumeMounts: [
|
||||
{
|
||||
name: "config",
|
||||
mountPath: "/tmp",
|
||||
readOnly: true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chart.value values
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
promtailContainer = containers.find{ |c| c["name"] == "promtail" }
|
||||
|
||||
refute_nil(promtailContainer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user