Hello folks I am super new to the entire kubernetes world and I am trying to do some really stupid things (since google clearly tells me that I am), But I wanted to confirm if this is indeed something that is impossible or I am just not approaching this problem correctly.
I have this config map, and here are my questions:
- I would like to create a new env variable called CURRENT_CONTEXT ?
- Which would hold the value of this executed command
kubectl config current-context
- Then I want to use this CURRENT_CONTEXT, inside my config map.
How can I achieve this ? Truly appreciate anything to help me get better
{{- if .Values.collectMetrics }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-metric-publisher-config
labels:
{{- include "infrastructure.labels" . | nindent 4 }}
data:
input.conf: |-
input {
kafka {
bootstrap_servers => {{ template "infrastructure.kafka.bootstrapServers" . }}
topics => ["acs.to.metric"]
client_id => "metric"
enable_auto_commit => false
codec => protobuf
{
class_name => "some.thing"
class_file => '/some/location/metric_pb.rb'
protobuf_root_directory => '/proto'
protobuf_version => 3
}
}
}
bot_state_input.conf: |-
input {
kafka {
bootstrap_servers => {{ template "infrastructure.kafka.bootstrapServers" . }}
topics => ["acs.to.state.bot"]
client_id => "bot_state"
enable_auto_commit => false
key_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
value_deserializer_class => "org.apache.kafka.common.serialization.ByteArrayDeserializer"
codec => protobuf
{
class_name => "some.thing"
class_file => '/some/thing/rcs/bot_state_pb.rb'
protobuf_root_directory => '/proto'
protobuf_version => 3
}
}
}
bot_cold_state_input.conf: |-
input {
kafka {
bootstrap_servers => {{ template "infrastructure.kafka.bootstrapServers" . }}
topics => ["acs.to.state.bot.cold"]
client_id => "cold_state"
enable_auto_commit => false
codec => protobuf
{
class_name => “some.thing”
class_file => ‘/some/location/bot_cold_state_pb.rb'
protobuf_root_directory => '/proto'
protobuf_version => 3
}
}
}
convert_timestamp.conf: |-
filter {
ruby {
code => "
event.set('[@timestamp_nanoseconds]', (Time.at((event.get('[timestamp][epoch_second]').to_i )).to_datetime).strftime('%Y-%m-%dT%H:%M:%S.') + (event.get('[timestamp][nano]').to_s) +'Z' );
"
}
}
12_append_convert_types.conf: |-
filter {
mutate {
convert => {
"power_supply_status" => "string"
}
}
}
{{- if .Values.elasticsearch.enabled }}
90_output_elastic.conf: |-
output {
elasticsearch {
index => metrics_write
hosts => "${ELASTICSEARCH_HOSTS}"
}
}
{{- end }}
{{- if .Values.shipMetricsToADX }}
91_output_adx.conf: |-
output {
kafka {
codec => json
security_protocol => "SASL_SSL"
sasl_mechanism => "PLAIN"
topic_id => "{{ .Values.eventHub.entityPath }}"
metadata_max_age_ms => 180000
max_request_size => 1000000
retries => 3
request_timeout_ms => 30000
linger_ms => 1000
}
}
{{- end }}
{{- if not ( or .Values.elasticsearch.enabled .Values.shipMetricsToADX) }}
output {
stdout {}
}
{{- end }}
{{- end }}