Skip to content

Commit

Permalink
Added V3 compatable windows yaml
Browse files Browse the repository at this point in the history
Signed-off-by: RagalahariP <[email protected]>
  • Loading branch information
RagalahariP committed May 8, 2023
1 parent 045788f commit d1fb110
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
1 change: 1 addition & 0 deletions charts/newrelic-infrastructure/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rules:
- "services"
- "nodes"
- "namespaces"
- "pods"
verbs: [ "get", "list", "watch" ]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
Expand Down
4 changes: 4 additions & 0 deletions charts/newrelic-infrastructure/templates/kubelet/_naming.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{{- include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "nriKubernetes.naming.fullname" .) "suffix" "kubelet") -}}
{{- end -}}

{{- define "nriKubernetes.kubelet.windows.fullname" -}}
{{- include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "nriKubernetes.naming.fullname" .) "suffix" "windows") -}}
{{- end -}}

{{- define "nriKubernetes.kubelet.fullname.agent" -}}
{{- include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" (include "nriKubernetes.naming.fullname" .) "suffix" "agent-kubelet") -}}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{- if and .Values.kubelet.enabled .Values.kubelet.enableWindows }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "nriKubernetes.kubelet.windows.fullname" . }}
{{- $legacyAnnotation:= fromYaml (include "newrelic.compatibility.annotations" .) -}}
{{- with include "newrelic.compatibility.valueWithFallback" (dict "legacy" $legacyAnnotation "supported" .Values.kubelet.annotations )}}
annotations: {{ . | nindent 4 }}
{{- end }}

spec:
selector:
matchLabels:
{{- include "newrelic.common.labels.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: kubelet
template:
metadata:
annotations:
checksum/nri-kubernetes: {{ include (print $.Template.BasePath "/kubelet/scraper-configmap.yaml") . | sha256sum }}
checksum/agent-config: {{ include (print $.Template.BasePath "/kubelet/agent-configmap.yaml") . | sha256sum }}
{{- if include "newrelic.common.license.secret" . }}{{- /* If the is secret to template */}}
checksum/license-secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
checksum/integrations_config: {{ include (print $.Template.BasePath "/kubelet/integrations-configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nriKubernetes.labels.podLabels" . | nindent 8 }}
app.kubernetes.io/component: kubelet
spec:
{{- with include "newrelic.common.dnsConfig" . }}
dnsConfig:
{{- . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}
containers:
- name: agent
image: newrelic/infrastructure-k8s:{{ $.Values.kubelet.windowsImageTag }}
imagePullPolicy: {{ .Values.images.integration.pullPolicy }}
env:
- name: NRIA_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ include "newrelic.common.license.secretName" . }}
key: {{ include "newrelic.common.license.secretKeyName" . }}
- name: "NRI_KUBERNETES_CLUSTERNAME"
value: {{ include "newrelic.common.cluster" . }}

- name: "NRI_KUBERNETES_VERBOSE"
value: {{ include "newrelic.common.verboseLog.valueAsBoolean" . | quote }}
- name: "NRK8S_NODE_NAME"
valueFrom:
fieldRef:
apiVersion: "v1"
fieldPath: "spec.nodeName"
- name: "CLUSTER_NAME"
value: {{ include "newrelic.common.cluster" . }}
- name: "NRIA_PASSTHROUGH_ENVIRONMENT"
value: "KUBERNETES_SERVICE_HOST,KUBERNETES_SERVICE_PORT,CLUSTER_NAME,CADVISOR_PORT,NRK8S_NODE_NAME,KUBE_STATE_METRICS_URL,ETCD_TLS_SECRET_NAME,ETCD_TLS_SECRET_NAMESPACE,API_SERVER_SECURE_PORT,NRIA_CACHE_PATH,TIMEOUT,DISCOVERY_CACHE_TTL"
nodeSelector:
kubernetes.io/os: windows
tolerations:
- key: "node.kubernetes.io/os"
operator: "Equal"
value: "windows"
effect: "NoSchedule"
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ spec:
tolerations:
{{- . | nindent 8 }}
{{- end }}
{{- with .Values.kubelet.nodeSelector | default (fromYaml (include "newrelic.common.nodeSelector" .)) }}
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.kubelet.nodeSelector | default (fromYaml (include "newrelic.common.nodeSelector" .)) }}
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- end }}

0 comments on commit d1fb110

Please sign in to comment.