@@ -22,10 +22,8 @@ import (
22
22
"encoding/json"
23
23
"fmt"
24
24
"io"
25
- "io/ioutil"
26
25
"math/rand"
27
26
"net"
28
- "net/http"
29
27
"net/url"
30
28
"os"
31
29
"os/exec"
@@ -41,21 +39,17 @@ import (
41
39
"github.com/onsi/gomega"
42
40
gomegatypes "github.com/onsi/gomega/types"
43
41
44
- appsv1 "k8s.io/api/apps/v1"
45
42
v1 "k8s.io/api/core/v1"
46
43
apierrors "k8s.io/apimachinery/pkg/api/errors"
47
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
48
45
"k8s.io/apimachinery/pkg/fields"
49
46
"k8s.io/apimachinery/pkg/labels"
50
- "k8s.io/apimachinery/pkg/runtime"
51
47
"k8s.io/apimachinery/pkg/runtime/schema"
52
48
"k8s.io/apimachinery/pkg/util/sets"
53
49
"k8s.io/apimachinery/pkg/util/uuid"
54
50
"k8s.io/apimachinery/pkg/util/wait"
55
- utilyaml "k8s.io/apimachinery/pkg/util/yaml"
56
51
"k8s.io/apimachinery/pkg/watch"
57
52
clientset "k8s.io/client-go/kubernetes"
58
- "k8s.io/client-go/kubernetes/scheme"
59
53
"k8s.io/client-go/rest"
60
54
restclient "k8s.io/client-go/rest"
61
55
"k8s.io/client-go/tools/clientcmd"
@@ -1240,51 +1234,6 @@ func DumpDebugInfo(c clientset.Interface, ns string) {
1240
1234
}
1241
1235
}
1242
1236
1243
- // DsFromManifest reads a .json/yaml file and returns the daemonset in it.
1244
- func DsFromManifest (url string ) (* appsv1.DaemonSet , error ) {
1245
- Logf ("Parsing ds from %v" , url )
1246
-
1247
- var response * http.Response
1248
- var err error
1249
-
1250
- for i := 1 ; i <= 5 ; i ++ {
1251
- response , err = http .Get (url )
1252
- if err == nil && response .StatusCode == 200 {
1253
- break
1254
- }
1255
- time .Sleep (time .Duration (i ) * time .Second )
1256
- }
1257
-
1258
- if err != nil {
1259
- return nil , fmt .Errorf ("Failed to get url: %v" , err )
1260
- }
1261
- if response .StatusCode != 200 {
1262
- return nil , fmt .Errorf ("invalid http response status: %v" , response .StatusCode )
1263
- }
1264
- defer response .Body .Close ()
1265
-
1266
- data , err := ioutil .ReadAll (response .Body )
1267
- if err != nil {
1268
- return nil , fmt .Errorf ("Failed to read html response body: %v" , err )
1269
- }
1270
- return DsFromData (data )
1271
- }
1272
-
1273
- // DsFromData reads a byte slice and returns the daemonset in it.
1274
- func DsFromData (data []byte ) (* appsv1.DaemonSet , error ) {
1275
- var ds appsv1.DaemonSet
1276
- dataJSON , err := utilyaml .ToJSON (data )
1277
- if err != nil {
1278
- return nil , fmt .Errorf ("Failed to parse data to json: %v" , err )
1279
- }
1280
-
1281
- err = runtime .DecodeInto (scheme .Codecs .UniversalDecoder (), dataJSON , & ds )
1282
- if err != nil {
1283
- return nil , fmt .Errorf ("Failed to decode DaemonSet spec: %v" , err )
1284
- }
1285
- return & ds , nil
1286
- }
1287
-
1288
1237
// PrettyPrintJSON converts metrics to JSON format.
1289
1238
func PrettyPrintJSON (metrics interface {}) string {
1290
1239
output := & bytes.Buffer {}
0 commit comments