Add env var for kubelet port and ensure kubelet works without logs
This commit is contained in:
@@ -14,6 +14,8 @@ spec:
|
|||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
env:
|
env:
|
||||||
|
- name: KUBELET_PORT
|
||||||
|
value: "10250"
|
||||||
- name: AZURE_AUTH_LOCATION
|
- name: AZURE_AUTH_LOCATION
|
||||||
value: /etc/virtual-kubelet/credentials.json
|
value: /etc/virtual-kubelet/credentials.json
|
||||||
- name: ACI_RESOURCE_GROUP
|
- name: ACI_RESOURCE_GROUP
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package vkubelet
|
package vkubelet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -9,16 +10,17 @@ import (
|
|||||||
)
|
)
|
||||||
var p Provider
|
var p Provider
|
||||||
|
|
||||||
func ApiserverStart(provider Provider) error {
|
func ApiserverStart(provider Provider) {
|
||||||
p = provider
|
p = provider
|
||||||
http.HandleFunc("/", ApiServerHandler)
|
http.HandleFunc("/", ApiServerHandler)
|
||||||
certFilePath := os.Getenv("APISERVER_CERT_LOCATION")
|
certFilePath := os.Getenv("APISERVER_CERT_LOCATION")
|
||||||
keyFilePath := os.Getenv("APISERVER_KEY_LOCATION")
|
keyFilePath := os.Getenv("APISERVER_KEY_LOCATION")
|
||||||
err := http.ListenAndServeTLS(":10250", certFilePath, keyFilePath, nil)
|
port := os.Getenv("KUBELET_PORT")
|
||||||
|
addr := fmt.Sprintf(":%s", port)
|
||||||
|
err := http.ListenAndServeTLS(addr, certFilePath, keyFilePath, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ApiServerHandler(w http.ResponseWriter, req *http.Request) {
|
func ApiServerHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
@@ -32,7 +34,7 @@ func ApiServerHandler(w http.ResponseWriter, req *http.Request) {
|
|||||||
podsLogs, err := p.GetContainerLogs(namespace, pod, container)
|
podsLogs, err := p.GetContainerLogs(namespace, pod, container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
io.WriteString(w, err.Error())
|
io.WriteString(w, err.Error())
|
||||||
log.Fatal(err)
|
log.Println(err)
|
||||||
} else {
|
} else {
|
||||||
io.WriteString(w, podsLogs)
|
io.WriteString(w, podsLogs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user