This repository has been archived by the owner on Jun 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
getter.go
102 lines (81 loc) · 2.4 KB
/
getter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2018 Datadog, Inc.
package setup
import (
"io/ioutil"
"net/http"
"path"
"github.com/coreos/go-systemd/dbus"
"github.com/golang/glog"
"k8s.io/client-go/kubernetes"
)
func (e *Environment) GetHyperkubePath() string {
return e.binaryHyperkube.binaryABSPath
}
func (e *Environment) GetHostname() string {
return e.hostname
}
func (e *Environment) GetDBUSClient() *dbus.Conn {
return e.dbusClient
}
// TODO conf this
func (e *Environment) GetKubeletHealthzPort() int {
return 10248
}
func (e *Environment) GetKubeconfigAuthPath() string {
return e.kubeConfigAuthPath
}
func (e *Environment) GetKubeconfigInsecurePath() string {
return e.kubeConfigInsecurePath
}
func (e *Environment) GetStaticPodPaths() ([]string, error) {
files, err := ioutil.ReadDir(e.manifestStaticPodABSPath)
if err != nil {
glog.Errorf("Cannot read %s: %v", e.manifestStaticPodABSPath, err)
return nil, err
}
var manifestABSPaths []string
for _, elt := range files {
eltABS := path.Join(e.manifestStaticPodABSPath, elt.Name())
glog.V(4).Infof("Inventoring static pod manifest: %s", eltABS)
manifestABSPaths = append(manifestABSPaths, eltABS)
}
glog.V(4).Infof("Found %d static pod manifests", len(manifestABSPaths))
return manifestABSPaths, nil
}
func (e *Environment) GetKubernetesClient() *kubernetes.Clientset {
return e.clientSet
}
func (e *Environment) IsDrainingPods() bool {
return e.drainOptions.Pods
}
func (e *Environment) IsWaitingKubeletGC() bool {
return e.drainOptions.KubeletGC
}
func (e *Environment) IsSkippingStop() bool {
return e.drainOptions.None
}
func (e *Environment) IsCleaningIptables() bool {
return e.drainOptions.Iptables
}
func (e *Environment) GetManifestsABSPathToApply() string {
return e.manifestAPIABSPath
}
func (e *Environment) GetKubeletPodListReq() *http.Request {
return e.podListRequest
}
func (e *Environment) GetKubeletClient() *http.Client {
return e.kubeletClient
}
func (e *Environment) GetResolvConfPath() string {
return path.Join(e.networkABSPath, "resolv.conf")
}
// GetPublicIP should panic if nil
func (e *Environment) GetPublicIP() string {
return e.outboundIP.String()
}
func (e *Environment) GetSystemdUnits() []string {
return e.systemdUnitNames
}