Merge branch 'master' of https://github.com/kubernetes/minikube into master_srikrishnabh
commit
2d7e884817
7
Makefile
7
Makefile
|
|
@ -23,7 +23,7 @@ KUBERNETES_VERSION ?= $(shell egrep "DefaultKubernetesVersion =" pkg/minikube/co
|
|||
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)
|
||||
|
||||
# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
|
||||
ISO_VERSION ?= v1.23.1
|
||||
ISO_VERSION ?= v1.23.1-1633115168-12081
|
||||
# Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta
|
||||
DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))
|
||||
DEB_REVISION ?= 0
|
||||
|
|
@ -52,7 +52,8 @@ REGISTRY ?= gcr.io/k8s-minikube
|
|||
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
|
||||
COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}")
|
||||
COMMIT_SHORT = $(shell git rev-parse --short HEAD 2> /dev/null || true)
|
||||
HYPERKIT_BUILD_IMAGE ?= neilotoole/xcgo:go1.15
|
||||
# source code for image: https://github.com/spowelljr/xcgo
|
||||
HYPERKIT_BUILD_IMAGE ?= gcr.io/k8s-minikube/xcgo:go1.17
|
||||
|
||||
# NOTE: "latest" as of 2021-02-06. kube-cross images aren't updated as often as Kubernetes
|
||||
# https://github.com/kubernetes/kubernetes/blob/master/build/build-image/cross/VERSION
|
||||
|
|
@ -286,7 +287,7 @@ minikube_iso: deploy/iso/minikube-iso/board/coreos/minikube/rootfs-overlay/usr/b
|
|||
if [ ! -d $(BUILD_DIR)/buildroot ]; then \
|
||||
mkdir -p $(BUILD_DIR); \
|
||||
git clone --depth=1 --branch=$(BUILDROOT_BRANCH) https://github.com/buildroot/buildroot $(BUILD_DIR)/buildroot; \
|
||||
cp $(PWD)/deploy/iso/minikube-iso/go.hash $(BUILD_DIR)/buildroot/package/go/go.hash; \
|
||||
cp deploy/iso/minikube-iso/go.hash $(BUILD_DIR)/buildroot/package/go/go.hash; \
|
||||
fi;
|
||||
$(MAKE) BR2_EXTERNAL=../../deploy/iso/minikube-iso minikube_defconfig -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS)
|
||||
$(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) host-python
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
|
@ -47,7 +47,7 @@ var targetIP *string
|
|||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("Handling a request")
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
log.Printf("error: %v", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
|||
package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -84,7 +84,7 @@ var addonsConfigureCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
// Read file from disk
|
||||
dat, err := ioutil.ReadFile(gcrPath)
|
||||
dat, err := os.ReadFile(gcrPath)
|
||||
|
||||
if err != nil {
|
||||
out.FailureT("Error reading {{.path}}: {{.error}}", out.V{"path": gcrPath, "error": err})
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
|
@ -67,7 +66,7 @@ func TestSetOK(t *testing.T) {
|
|||
|
||||
func createTestConfig(t *testing.T) {
|
||||
t.Helper()
|
||||
td, err := ioutil.TempDir("", "config")
|
||||
td, err := os.MkdirTemp("", "config")
|
||||
if err != nil {
|
||||
t.Fatalf("tempdir: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package cmd
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
|
@ -518,13 +517,29 @@ func deleteMachineDirectories(cc *config.ClusterConfig) {
|
|||
|
||||
// killMountProcess kills the mount process, if it is running
|
||||
func killMountProcess() error {
|
||||
pidPath := filepath.Join(localpath.MiniPath(), constants.MountProcessFileName)
|
||||
profile := viper.GetString("profile")
|
||||
paths := []string{
|
||||
localpath.MiniPath(), // legacy mount-process path for backwards compatibility
|
||||
localpath.Profile(profile),
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
if err := killProcess(path); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func killProcess(path string) error {
|
||||
pidPath := filepath.Join(path, constants.MountProcessFileName)
|
||||
if _, err := os.Stat(pidPath); os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
klog.Infof("Found %s ...", pidPath)
|
||||
out, err := ioutil.ReadFile(pidPath)
|
||||
out, err := os.ReadFile(pidPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "ReadFile")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -53,7 +52,7 @@ func exclude(vals []string, exclude []string) []string {
|
|||
|
||||
func fileNames(path string) ([]string, error) {
|
||||
result := []string{}
|
||||
fis, err := ioutil.ReadDir(path)
|
||||
fis, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
|
@ -64,7 +63,7 @@ func fileNames(path string) ([]string, error) {
|
|||
}
|
||||
|
||||
func TestDeleteProfile(t *testing.T) {
|
||||
td, err := ioutil.TempDir("", "single")
|
||||
td, err := os.MkdirTemp("", "single")
|
||||
if err != nil {
|
||||
t.Fatalf("tempdir: %v", err)
|
||||
}
|
||||
|
|
@ -170,7 +169,7 @@ func deleteContextTest() error {
|
|||
}
|
||||
|
||||
func TestDeleteAllProfiles(t *testing.T) {
|
||||
td, err := ioutil.TempDir("", "all")
|
||||
td, err := os.MkdirTemp("", "all")
|
||||
if err != nil {
|
||||
t.Fatalf("tempdir: %v", err)
|
||||
}
|
||||
|
|
@ -234,7 +233,7 @@ func TestDeleteAllProfiles(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("profiles: %v", err)
|
||||
}
|
||||
afterMachines, err := ioutil.ReadDir(filepath.Join(localpath.MiniPath(), "machines"))
|
||||
afterMachines, err := os.ReadDir(filepath.Join(localpath.MiniPath(), "machines"))
|
||||
if err != nil {
|
||||
t.Errorf("machines: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -27,7 +26,7 @@ import (
|
|||
)
|
||||
|
||||
func TestGenerateTestDocs(t *testing.T) {
|
||||
tempdir, err := ioutil.TempDir("", "")
|
||||
tempdir, err := os.MkdirTemp("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("creating temp dir failed: %v", err)
|
||||
}
|
||||
|
|
@ -38,7 +37,7 @@ func TestGenerateTestDocs(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error generating test docs: %v", err)
|
||||
}
|
||||
actualContents, err := ioutil.ReadFile(docPath)
|
||||
actualContents, err := os.ReadFile(docPath)
|
||||
if err != nil {
|
||||
t.Fatalf("error reading generated file: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package cmd
|
|||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -58,7 +57,7 @@ var (
|
|||
)
|
||||
|
||||
func saveFile(r io.Reader) (string, error) {
|
||||
tmp, err := ioutil.TempFile("", "build.*.tar")
|
||||
tmp, err := os.CreateTemp("", "build.*.tar")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
@ -184,7 +183,7 @@ var saveImageCmd = &cobra.Command{
|
|||
output = args[1]
|
||||
|
||||
if args[1] == "-" {
|
||||
tmp, err := ioutil.TempFile("", "image.*.tar")
|
||||
tmp, err := os.CreateTemp("", "image.*.tar")
|
||||
if err != nil {
|
||||
exit.Error(reason.GuestImageSave, "Failed to get temp", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,9 +100,7 @@ var logsCmd = &cobra.Command{
|
|||
err = logs.Output(cr, bs, *co.Config, co.CP.Runner, numberOfLines, logOutput)
|
||||
if err != nil {
|
||||
out.Ln("")
|
||||
// Avoid exit.Error, since it outputs the issue URL
|
||||
out.WarningT("{{.error}}", out.V{"error": err})
|
||||
os.Exit(reason.ExSvcError)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ var optionsCmd = &cobra.Command{
|
|||
Use: "options",
|
||||
Short: "Show a list of global command-line options (applies to all commands).",
|
||||
Long: "Show a list of global command-line options (applies to all commands).",
|
||||
Hidden: true,
|
||||
Hidden: false,
|
||||
Run: runOptions,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -617,7 +617,6 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
|
|||
out.WarningT("You cannot add or remove extra disks for an existing minikube cluster. Please first delete the cluster.")
|
||||
}
|
||||
|
||||
updateStringFromFlag(cmd, &cc.MinikubeISO, isoURL)
|
||||
updateBoolFromFlag(cmd, &cc.KeepContext, keepContext)
|
||||
updateBoolFromFlag(cmd, &cc.EmbedCerts, embedCerts)
|
||||
updateStringFromFlag(cmd, &cc.MinikubeISO, isoURL)
|
||||
|
|
|
|||
|
|
@ -119,9 +119,7 @@ func runStop(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
|
||||
register.Reg.SetStep(register.Done)
|
||||
if stoppedNodes > 0 {
|
||||
out.Step(style.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes})
|
||||
}
|
||||
out.Step(style.Stopped, `{{.count}} node{{if gt .count 1}}s{{end}} stopped.`, out.V{"count": stoppedNodes})
|
||||
}
|
||||
|
||||
func stopProfile(profile string) int {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
docker 1000 docker 1000 =tcuser /home/docker /bin/bash wheel,vboxsf,podman -
|
||||
docker 1000 docker 1000 =tcuser /home/docker /bin/bash wheel,vboxsf,podman,buildkit -
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
disable buildkit.service
|
||||
|
|
@ -12,6 +12,10 @@ BUILDKIT_BIN_SOURCE = buildkit-$(BUILDKIT_BIN_VERSION).linux-amd64.tar.gz
|
|||
# https://github.com/opencontainers/runc.git
|
||||
BUILDKIT_RUNC_VERSION = 12644e614e25b05da6fd08a38ffa0cfe1903fdec
|
||||
|
||||
define BUILDKIT_BIN_USERS
|
||||
- -1 buildkit -1 - - - - -
|
||||
endef
|
||||
|
||||
define BUILDKIT_BIN_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 0755 \
|
||||
$(@D)/buildctl \
|
||||
|
|
@ -25,6 +29,24 @@ define BUILDKIT_BIN_INSTALL_TARGET_CMDS
|
|||
$(INSTALL) -D -m 0755 \
|
||||
$(@D)/buildkitd \
|
||||
$(TARGET_DIR)/usr/sbin
|
||||
$(INSTALL) -D -m 644 \
|
||||
$(BUILDKIT_BIN_PKGDIR)/buildkit.conf \
|
||||
$(TARGET_DIR)/usr/lib/tmpfiles.d/buildkit.conf
|
||||
$(INSTALL) -D -m 644 \
|
||||
$(BUILDKIT_BIN_PKGDIR)/buildkitd.toml \
|
||||
$(TARGET_DIR)/etc/buildkit/buildkitd.toml
|
||||
endef
|
||||
|
||||
define BUILDKIT_BIN_INSTALL_INIT_SYSTEMD
|
||||
$(INSTALL) -D -m 644 \
|
||||
$(BUILDKIT_BIN_PKGDIR)/buildkit.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/buildkit.service
|
||||
$(INSTALL) -D -m 644 \
|
||||
$(BUILDKIT_BIN_PKGDIR)/buildkit.socket \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/buildkit.socket
|
||||
$(INSTALL) -D -m 644 \
|
||||
$(BUILDKIT_BIN_PKGDIR)/51-buildkit.preset \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system-preset/51-buildkit.preset
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
d /run/buildkit 0770 root buildkit
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=BuildKit
|
||||
Requires=buildkit.socket
|
||||
After=buildkit.socket
|
||||
Documentation=https://github.com/moby/buildkit
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/buildkitd --addr fd://
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=BuildKit
|
||||
Documentation=https://github.com/moby/buildkit
|
||||
|
||||
[Socket]
|
||||
ListenStream=%t/buildkit/buildkitd.sock
|
||||
SocketMode=0660
|
||||
SocketUser=root
|
||||
SocketGroup=buildkit
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[worker.oci]
|
||||
enabled = false
|
||||
[worker.containerd]
|
||||
enabled = true
|
||||
namespace = "k8s.io"
|
||||
|
|
@ -21,5 +21,5 @@ sha256 74a4e916acddc6cf47ab5752bdebb6732ce2c028505ef57b7edc21d2da9039b6 v1.18.4.
|
|||
sha256 fc8a8e61375e3ce30563eeb0fd6534c4f48fc20300a72e6ff51cc99cb2703516 v1.19.0.tar.gz
|
||||
sha256 6165c5b8212ea03be2a465403177318bfe25a54c3e8d66d720344643913a0223 v1.19.1.tar.gz
|
||||
sha256 76fd7543bc92d4364a11060f43a5131893a76c6e6e9d6de3a6bb6292c110b631 v1.20.0.tar.gz
|
||||
sha256 1c01d4a76cdcfe3ac24147eb1d5f6ebd782bd98fb0ac0c19b79bd5a6560b1481 v1.20.2.tar.gz
|
||||
sha256 36d9f4cf4966342e2d4099e44d8156c55c6a10745c67ce4f856aa9f6dcc2d9ba v1.20.2.tar.gz
|
||||
sha256 bc53ea8977e252bd9812974c33ff654ee22076598e901464468c5c105a5ef773 v1.22.0.tar.gz
|
||||
|
|
|
|||
|
|
@ -142,14 +142,21 @@ COPY deploy/kicbase/containerd-fuse-overlayfs.service /etc/systemd/system/contai
|
|||
# install buildkit
|
||||
RUN export ARCH=$(dpkg --print-architecture | sed 's/ppc64el/ppc64le/' | sed 's/armhf/arm-v7/') \
|
||||
&& echo "Installing buildkit ..." \
|
||||
&& addgroup --system buildkit \
|
||||
&& export BUILDKIT_BASE_URL="https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}" \
|
||||
&& curl -sSL --retry 5 --output /tmp/buildkit.tgz "${BUILDKIT_BASE_URL}/buildkit-${BUILDKIT_VERSION}.linux-${ARCH}.tar.gz" \
|
||||
&& tar -C /usr/local -xzvf /tmp/buildkit.tgz \
|
||||
&& rm -rf /tmp/buildkit.tgz \
|
||||
&& mkdir -p /usr/local/lib/systemd/system \
|
||||
&& curl -L --retry 5 --output /usr/local/lib/systemd/system/buildkit.service "https://raw.githubusercontent.com/moby/buildkit/${BUILDKIT_VERSION}/examples/systemd/buildkit.service" \
|
||||
&& curl -L --retry 5 --output /usr/local/lib/systemd/system/buildkit.socket "https://raw.githubusercontent.com/moby/buildkit/${BUILDKIT_VERSION}/examples/systemd/buildkit.socket" \
|
||||
&& mkdir -p /etc/buildkit \
|
||||
&& echo "[worker.oci]\n enabled = false\n[worker.containerd]\n enabled = true\n namespace = \"k8s.io\"" > /etc/buildkit/buildkitd.toml \
|
||||
&& chmod 755 /usr/local/bin/buildctl \
|
||||
&& chmod 755 /usr/local/bin/buildkit-runc \
|
||||
&& chmod 755 /usr/local/bin/buildkit-qemu-* \
|
||||
&& chmod 755 /usr/local/bin/buildkitd
|
||||
&& chmod 755 /usr/local/bin/buildkitd \
|
||||
&& systemctl enable buildkit.socket
|
||||
|
||||
# Install cri-o/podman dependencies:
|
||||
RUN sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
|
||||
|
|
@ -210,6 +217,7 @@ EXPOSE 22
|
|||
RUN adduser --ingroup docker --disabled-password --gecos '' docker
|
||||
RUN adduser docker sudo
|
||||
RUN adduser docker podman
|
||||
RUN adduser docker buildkit
|
||||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
USER docker
|
||||
RUN mkdir /home/docker/.ssh
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ func getSHAFromURL(url string) (string, error) {
|
|||
return "", err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
18
go.mod
18
go.mod
|
|
@ -3,7 +3,7 @@ module k8s.io/minikube
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
cloud.google.com/go/storage v1.16.1
|
||||
cloud.google.com/go/storage v1.18.0
|
||||
contrib.go.opencensus.io/exporter/stackdriver v0.12.1
|
||||
github.com/Delta456/box-cli-maker/v2 v2.2.2
|
||||
github.com/GoogleCloudPlatform/docker-credential-gcr v0.0.0-20210713212222-faed5e8b8ca2
|
||||
|
|
@ -19,7 +19,7 @@ require (
|
|||
github.com/cloudevents/sdk-go/v2 v2.5.0
|
||||
github.com/cloudfoundry-attic/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect
|
||||
github.com/docker/docker v20.10.7+incompatible
|
||||
github.com/docker/docker v20.10.9+incompatible
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/docker/machine v0.16.2
|
||||
github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e
|
||||
|
|
@ -29,7 +29,7 @@ require (
|
|||
github.com/google/go-github/v36 v36.0.0
|
||||
github.com/google/slowjam v1.0.0
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/hashicorp/go-getter v1.5.8
|
||||
github.com/hashicorp/go-getter v1.5.9
|
||||
github.com/hashicorp/go-retryablehttp v0.7.0
|
||||
github.com/hashicorp/golang-lru v0.5.3 // indirect
|
||||
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect
|
||||
|
|
@ -66,7 +66,7 @@ require (
|
|||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/russross/blackfriday v1.5.3-0.20200218234912-41c5fccfd6f6 // indirect
|
||||
github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.8
|
||||
github.com/shirou/gopsutil/v3 v3.21.9
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/spf13/viper v1.9.0
|
||||
|
|
@ -82,11 +82,11 @@ require (
|
|||
golang.org/x/mod v0.5.1
|
||||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365
|
||||
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678
|
||||
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72
|
||||
golang.org/x/text v0.3.7
|
||||
gonum.org/v1/plot v0.10.0
|
||||
google.golang.org/api v0.57.0
|
||||
google.golang.org/api v0.58.0
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.22.2
|
||||
|
|
@ -99,7 +99,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.94.1 // indirect
|
||||
cloud.google.com/go v0.97.0 // indirect
|
||||
cloud.google.com/go/container v0.1.0 // indirect
|
||||
cloud.google.com/go/monitoring v0.1.0 // indirect
|
||||
cloud.google.com/go/trace v0.1.0 // indirect
|
||||
|
|
@ -139,7 +139,7 @@ require (
|
|||
github.com/golang/snappy v0.0.3 // indirect
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.1.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
|
||||
github.com/googleapis/gnostic v0.4.1 // indirect
|
||||
github.com/gookit/color v1.4.2 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
|
|
@ -194,7 +194,7 @@ require (
|
|||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 // indirect
|
||||
google.golang.org/grpc v1.40.0 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
|
|
|
|||
33
go.sum
33
go.sum
|
|
@ -30,8 +30,9 @@ cloud.google.com/go v0.92.1/go.mod h1:cMc7asehN84LBi1JGTHo4n8wuaGuNAZ7lR7b1YNJBr
|
|||
cloud.google.com/go v0.92.2/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
||||
cloud.google.com/go v0.92.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
||||
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
||||
cloud.google.com/go v0.94.1 h1:DwuSvDZ1pTYGbXo8yOJevCTr3BoBlE+OVkHAKiYQUXc=
|
||||
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
|
||||
cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8=
|
||||
cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
|
|
@ -55,8 +56,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
|
|||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
cloud.google.com/go/storage v1.16.1 h1:sMEIc4wxvoY3NXG7Rn9iP7jb/2buJgWR1vNXCR/UPfs=
|
||||
cloud.google.com/go/storage v1.16.1/go.mod h1:LaNorbty3ehnU3rEjXSNV/NRgQA0O8Y+uh6bPe5UOk4=
|
||||
cloud.google.com/go/storage v1.18.0 h1:HM5Hu/BqgmWbo7pT9KFYGUccwzA8ZWDICJww9m5t9UA=
|
||||
cloud.google.com/go/storage v1.18.0/go.mod h1:h0NImijCz/2WHwLh03BvmWdrNe4I/pzUdvUHoxIUroU=
|
||||
cloud.google.com/go/trace v0.1.0 h1:nUGUK79FOkN0UGUXhBmVBkbu1PYsHe0YyFSPLOD9Npg=
|
||||
cloud.google.com/go/trace v0.1.0/go.mod h1:wxEwsoeRVPbeSkt7ZC9nWCgmoKQRAoySN7XHW2AmI7g=
|
||||
contrib.go.opencensus.io/exporter/stackdriver v0.12.1 h1:Dll2uFfOVI3fa8UzsHyP6z0M6fEc9ZTAMo+Y3z282Xg=
|
||||
|
|
@ -366,8 +367,9 @@ github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc
|
|||
github.com/docker/docker v17.12.0-ce-rc1.0.20181225093023-5ddb1d410a8b+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v17.12.0-ce-rc1.0.20190115220918-5ec31380a5d3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ=
|
||||
github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.9+incompatible h1:JlsVnETOjM2RLQa0Cc1XCIspUdXW3Zenq9P54uXBm6k=
|
||||
github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ=
|
||||
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||
|
|
@ -615,8 +617,9 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
|||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.1.0 h1:6DWmvNpomjL1+3liNSZbVns3zsYzzCjm6pRBO1tLeso=
|
||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
||||
github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU=
|
||||
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
|
||||
github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I=
|
||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||
github.com/googleinterns/cloud-operations-api-mock v0.0.0-20200709193332-a1e58c29bdd3 h1:eHv/jVY/JNop1xg2J9cBb4EzyMpWZoNCP1BslSAIkOI=
|
||||
|
|
@ -649,8 +652,8 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
|
|||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-getter v1.5.8 h1:qx5CZXxXz5YFpALPkbf/F1iZZoRE+f6T1i/AWw/Zkic=
|
||||
github.com/hashicorp/go-getter v1.5.8/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI=
|
||||
github.com/hashicorp/go-getter v1.5.9 h1:b7ahZW50iQiUek/at3CvZhPK1/jiV6CtKcsJiR6E4R0=
|
||||
github.com/hashicorp/go-getter v1.5.9/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI=
|
||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||
github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM=
|
||||
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||
|
|
@ -1052,8 +1055,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
|
|||
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shirou/gopsutil/v3 v3.21.8 h1:nKct+uP0TV8DjjNiHanKf8SAuub+GNsbrOtM9Nl9biA=
|
||||
github.com/shirou/gopsutil/v3 v3.21.8/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
|
||||
github.com/shirou/gopsutil/v3 v3.21.9 h1:Vn4MUz2uXhqLSiCbGFRc0DILbMVLAY92DSkT8bsYrHg=
|
||||
github.com/shirou/gopsutil/v3 v3.21.9/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
|
|
@ -1491,8 +1494,9 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365 h1:6wSTsvPddg9gc/mVEEyk9oOAoxn+bT4Z9q1zx+4RwA4=
|
||||
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw=
|
||||
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
|
@ -1634,8 +1638,9 @@ google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00
|
|||
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
|
||||
google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
||||
google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
||||
google.golang.org/api v0.57.0 h1:4t9zuDlHLcIx0ZEhmXEeFVCRsiOgpgn2QOH9N0MNjPI=
|
||||
google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
|
||||
google.golang.org/api v0.58.0 h1:MDkAbYIB1JpSgCTOCYYoIec/coMlKK4oVbpnBLLcyT0=
|
||||
google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3lv+E=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
|
|
@ -1702,11 +1707,13 @@ google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKr
|
|||
google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
||||
google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
|
||||
google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210825212027-de86158e7fda/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg=
|
||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q=
|
||||
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ type benchmark struct {
|
|||
App float64 `json:"app"`
|
||||
DNSAns float64 `json:"dnsAns"`
|
||||
Total float64 `json:"total"`
|
||||
CPU float64 `json:"cpu"`
|
||||
}
|
||||
|
||||
// benchmarks contains a list of benchmarks, used for storing benchmark results to JSON
|
||||
|
|
@ -70,8 +71,8 @@ func readInLatestBenchmark(latestBenchmarkPath string) benchmark {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var cmd, api, k8s, dnsSvc, app, dnsAns float64
|
||||
steps := []*float64{&cmd, &api, &k8s, &dnsSvc, &app, &dnsAns}
|
||||
var cmd, api, k8s, dnsSvc, app, dnsAns, cpu float64
|
||||
steps := []*float64{&cmd, &api, &k8s, &dnsSvc, &app, &dnsAns, &cpu}
|
||||
count := 0
|
||||
|
||||
r := csv.NewReader(f)
|
||||
|
|
@ -91,8 +92,13 @@ func readInLatestBenchmark(latestBenchmarkPath string) benchmark {
|
|||
|
||||
values := []float64{}
|
||||
|
||||
// 8-13 contain the benchmark results
|
||||
// 8-13 and 16 contain the benchmark results
|
||||
var idx []int
|
||||
for i := 8; i <= 13; i++ {
|
||||
idx = append(idx, i)
|
||||
}
|
||||
idx = append(idx, 16)
|
||||
for _, i := range idx {
|
||||
v, err := strconv.ParseFloat(line[i], 64)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
@ -108,10 +114,14 @@ func readInLatestBenchmark(latestBenchmarkPath string) benchmark {
|
|||
var total float64
|
||||
for _, step := range steps {
|
||||
*step /= float64(count)
|
||||
// Don't add CPU time to the total time.
|
||||
if step == &cpu {
|
||||
continue
|
||||
}
|
||||
total += *step
|
||||
}
|
||||
|
||||
return benchmark{time.Now(), cmd, api, k8s, dnsSvc, app, dnsAns, total}
|
||||
return benchmark{time.Now(), cmd, api, k8s, dnsSvc, app, dnsAns, total, cpu}
|
||||
}
|
||||
|
||||
// readInPastBenchmarks reads in the past benchmark results from a JSON file
|
||||
|
|
@ -144,8 +154,8 @@ func updateRunsFile(h *benchmarks, pastRunsPath string) {
|
|||
// createChart creates a time series chart of the benchmarks
|
||||
func createChart(benchmarks []benchmark, chartOutputPath string) {
|
||||
n := len(benchmarks)
|
||||
var cmdXYs, apiXYs, k8sXYs, dnsSvcXYs, appXYs, dnsAnsXYs, totalXYs plotter.XYs
|
||||
xys := []*plotter.XYs{&cmdXYs, &apiXYs, &k8sXYs, &dnsSvcXYs, &appXYs, &dnsAnsXYs, &totalXYs}
|
||||
var cmdXYs, apiXYs, k8sXYs, dnsSvcXYs, appXYs, dnsAnsXYs, totalXYs, cpuXYs plotter.XYs
|
||||
xys := []*plotter.XYs{&cmdXYs, &apiXYs, &k8sXYs, &dnsSvcXYs, &appXYs, &dnsAnsXYs, &totalXYs, &cpuXYs}
|
||||
|
||||
for _, xy := range xys {
|
||||
*xy = make(plotter.XYs, n)
|
||||
|
|
@ -164,6 +174,7 @@ func createChart(benchmarks []benchmark, chartOutputPath string) {
|
|||
{&appXYs, b.App},
|
||||
{&dnsAnsXYs, b.DNSAns},
|
||||
{&totalXYs, b.Total},
|
||||
{&cpuXYs, b.CPU},
|
||||
}
|
||||
for _, xyValue := range xyValues {
|
||||
xy := &(*xyValue.xys)[i]
|
||||
|
|
@ -193,6 +204,7 @@ func createChart(benchmarks []benchmark, chartOutputPath string) {
|
|||
{appXYs, color.RGBA{R: 255, G: 255, A: 255}, "App Running"},
|
||||
{dnsAnsXYs, color.RGBA{G: 255, B: 255, A: 255}, "DNS Answering"},
|
||||
{totalXYs, color.RGBA{B: 255, R: 140, A: 255}, "Total"},
|
||||
{cpuXYs, color.RGBA{B: 57, R: 127, G: 85, A: 255}, "CPU"},
|
||||
}
|
||||
|
||||
for _, step := range steps {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f6f6b2db9e718f7c9af698b6247b232a7251522f
|
||||
Subproject commit 6e6133456e56553c341fd1a8a465fd302d85123d
|
||||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -75,7 +74,7 @@ func extensionToBoilerplate(dir string) (map[string][]byte, error) {
|
|||
files, _ := filepath.Glob(dir + "/*.txt")
|
||||
for _, filename := range files {
|
||||
extension := strings.ToLower(filepath.Ext(txtExtension.ReplaceAllString(filename, "")))
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
data, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -97,7 +96,7 @@ func extensionToBoilerplate(dir string) (map[string][]byte, error) {
|
|||
|
||||
// filePasses checks whether the processed file is valid. Returning false means that the file does not the proper boilerplate template.
|
||||
func filePasses(filename string, expectedBoilerplate []byte) (bool, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
data, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,18 +12,58 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
mkdir -p out
|
||||
# A utility to write commit statuses to github, since authenticating is complicated now
|
||||
function Write-GithubStatus {
|
||||
param (
|
||||
$JsonBody
|
||||
)
|
||||
# Manually build basic authorization headers, ugh
|
||||
$creds = "minikube-bot:$($env:access_token)"
|
||||
$encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($creds))
|
||||
$auth = "Basic $encoded"
|
||||
$headers = @{
|
||||
Authorization = $auth
|
||||
}
|
||||
Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT" -Headers $headers -Body $JsonBody -ContentType "application/json" -Method Post -usebasicparsing
|
||||
}
|
||||
|
||||
$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7)
|
||||
$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:ROOT_JOB_ID"
|
||||
|
||||
# Docker's kubectl breaks things, and comes earlier in the path than the regular kubectl. So download the expected kubectl and replace Docker's version.
|
||||
(New-Object Net.WebClient).DownloadFile("https://dl.k8s.io/release/v1.20.0/bin/windows/amd64/kubectl.exe", "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe")
|
||||
|
||||
# Setup the cleanup and reboot cron
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/windows_cleanup_and_reboot.ps1 C:\jenkins
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/windows_cleanup_cron.ps1 out/
|
||||
./out/windows_cleanup_cron.ps1
|
||||
|
||||
# Make sure Docker is up and running
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/setup_docker_desktop_windows.ps1 out/
|
||||
./out/setup_docker_desktop_windows.ps1
|
||||
If ($lastexitcode -gt 0) {
|
||||
echo "Docker failed to start, exiting."
|
||||
|
||||
$json = "{`"state`": `"failure`", `"description`": `"Jenkins: docker failed to start`", `"target_url`": `"https://storage.googleapis.com/$gcs_bucket/Hyper-V_Windows.txt`", `"context`": `"$env:JOB_NAME`"}"
|
||||
|
||||
Write-GithubStatus -JsonBody $json
|
||||
docker system prune --all --force
|
||||
Exit $lastexitcode
|
||||
}
|
||||
|
||||
# Download gopogh and gotestsum
|
||||
(New-Object Net.WebClient).DownloadFile("https://github.com/medyagh/gopogh/releases/download/v0.9.0/gopogh.exe", "C:\Go\bin\gopogh.exe")
|
||||
(New-Object Net.WebClient).DownloadFile("https://github.com/gotestyourself/gotestsum/releases/download/v1.6.4/gotestsum_1.6.4_windows_amd64.tar.gz", "$env:TEMP\gotestsum.tar.gz")
|
||||
tar --directory "C:\Go\bin\" -xzvf "$env:TEMP\gotestsum.tar.gz" "gotestsum.exe"
|
||||
|
||||
# Grab all the scripts we'll need for integration tests
|
||||
gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/minikube-windows-amd64.exe out/
|
||||
gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/e2e-windows-amd64.exe out/
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/testdata .
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/windows_integration_setup.ps1 out/
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/windows_integration_teardown.ps1 out/
|
||||
|
||||
# Make sure an old minikube instance isn't running
|
||||
./out/minikube-windows-amd64.exe delete --all
|
||||
|
||||
./out/windows_integration_setup.ps1
|
||||
|
|
@ -62,19 +102,28 @@ If($env:status -eq "failure") {
|
|||
}
|
||||
echo $description
|
||||
|
||||
$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7)
|
||||
$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:ROOT_JOB_ID"
|
||||
|
||||
#Upload logs to gcs
|
||||
gsutil -qm cp testout.txt gs://$gcs_bucket/${env:JOB_NAME}out.txt
|
||||
gsutil -qm cp testout.json gs://$gcs_bucket/${env:JOB_NAME}.json
|
||||
gsutil -qm cp testout.html gs://$gcs_bucket/${env:JOB_NAME}.html
|
||||
gsutil -qm cp testout_summary.json gs://$gcs_bucket/${env:JOB_NAME}_summary.json
|
||||
If($env:EXTERNAL -eq "yes"){
|
||||
# If we're not already in GCP, we won't have credentials to upload to GCS
|
||||
# Instad, move logs to a predictable spot Jenkins can find and upload itself
|
||||
mkdir -p test_reports
|
||||
cp testout.txt test_reports/out.txt
|
||||
cp testout.json test_reports/out.json
|
||||
cp testout.html test_reports/out.html
|
||||
cp testout_summary.json test_reports/summary.txt
|
||||
} Else {
|
||||
gsutil -qm cp testout.txt gs://$gcs_bucket/${env:JOB_NAME}out.txt
|
||||
gsutil -qm cp testout.json gs://$gcs_bucket/${env:JOB_NAME}.json
|
||||
gsutil -qm cp testout.html gs://$gcs_bucket/${env:JOB_NAME}.html
|
||||
gsutil -qm cp testout_summary.json gs://$gcs_bucket/${env:JOB_NAME}_summary.json
|
||||
}
|
||||
|
||||
$env:target_url="https://storage.googleapis.com/$gcs_bucket/$env:JOB_NAME.html"
|
||||
|
||||
# Update the PR with the new info
|
||||
$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins: $description`", `"target_url`": `"$env:target_url`", `"context`": `"${env:JOB_NAME}`"}"
|
||||
Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`?access_token=$env:access_token" -Body $json -ContentType "application/json" -Method Post -usebasicparsing
|
||||
$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins: $description`", `"target_url`": `"$env:target_url`", `"context`": `"$env:JOB_NAME`"}"
|
||||
Write-GithubStatus -JsonBody $json
|
||||
|
||||
./out/windows_integration_teardown.ps1
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ set -eux -o pipefail
|
|||
|
||||
jobs=(
|
||||
'Hyperkit_macOS'
|
||||
# 'Hyper-V_Windows'
|
||||
'Hyper-V_Windows'
|
||||
# 'VirtualBox_Linux'
|
||||
# 'VirtualBox_macOS'
|
||||
# 'VirtualBox_Windows'
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ Get-Process "*Docker Desktop*" | Stop-Process
|
|||
$attempt = 1
|
||||
while($attempt -le 10) {
|
||||
Write-Host "Attempt ", $attempt
|
||||
Write-Host "Wait for 5 minutes"
|
||||
Write-Host "Wait for 3 minutes"
|
||||
& "C:\Program Files\Docker\Docker\Docker Desktop.exe"
|
||||
Start-Sleep 300
|
||||
Start-Sleep 180
|
||||
$dockerInfo = docker info
|
||||
Write-Host "Docker Info ", $dockerInfo
|
||||
$serverVersion = $dockerInfo | Where-Object {$_ -Match "Server Version"}
|
||||
|
|
|
|||
|
|
@ -17,4 +17,9 @@ if (Jenkins) {
|
|||
echo "doing it"
|
||||
docker system prune --all --force --volumes
|
||||
Get-Process "*Docker Desktop*" | Stop-Process
|
||||
Get-VM | Where-Object {$_.Name -ne "DockerDesktopVM"} | Foreach {
|
||||
Suspend-VM $_.Name
|
||||
Stop-VM $_.Name -Force
|
||||
Remove-VM $_.Name -Force
|
||||
}
|
||||
shutdown /r
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
function Jenkins {
|
||||
Get-Process e2e-windows-amd64 2>$NULL
|
||||
if ($?) {
|
||||
return $TRUE
|
||||
}
|
||||
return $FALSE
|
||||
}
|
||||
|
||||
if (Jenkins) {
|
||||
exit 0
|
||||
}
|
||||
echo "waiting to see if any jobs are coming in..."
|
||||
timeout 30
|
||||
if (Jenkins) {
|
||||
exit 0
|
||||
}
|
||||
echo "doing it"
|
||||
taskkill /IM putty.exe
|
||||
taskkill /F /IM java.exe
|
||||
Get-VM | Where-Object {$_.Name -ne "DockerDesktopVM"} | Foreach {
|
||||
C:\var\jenkins\workspace\Hyper-V_Windows_integration\out\minikube-windows-amd64.exe delete -p $_.Name
|
||||
Suspend-VM $_.Name
|
||||
Stop-VM $_.Name -Force
|
||||
Remove-VM $_.Name -Force
|
||||
}
|
||||
Remove-Item -path C:\Users\admin\.minikube -recurse -force
|
||||
shutdown /r
|
||||
|
|
@ -1 +1 @@
|
|||
Schtasks /create /tn cleanup_reboot /sc HOURLY /tr "Powershell gsutil -m cp gs://minikube-builds/master/windows_cleanup_and_reboot_docker.ps1 C:\Users\jenkins; C:\Users\jenkins\windows_cleanup_and_reboot_docker.ps1"
|
||||
Schtasks /create /tn cleanup_reboot /sc MINUTE /mo 30 /tr "Powershell C:\jenkins\windows_cleanup_and_reboot.ps1" /f
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ if ($driver -eq "docker") {
|
|||
}
|
||||
|
||||
rm -r -Force $test_home
|
||||
C:\jenkins\windows_cleanup_and_reboot.ps1
|
||||
|
|
|
|||
|
|
@ -14,29 +14,11 @@
|
|||
|
||||
mkdir -p out
|
||||
|
||||
# Docker's kubectl breaks things, and comes earlier in the path than the regular kubectl. So download the expected kubectl and replace Docker's version.
|
||||
(New-Object Net.WebClient).DownloadFile("https://dl.k8s.io/release/v1.20.0/bin/windows/amd64/kubectl.exe", "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe")
|
||||
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/setup_docker_desktop_windows.ps1 out/
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/common.ps1 out/
|
||||
|
||||
$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7)
|
||||
$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:ROOT_JOB_ID"
|
||||
|
||||
./out/setup_docker_desktop_windows.ps1
|
||||
If ($lastexitcode -gt 0) {
|
||||
echo "Docker failed to start, exiting."
|
||||
|
||||
$json = "{`"state`": `"failure`", `"description`": `"Jenkins: docker failed to start`", `"target_url`": `"https://storage.googleapis.com/$gcs_bucket/Docker_Windows.txt`", `"context`": `"Docker_Windows`"}"
|
||||
|
||||
Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`?access_token=$env:access_token" -Body $json -ContentType "application/json" -Method Post -usebasicparsing
|
||||
|
||||
docker system prune --all --force
|
||||
Exit $lastexitcode
|
||||
}
|
||||
|
||||
$driver="docker"
|
||||
$timeout="180m"
|
||||
$env:JOB_NAME="Docker_Windows"
|
||||
$env:EXTERNAL="yes"
|
||||
|
||||
. ./out/common.ps1
|
||||
|
|
|
|||
|
|
@ -12,10 +12,13 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
mkdir -p out
|
||||
|
||||
gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/common.ps1 out/
|
||||
|
||||
$driver="hyperv"
|
||||
$timeout="65m"
|
||||
$timeout="180m"
|
||||
$env:JOB_NAME="Hyper-V_Windows"
|
||||
$env:EXTERNAL="yes"
|
||||
|
||||
. ./out/common.ps1
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
|
|
@ -218,7 +217,7 @@ func prepareImage(ctx context.Context, current, release string) (image string, e
|
|||
|
||||
// getKICVersion returns current kic base image version and any error
|
||||
func getKICVersion() (string, error) {
|
||||
blob, err := ioutil.ReadFile(kicFile)
|
||||
blob, err := os.ReadFile(kicFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
|
@ -56,12 +56,12 @@ func downloadMinikube(ctx context.Context, minikubePath string) error {
|
|||
}
|
||||
defer rc.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(rc)
|
||||
data, err := io.ReadAll(rc)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "ioutil read all")
|
||||
return errors.Wrap(err, "io read all")
|
||||
}
|
||||
log.Printf("downloading gs://%s/%s to %v", bucketName, binary(), minikubePath)
|
||||
if err := ioutil.WriteFile(minikubePath, data, 0777); err != nil {
|
||||
if err := os.WriteFile(minikubePath, data, 0777); err != nil {
|
||||
return errors.Wrap(err, "writing minikubePath")
|
||||
}
|
||||
if err := os.Chmod(minikubePath, 0700); err != nil {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package update
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ func fsUpdate(fsRoot string, schema map[string]Item, data interface{}) (changed
|
|||
return false, fmt.Errorf("unable to get file content: %w", err)
|
||||
}
|
||||
mode = info.Mode()
|
||||
content, err = ioutil.ReadFile(path)
|
||||
content, err = os.ReadFile(path)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("unable to read file content: %w", err)
|
||||
}
|
||||
|
|
@ -54,7 +53,7 @@ func fsUpdate(fsRoot string, schema map[string]Item, data interface{}) (changed
|
|||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
return false, fmt.Errorf("unable to create directory: %w", err)
|
||||
}
|
||||
if err := ioutil.WriteFile(path, item.Content, mode); err != nil {
|
||||
if err := os.WriteFile(path, item.Content, mode); err != nil {
|
||||
return false, fmt.Errorf("unable to write file: %w", err)
|
||||
}
|
||||
changed = true
|
||||
|
|
@ -65,7 +64,7 @@ func fsUpdate(fsRoot string, schema map[string]Item, data interface{}) (changed
|
|||
|
||||
// Loadf returns the file content read as byte slice
|
||||
func Loadf(path string) []byte {
|
||||
blob, err := ioutil.ReadFile(path)
|
||||
blob, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
klog.Fatalf("Unable to load file %s: %v", path, err)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -157,7 +157,7 @@ func goVersions() (stable, stableMM, k8sVersion string, err error) {
|
|||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
|
@ -121,7 +121,7 @@ func main() {
|
|||
|
||||
// KICVersions returns current and stable KIC base image versions and any error occurred.
|
||||
func KICVersions() (current, stable string, err error) {
|
||||
blob, err := ioutil.ReadFile(filepath.Join(update.FSRoot, kicFile))
|
||||
blob, err := os.ReadFile(filepath.Join(update.FSRoot, kicFile))
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
|
@ -75,7 +74,7 @@ func enableAddonGCPAuth(cfg *config.ClusterConfig) error {
|
|||
if err != nil {
|
||||
if detect.IsCloudShell() {
|
||||
if c := os.Getenv("CLOUDSDK_CONFIG"); c != "" {
|
||||
f, err := ioutil.ReadFile(path.Join(c, "application_default_credentials.json"))
|
||||
f, err := os.ReadFile(path.Join(c, "application_default_credentials.json"))
|
||||
if err == nil {
|
||||
creds, _ = google.CredentialsFromJSON(ctx, f)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package addons
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
|
@ -31,7 +30,7 @@ import (
|
|||
|
||||
func createTestProfile(t *testing.T) string {
|
||||
t.Helper()
|
||||
td, err := ioutil.TempDir("", "profile")
|
||||
td, err := os.MkdirTemp("", "profile")
|
||||
if err != nil {
|
||||
t.Fatalf("tempdir: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package drivers
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
|
@ -136,7 +135,7 @@ func fixMachinePermissions(path string) error {
|
|||
if err := os.Chown(path, syscall.Getuid(), syscall.Getegid()); err != nil {
|
||||
return errors.Wrap(err, "chown dir")
|
||||
}
|
||||
files, err := ioutil.ReadDir(path)
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "read dir")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package drivers
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -30,7 +29,7 @@ func Test_createDiskImage(t *testing.T) {
|
|||
defer tests.RemoveTempDir(tmpdir)
|
||||
|
||||
sshPath := filepath.Join(tmpdir, "ssh")
|
||||
if err := ioutil.WriteFile(sshPath, []byte("mysshkey"), 0644); err != nil {
|
||||
if err := os.WriteFile(sshPath, []byte("mysshkey"), 0644); err != nil {
|
||||
t.Fatalf("writefile: %v", err)
|
||||
}
|
||||
diskPath := filepath.Join(tmpdir, "disk")
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package hyperkit
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
|
@ -366,7 +365,7 @@ func (d *Driver) recoverFromUncleanShutdown() error {
|
|||
}
|
||||
|
||||
log.Warnf("minikube might have been shutdown in an unclean way, the hyperkit pid file still exists: %s", pidFile)
|
||||
bs, err := ioutil.ReadFile(pidFile)
|
||||
bs, err := os.ReadFile(pidFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "reading pidfile %s", pidFile)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,12 @@ limitations under the License.
|
|||
package hyperkit
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExtractFile(t *testing.T) {
|
||||
testDir, err := ioutil.TempDir(os.TempDir(), "")
|
||||
testDir, err := os.MkdirTemp(os.TempDir(), "")
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ limitations under the License.
|
|||
package hyperkit
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
|
|
@ -54,12 +54,12 @@ func Test_getIpAddressFromFile(t *testing.T) {
|
|||
defer tests.RemoveTempDir(tmpdir)
|
||||
|
||||
dhcpFile := filepath.Join(tmpdir, "dhcp")
|
||||
if err := ioutil.WriteFile(dhcpFile, validLeases, 0644); err != nil {
|
||||
if err := os.WriteFile(dhcpFile, validLeases, 0644); err != nil {
|
||||
t.Fatalf("writefile: %v", err)
|
||||
}
|
||||
|
||||
invalidFile := filepath.Join(tmpdir, "invalid")
|
||||
if err := ioutil.WriteFile(invalidFile, []byte("foo"), 0644); err != nil {
|
||||
if err := os.WriteFile(invalidFile, []byte("foo"), 0644); err != nil {
|
||||
t.Fatalf("writefile: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,10 +123,8 @@ func tryCreateDockerNetwork(ociBin string, subnet *network.Parameters, mtu int,
|
|||
args = append(args, "-o")
|
||||
args = append(args, fmt.Sprintf("com.docker.network.driver.mtu=%d", mtu))
|
||||
}
|
||||
|
||||
args = append(args, fmt.Sprintf("--label=%s=%s", CreatedByLabelKey, "true"))
|
||||
}
|
||||
args = append(args, name)
|
||||
args = append(args, fmt.Sprintf("--label=%s=%s", CreatedByLabelKey, "true"), name)
|
||||
|
||||
rr, err := runCmd(exec.Command(ociBin, args...))
|
||||
if err != nil {
|
||||
|
|
@ -220,7 +218,7 @@ func podmanNetworkInspect(name string) (netInfo, error) {
|
|||
rr, err := runCmd(cmd)
|
||||
if err != nil {
|
||||
logDockerNetworkInspect(Podman, name)
|
||||
if strings.Contains(rr.Output(), "No such network") {
|
||||
if strings.Contains(rr.Output(), "no such network") {
|
||||
|
||||
return info, ErrNetworkNotFound
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ import (
|
|||
|
||||
const (
|
||||
// Version is the current version of kic
|
||||
Version = "v0.0.27"
|
||||
Version = "v0.0.27-1633027942-12081"
|
||||
// SHA of the kic base image
|
||||
baseImageSHA = "89b4738ee74ba28684676e176752277f0db46f57d27f0e08c3feec89311e22de"
|
||||
baseImageSHA = "4780f1897569d2bf77aafb3d133a08d42b4fe61127f06fcfc90c2c5d902d893c"
|
||||
// The name of the GCR kicbase repository
|
||||
gcrRepo = "gcr.io/k8s-minikube/kicbase"
|
||||
gcrRepo = "gcr.io/k8s-minikube/kicbase-builds"
|
||||
// The name of the Dockerhub kicbase repository
|
||||
dockerhubRepo = "docker.io/kicbase/stable"
|
||||
dockerhubRepo = "docker.io/kicbase/build"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ package kvm
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -106,7 +105,7 @@ func getDevicesXML() (string, error) {
|
|||
func getPassthroughableNVIDIADevices() ([]string, error) {
|
||||
|
||||
// Make sure the host supports IOMMU
|
||||
iommuGroups, err := ioutil.ReadDir(sysKernelIOMMUGroupsPath)
|
||||
iommuGroups, err := os.ReadDir(sysKernelIOMMUGroupsPath)
|
||||
if err != nil {
|
||||
return []string{}, fmt.Errorf("error reading %q: %v", sysKernelIOMMUGroupsPath, err)
|
||||
}
|
||||
|
|
@ -115,7 +114,7 @@ func getPassthroughableNVIDIADevices() ([]string, error) {
|
|||
}
|
||||
|
||||
// Get list of PCI devices
|
||||
devices, err := ioutil.ReadDir(sysFsPCIDevicesPath)
|
||||
devices, err := os.ReadDir(sysFsPCIDevicesPath)
|
||||
if err != nil {
|
||||
return []string{}, fmt.Errorf("error reading %q: %v", sysFsPCIDevicesPath, err)
|
||||
}
|
||||
|
|
@ -124,7 +123,7 @@ func getPassthroughableNVIDIADevices() ([]string, error) {
|
|||
found := false
|
||||
for _, device := range devices {
|
||||
vendorPath := filepath.Join(sysFsPCIDevicesPath, device.Name(), "vendor")
|
||||
content, err := ioutil.ReadFile(vendorPath)
|
||||
content, err := os.ReadFile(vendorPath)
|
||||
if err != nil {
|
||||
log.Infof("Error while reading %q: %v", vendorPath, err)
|
||||
continue
|
||||
|
|
@ -173,7 +172,7 @@ func getPassthroughableNVIDIADevices() ([]string, error) {
|
|||
func isIsolated(device string) bool {
|
||||
// Find out the other devices in the same IOMMU group as one of our unbound device.
|
||||
iommuGroupPath := filepath.Join(sysFsPCIDevicesPath, device, "iommu_group", "devices")
|
||||
otherDevices, err := ioutil.ReadDir(iommuGroupPath)
|
||||
otherDevices, err := os.ReadDir(iommuGroupPath)
|
||||
if err != nil {
|
||||
log.Infof("Error reading %q: %v", iommuGroupPath, err)
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package ssh
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -110,7 +109,7 @@ func (d *Driver) PreCreateCheck() error {
|
|||
return fmt.Errorf("SSH key does not exist: %q", d.SSHKey)
|
||||
}
|
||||
|
||||
key, err := ioutil.ReadFile(d.SSHKey)
|
||||
key, err := os.ReadFile(d.SSHKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
|
@ -166,5 +165,5 @@ func saveDocForCommand(command *cobra.Command, contents []byte, path string) err
|
|||
if err := os.Remove(fp); err != nil {
|
||||
klog.Warningf("error removing %s", fp)
|
||||
}
|
||||
return ioutil.WriteFile(fp, contents, 0o644)
|
||||
return os.WriteFile(fp, contents, 0o644)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import (
|
|||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ func ErrorCodes(docPath string, pathsToCheck []string) error {
|
|||
|
||||
fset := token.NewFileSet()
|
||||
for _, pathToCheck := range pathsToCheck {
|
||||
r, err := ioutil.ReadFile(pathToCheck)
|
||||
r, err := os.ReadFile(pathToCheck)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error reading file %s", pathToCheck))
|
||||
}
|
||||
|
|
@ -122,5 +122,5 @@ func ErrorCodes(docPath string, pathsToCheck []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(docPath, buf.Bytes(), 0o644)
|
||||
return os.WriteFile(docPath, buf.Bytes(), 0o644)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,10 @@ import (
|
|||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -33,7 +34,6 @@ import (
|
|||
)
|
||||
|
||||
func TestDocs(docPath string, pathToCheck string) error {
|
||||
counter := 0
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
date := time.Now().Format("2006-01-02")
|
||||
title := out.Fmt(title, out.V{"Command": "Integration Tests", "Description": "All minikube integration tests", "Date": date})
|
||||
|
|
@ -47,7 +47,7 @@ func TestDocs(docPath string, pathToCheck string) error {
|
|||
return nil
|
||||
}
|
||||
fset := token.NewFileSet()
|
||||
r, e := ioutil.ReadFile(path)
|
||||
r, e := os.ReadFile(path)
|
||||
if e != nil {
|
||||
return errors.Wrap(e, fmt.Sprintf("error reading file %s", path))
|
||||
}
|
||||
|
|
@ -62,35 +62,8 @@ func TestDocs(docPath string, pathToCheck string) error {
|
|||
if !shouldParse(fnName) {
|
||||
return true
|
||||
}
|
||||
|
||||
if strings.HasPrefix(fnName, "valid") {
|
||||
e := writeSubTest(fnName, buf)
|
||||
if e != nil {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
e := writeTest(fnName, buf)
|
||||
if e != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
counter++
|
||||
comments := fd.Doc
|
||||
if comments == nil {
|
||||
e := writeComment(fnName, "// NEEDS DOC\n", buf)
|
||||
return e == nil
|
||||
}
|
||||
for _, comment := range comments.List {
|
||||
if strings.Contains(comment.Text, "TODO") {
|
||||
continue
|
||||
}
|
||||
e := writeComment(fnName, comment.Text, buf)
|
||||
if e != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
_, e := buf.WriteString("\n")
|
||||
td := parseFuncDocs(file, fd)
|
||||
_, e := buf.WriteString(td.toMarkdown())
|
||||
if e != nil {
|
||||
return false
|
||||
}
|
||||
|
|
@ -103,10 +76,104 @@ func TestDocs(docPath string, pathToCheck string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(docPath, buf.Bytes(), 0o644)
|
||||
err = os.WriteFile(docPath, buf.Bytes(), 0o644)
|
||||
return err
|
||||
}
|
||||
|
||||
// TestDoc is the documentation for a test case
|
||||
type TestDoc struct {
|
||||
// name is the name of the test case
|
||||
name string
|
||||
// isSubTest is true if the test case is a top-level test case, false if it's a validation method
|
||||
isSubTest bool
|
||||
// description is parsed from the function comment
|
||||
description string
|
||||
// steps are parsed from comments starting with `docs: `
|
||||
steps []string
|
||||
// specialCases are parsed from comments starting with `docs(special): `
|
||||
specialCases []string
|
||||
// specialCases are parsed from comments starting with `docs(skip): `
|
||||
skips []string
|
||||
}
|
||||
|
||||
// toMarkdown converts the TestDoc into a string in Markdown format
|
||||
func (d *TestDoc) toMarkdown() string {
|
||||
b := &strings.Builder{}
|
||||
if d.isSubTest {
|
||||
b.WriteString("#### " + d.name + "\n")
|
||||
} else {
|
||||
b.WriteString("## " + d.name + "\n")
|
||||
}
|
||||
|
||||
b.WriteString(d.description + "\n")
|
||||
if len(d.steps) > 0 {
|
||||
b.WriteString("Steps:\n")
|
||||
for _, s := range d.steps {
|
||||
b.WriteString("- " + s + "\n")
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
|
||||
if len(d.specialCases) > 0 {
|
||||
b.WriteString("Special cases:\n")
|
||||
for _, s := range d.specialCases {
|
||||
b.WriteString("- " + s + "\n")
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
|
||||
if len(d.skips) > 0 {
|
||||
b.WriteString("Skips:\n")
|
||||
for _, s := range d.skips {
|
||||
b.WriteString("- " + s + "\n")
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// docsRegex is the regex of the docs comment starting with either `docs: ` or `docs(...): `
|
||||
var docsRegex = regexp.MustCompile(`docs(?:\((.*?)\))?:\s*`)
|
||||
|
||||
// parseFuncDocs parses the comments from a function starting with `docs`
|
||||
func parseFuncDocs(file *ast.File, fd *ast.FuncDecl) TestDoc {
|
||||
d := TestDoc{
|
||||
name: fd.Name.Name,
|
||||
description: strings.TrimPrefix(fd.Doc.Text(), fd.Name.Name+" "),
|
||||
isSubTest: strings.HasPrefix(fd.Name.Name, "valid"),
|
||||
}
|
||||
|
||||
for _, c := range file.Comments {
|
||||
for _, ci := range c.List {
|
||||
if ci.Pos() < fd.Pos() || ci.End() > fd.End() {
|
||||
// only generate docs for comments that are within the function scope
|
||||
continue
|
||||
}
|
||||
text := strings.TrimPrefix(ci.Text, "// ")
|
||||
m := docsRegex.FindStringSubmatch(text)
|
||||
if len(m) < 2 {
|
||||
// comment doesn't start with `docs: ` or `docs(...): `
|
||||
continue
|
||||
}
|
||||
matched := m[0]
|
||||
docsType := m[1]
|
||||
|
||||
text = strings.TrimPrefix(text, matched)
|
||||
switch docsType {
|
||||
case "special":
|
||||
d.specialCases = append(d.specialCases, text)
|
||||
case "skip":
|
||||
d.skips = append(d.skips, text)
|
||||
case "":
|
||||
d.steps = append(d.steps, text)
|
||||
default:
|
||||
log.Printf("docs type %s is not recognized", docsType)
|
||||
}
|
||||
}
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func shouldParse(name string) bool {
|
||||
if strings.HasPrefix(name, "Test") && !strings.HasPrefix(name, "TestMain") {
|
||||
return true
|
||||
|
|
@ -118,21 +185,3 @@ func shouldParse(name string) bool {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func writeTest(testName string, w *bytes.Buffer) error {
|
||||
_, err := w.WriteString("## " + testName + "\n")
|
||||
return err
|
||||
}
|
||||
|
||||
func writeSubTest(testName string, w *bytes.Buffer) error {
|
||||
_, err := w.WriteString("#### " + testName + "\n")
|
||||
return err
|
||||
}
|
||||
|
||||
func writeComment(testName string, comment string, w *bytes.Buffer) error {
|
||||
// Remove the leading // from the testdoc comments
|
||||
comment = comment[3:]
|
||||
comment = strings.TrimPrefix(comment, testName+" ")
|
||||
_, err := w.WriteString(comment + "\n")
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package gvisor
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -179,7 +178,7 @@ func copyAssetToDest(targetName, dest string) error {
|
|||
// Now, copy the data from this asset to dest
|
||||
src := filepath.Join(vmpath.GuestGvisorDir, asset.GetTargetName())
|
||||
log.Printf("%s asset path: %s", targetName, src)
|
||||
contents, err := ioutil.ReadFile(src)
|
||||
contents, err := os.ReadFile(src)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "getting contents of %s", asset.GetSourcePath())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ var Addons = map[string]*Addon{
|
|||
"helm-tiller-svc.yaml",
|
||||
"0640"),
|
||||
}, false, "helm-tiller", "", map[string]string{
|
||||
"Tiller": "helm/tiller:v2.16.12@sha256:6003775d503546087266eda39418d221f9afb5ccfe35f637c32a1161619a3f9c",
|
||||
"Tiller": "helm/tiller:v2.17.0@sha256:4c43eb385032945cad047d2350e4945d913b90b3ab43ee61cecb32a495c6df0f",
|
||||
}, map[string]string{
|
||||
// GCR is deprecated in helm
|
||||
// https://github.com/helm/helm/issues/10004#issuecomment-894478908
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package audit
|
|||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -39,7 +38,7 @@ func TestLogFile(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("AppendToLog", func(t *testing.T) {
|
||||
f, err := ioutil.TempFile("", "audit.json")
|
||||
f, err := os.CreateTemp("", "audit.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating temporary file: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,12 @@ limitations under the License.
|
|||
package audit
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReport(t *testing.T) {
|
||||
f, err := ioutil.TempFile("", "audit.json")
|
||||
f, err := os.CreateTemp("", "audit.json")
|
||||
if err != nil {
|
||||
t.Fatalf("failed creating temporary file: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package bsutil
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
@ -83,7 +83,7 @@ func getExtraOptsPodCidr() []config.ExtraOption {
|
|||
// It will error if no testdata are available or in absence of testdata for newest and default minor k8s versions.
|
||||
func recentReleases(n int) ([]string, error) {
|
||||
path := "testdata"
|
||||
files, err := ioutil.ReadDir(path)
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to list testdata directory %s: %w", path, err)
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ func TestGenerateKubeadmYAMLDNS(t *testing.T) {
|
|||
if tc.shouldErr {
|
||||
return
|
||||
}
|
||||
expected, err := ioutil.ReadFile(fmt.Sprintf("testdata/%s/%s.yaml", version, tc.name))
|
||||
expected, err := os.ReadFile(fmt.Sprintf("testdata/%s/%s.yaml", version, tc.name))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to read testdata: %v", err)
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ func TestGenerateKubeadmYAML(t *testing.T) {
|
|||
if tc.shouldErr {
|
||||
return
|
||||
}
|
||||
expected, err := ioutil.ReadFile(fmt.Sprintf("testdata/%s/%s.yaml", version, tc.name))
|
||||
expected, err := os.ReadFile(fmt.Sprintf("testdata/%s/%s.yaml", version, tc.name))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to read testdata: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@ import (
|
|||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strconv"
|
||||
|
|
@ -237,7 +238,7 @@ func apiServerHealthz(hostname string, port int) (state.State, error) {
|
|||
func apiServerHealthzNow(hostname string, port int) (state.State, error) {
|
||||
url := fmt.Sprintf("https://%s/healthz", net.JoinHostPort(hostname, fmt.Sprint(port)))
|
||||
klog.Infof("Checking apiserver healthz at %s ...", url)
|
||||
cert, err := ioutil.ReadFile(localpath.CACert())
|
||||
cert, err := os.ReadFile(localpath.CACert())
|
||||
if err != nil {
|
||||
klog.Infof("ca certificate: %v", err)
|
||||
return state.Stopped, err
|
||||
|
|
@ -257,7 +258,7 @@ func apiServerHealthzNow(hostname string, port int) (state.State, error) {
|
|||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
klog.Warningf("unable to read response body: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -334,7 +333,7 @@ func generateProfileCerts(cfg config.ClusterConfig, n config.Node, ccs CACerts,
|
|||
|
||||
// isValidPEMCertificate checks whether the input file is a valid PEM certificate (with at least one CERTIFICATE block)
|
||||
func isValidPEMCertificate(filePath string) (bool, error) {
|
||||
fileBytes, err := ioutil.ReadFile(filePath)
|
||||
fileBytes, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,18 @@ limitations under the License.
|
|||
package cni
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os/exec"
|
||||
"text/template"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
)
|
||||
|
||||
// From https://raw.githubusercontent.com/cilium/cilium/v1.9/install/kubernetes/quick-install.yaml
|
||||
var ciliumTmpl = `---
|
||||
var ciliumTmpl = template.Must(template.New("name").Parse(
|
||||
`---
|
||||
# Source: cilium/templates/cilium-agent-serviceaccount.yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
|
|
@ -175,7 +179,7 @@ data:
|
|||
hubble-tls-key-file: /var/lib/cilium/tls/hubble/server.key
|
||||
hubble-tls-client-ca-files: /var/lib/cilium/tls/hubble/client-ca.crt
|
||||
ipam: "cluster-pool"
|
||||
cluster-pool-ipv4-cidr: "10.0.0.0/8"
|
||||
cluster-pool-ipv4-cidr: "{{.PodSubnet }}"
|
||||
cluster-pool-ipv4-mask-size: "24"
|
||||
disable-cnp-status-updates: "true"
|
||||
cgroup-root: "/run/cilium/cgroupv2"
|
||||
|
|
@ -786,7 +790,8 @@ spec:
|
|||
- configMap:
|
||||
name: cilium-config
|
||||
name: cilium-config-path
|
||||
`
|
||||
`,
|
||||
))
|
||||
|
||||
// Cilium is the Cilium CNI manager
|
||||
type Cilium struct {
|
||||
|
|
@ -798,6 +803,35 @@ func (c Cilium) String() string {
|
|||
return "Cilium"
|
||||
}
|
||||
|
||||
// CIDR returns the default CIDR used by this CNI
|
||||
func (c Cilium) CIDR() string {
|
||||
return DefaultPodCIDR
|
||||
}
|
||||
|
||||
// GenerateKubeadmYAML generates the .yaml file
|
||||
func GenerateCiliumYAML() ([]byte, error) {
|
||||
|
||||
podCIDR := DefaultPodCIDR
|
||||
|
||||
klog.Infof("Using pod CIDR: %s", podCIDR)
|
||||
|
||||
opts := struct {
|
||||
PodSubnet string
|
||||
}{
|
||||
PodSubnet: podCIDR,
|
||||
}
|
||||
|
||||
b := bytes.Buffer{}
|
||||
configTmpl := ciliumTmpl
|
||||
|
||||
klog.Infof("cilium options: %+v", opts)
|
||||
if err := configTmpl.Execute(&b, opts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
klog.Infof("cilium config:\n%s\n", b.String())
|
||||
return b.Bytes(), nil
|
||||
}
|
||||
|
||||
// Apply enables the CNI
|
||||
func (c Cilium) Apply(r Runner) error {
|
||||
// see https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/
|
||||
|
|
@ -805,10 +839,10 @@ func (c Cilium) Apply(r Runner) error {
|
|||
return errors.Wrap(err, "bpf mount")
|
||||
}
|
||||
|
||||
return applyManifest(c.cc, r, manifestAsset([]byte(ciliumTmpl)))
|
||||
}
|
||||
ciliumCfg, err := GenerateCiliumYAML()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "generating cilium cfg")
|
||||
}
|
||||
|
||||
// CIDR returns the default CIDR used by this CNI
|
||||
func (c Cilium) CIDR() string {
|
||||
return DefaultPodCIDR
|
||||
return applyManifest(c.cc, r, manifestAsset(ciliumCfg))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ func fileExists(r Runner, f assets.CopyableFile, dst string) (bool, error) {
|
|||
return srcModTime.Equal(dstModTime), nil
|
||||
}
|
||||
|
||||
// writeFile is like ioutil.WriteFile, but does not require reading file into memory
|
||||
// writeFile is like os.WriteFile, but does not require reading file into memory
|
||||
func writeFile(dst string, f assets.CopyableFile, perms os.FileMode) error {
|
||||
w, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE, perms)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
|
@ -161,7 +160,7 @@ func (e *execRunner) Copy(f assets.CopyableFile) error {
|
|||
|
||||
if e.sudo {
|
||||
// write to temp location ...
|
||||
tmpfile, err := ioutil.TempFile("", "minikube")
|
||||
tmpfile, err := os.CreateTemp("", "minikube")
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error creating tempfile")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
|
@ -192,7 +191,7 @@ func (k *kicRunner) Copy(f assets.CopyableFile) error {
|
|||
return errors.Wrap(err, "determining temp directory")
|
||||
}
|
||||
|
||||
tf, err := ioutil.TempFile(tmpFolder, "tmpf-memory-asset")
|
||||
tf, err := os.CreateTemp(tmpFolder, "tmpf-memory-asset")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "creating temporary file")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -211,7 +210,7 @@ func (c *simpleConfigLoader) LoadConfigFromFile(profileName string, miniHome ...
|
|||
return nil, errors.Wrap(err, "stat")
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
if os.IsPermission(err) {
|
||||
return nil, &ErrPermissionDenied{err.Error()}
|
||||
|
|
@ -231,7 +230,7 @@ func (c *simpleConfigLoader) WriteConfigToFile(profileName string, cc *ClusterCo
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(path, contents, 0644)
|
||||
return os.WriteFile(path, contents, 0644)
|
||||
}
|
||||
|
||||
// MultiNode returns true if the cluster has multiple nodes or if the request is asking for multinode
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package config
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
|
@ -144,7 +143,7 @@ func TestReadConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestWriteConfig(t *testing.T) {
|
||||
configFile, err := ioutil.TempFile("/tmp", "configTest")
|
||||
configFile, err := os.CreateTemp("/tmp", "configTest")
|
||||
if err != nil {
|
||||
t.Fatalf("Error not expected but got %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package config
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
|
@ -155,13 +154,13 @@ func SaveProfile(name string, cfg *ClusterConfig, miniHome ...string) error {
|
|||
return lock.WriteFile(path, data, 0600)
|
||||
}
|
||||
|
||||
tf, err := ioutil.TempFile(filepath.Dir(path), "config.json.tmp")
|
||||
tf, err := os.CreateTemp(filepath.Dir(path), "config.json.tmp")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(tf.Name())
|
||||
|
||||
if err = ioutil.WriteFile(tf.Name(), data, 0600); err != nil {
|
||||
if err = os.WriteFile(tf.Name(), data, 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +294,7 @@ func profileDirs(miniHome ...string) (dirs []string, err error) {
|
|||
miniPath = miniHome[0]
|
||||
}
|
||||
pRootDir := filepath.Join(miniPath, "profiles")
|
||||
items, err := ioutil.ReadDir(pRootDir)
|
||||
items, err := os.ReadDir(pRootDir)
|
||||
for _, f := range items {
|
||||
if f.IsDir() {
|
||||
dirs = append(dirs, f.Name())
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -302,12 +301,12 @@ func TestGetPrimaryControlPlane(t *testing.T) {
|
|||
originalFilePath := profileFilePath(tc.profile, miniDir)
|
||||
tempFilePath := filepath.Join(miniDir, "profiles", tc.profile, "config_temp.json")
|
||||
|
||||
d, err := ioutil.ReadFile(originalFilePath)
|
||||
d, err := os.ReadFile(originalFilePath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to read config file : %s", originalFilePath)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(tempFilePath, d, 0644)
|
||||
err = os.WriteFile(tempFilePath, d, 0644)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to write temporal config file : %s", tempFilePath)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,10 +393,6 @@ func downloadRemote(cr CommandRunner, src string) (string, error) {
|
|||
|
||||
// BuildImage builds an image into this runtime
|
||||
func (r *Containerd) BuildImage(src string, file string, tag string, push bool, env []string, opts []string) error {
|
||||
if err := r.initBuildkitDaemon(); err != nil {
|
||||
return fmt.Errorf("failed to init buildkit daemon: %v", err)
|
||||
}
|
||||
|
||||
// download url if not already present
|
||||
dir, err := downloadRemote(r.Runner, src)
|
||||
if err != nil {
|
||||
|
|
@ -456,24 +452,6 @@ func (r *Containerd) PushImage(name string) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (r *Containerd) initBuildkitDaemon() error {
|
||||
// if daemon is already running, do nothing
|
||||
cmd := exec.Command("pgrep", "buildkitd")
|
||||
if _, err := r.Runner.RunCmd(cmd); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// otherwise, start daemon
|
||||
cmd = exec.Command("/bin/bash", "-c", "sudo -b buildkitd --oci-worker false --containerd-worker true --containerd-worker-namespace k8s.io &> /dev/null")
|
||||
if _, err := r.Runner.RunCmd(cmd); err != nil {
|
||||
return fmt.Errorf("failed to start buildkit daemon: %v", err)
|
||||
}
|
||||
|
||||
// give the daemon time to finish starting up or image build will fail
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CGroupDriver returns cgroup driver ("cgroupfs" or "systemd")
|
||||
func (r *Containerd) CGroupDriver() (string, error) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/style"
|
||||
)
|
||||
|
||||
// PossibleLeftOvers deletes KIC & non-KIC drivers left
|
||||
// PossibleLeftOvers deletes KIC driver left overs
|
||||
func PossibleLeftOvers(ctx context.Context, cname string, driverName string) {
|
||||
bin := ""
|
||||
switch driverName {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ const fileScheme = "file"
|
|||
// DefaultISOURLs returns a list of ISO URL's to consult by default, in priority order
|
||||
func DefaultISOURLs() []string {
|
||||
v := version.GetISOVersion()
|
||||
isoBucket := "minikube/iso"
|
||||
isoBucket := "minikube-builds/iso/12081"
|
||||
return []string{
|
||||
fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", isoBucket, v),
|
||||
fmt.Sprintf("https://github.com/kubernetes/minikube/releases/download/%s/minikube-%s.iso", v, v),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -188,7 +187,7 @@ func Preload(k8sVersion, containerRuntime, driverName string) error {
|
|||
if err != nil {
|
||||
klog.Warningf("No checksum for preloaded tarball for k8s version %s: %v", k8sVersion, err)
|
||||
realPath = targetPath
|
||||
tmp, err := ioutil.TempFile(targetDir(), TarballName(k8sVersion, containerRuntime)+".*")
|
||||
tmp, err := os.CreateTemp(targetDir(), TarballName(k8sVersion, containerRuntime)+".*")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "tempfile")
|
||||
}
|
||||
|
|
@ -245,7 +244,7 @@ var getChecksum = func(k8sVersion, containerRuntime string) ([]byte, error) {
|
|||
// saveChecksumFile saves the checksum to a local file for later verification
|
||||
func saveChecksumFile(k8sVersion, containerRuntime string, checksum []byte) error {
|
||||
klog.Infof("saving checksum for %s ...", TarballName(k8sVersion, containerRuntime))
|
||||
return ioutil.WriteFile(PreloadChecksumPath(k8sVersion, containerRuntime), checksum, 0o644)
|
||||
return os.WriteFile(PreloadChecksumPath(k8sVersion, containerRuntime), checksum, 0o644)
|
||||
}
|
||||
|
||||
// verifyChecksum returns true if the checksum of the local binary matches
|
||||
|
|
@ -253,13 +252,13 @@ func saveChecksumFile(k8sVersion, containerRuntime string, checksum []byte) erro
|
|||
func verifyChecksum(k8sVersion, containerRuntime, path string) error {
|
||||
klog.Infof("verifying checksumm of %s ...", path)
|
||||
// get md5 checksum of tarball path
|
||||
contents, err := ioutil.ReadFile(path)
|
||||
contents, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "reading tarball")
|
||||
}
|
||||
checksum := md5.Sum(contents)
|
||||
|
||||
remoteChecksum, err := ioutil.ReadFile(PreloadChecksumPath(k8sVersion, containerRuntime))
|
||||
remoteChecksum, err := os.ReadFile(PreloadChecksumPath(k8sVersion, containerRuntime))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "reading checksum file")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package driver
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
|
@ -91,7 +90,7 @@ func TestFlagDefaults(t *testing.T) {
|
|||
t.Errorf("defaults mismatch (-want +got):\n%s", diff)
|
||||
}
|
||||
|
||||
tf, err := ioutil.TempFile("", "resolv.conf")
|
||||
tf, err := os.CreateTemp("", "resolv.conf")
|
||||
if err != nil {
|
||||
t.Fatalf("tempfile: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import (
|
|||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -161,7 +160,7 @@ func shouldCheckFile(path string) bool {
|
|||
// inspectFile goes through the given file line by line looking for translatable strings
|
||||
func inspectFile(e *state) error {
|
||||
fset := token.NewFileSet()
|
||||
r, err := ioutil.ReadFile(e.filename)
|
||||
r, err := os.ReadFile(e.filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -451,7 +450,7 @@ func writeStringsToFiles(e *state, output string) error {
|
|||
}
|
||||
fmt.Printf("Writing to %s", filepath.Base(path))
|
||||
currentTranslations := make(map[string]interface{})
|
||||
f, err := ioutil.ReadFile(path)
|
||||
f, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "reading translation file")
|
||||
}
|
||||
|
|
@ -491,7 +490,7 @@ func writeStringsToFiles(e *state, output string) error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "marshalling translations")
|
||||
}
|
||||
err = ioutil.WriteFile(path, c, info.Mode())
|
||||
err = os.WriteFile(path, c, info.Mode())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "writing translation file")
|
||||
}
|
||||
|
|
@ -509,7 +508,7 @@ func writeStringsToFiles(e *state, output string) error {
|
|||
return errors.Wrap(err, "marshalling translations")
|
||||
}
|
||||
path := filepath.Join(output, "strings.txt")
|
||||
err = ioutil.WriteFile(path, c, 0644)
|
||||
err = os.WriteFile(path, c, 0644)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "writing translation file")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package extract
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
|
@ -33,7 +32,7 @@ func TestExtract(t *testing.T) {
|
|||
// The function we care about
|
||||
functions := []string{"extract.PrintToScreen"}
|
||||
|
||||
tempdir, err := ioutil.TempDir("", "temptestdata")
|
||||
tempdir, err := os.MkdirTemp("", "temptestdata")
|
||||
if err != nil {
|
||||
t.Fatalf("Creating temp dir: %v", err)
|
||||
}
|
||||
|
|
@ -44,13 +43,13 @@ func TestExtract(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
src, err := ioutil.ReadFile("testdata/test.json")
|
||||
src, err := os.ReadFile("testdata/test.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Reading json file: %v", err)
|
||||
}
|
||||
|
||||
tempfile := filepath.Join(tempdir, "tmpdata.json")
|
||||
err = ioutil.WriteFile(tempfile, src, 0666)
|
||||
err = os.WriteFile(tempfile, src, 0666)
|
||||
if err != nil {
|
||||
t.Fatalf("Writing temp json file: %v", err)
|
||||
}
|
||||
|
|
@ -68,7 +67,7 @@ func TestExtract(t *testing.T) {
|
|||
t.Fatalf("Error translating strings: %v", err)
|
||||
}
|
||||
|
||||
f, err := ioutil.ReadFile(tempfile)
|
||||
f, err := os.ReadFile(tempfile)
|
||||
if err != nil {
|
||||
t.Fatalf("Reading resulting json file: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package image
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
|
@ -160,7 +159,7 @@ func saveToTarFile(iname, rawDest string, overwrite bool) error {
|
|||
|
||||
func writeImage(img v1.Image, dst string, ref name.Reference) error {
|
||||
klog.Infoln("opening: ", dst)
|
||||
f, err := ioutil.TempFile(filepath.Dir(dst), filepath.Base(dst)+".*.tmp")
|
||||
f, err := os.CreateTemp(filepath.Dir(dst), filepath.Base(dst)+".*.tmp")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package image
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
|
@ -289,7 +288,7 @@ func cleanImageCacheDir() error {
|
|||
return nil
|
||||
}
|
||||
// If directory is empty, delete it
|
||||
entries, err := ioutil.ReadDir(path)
|
||||
entries, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package kubeconfig
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -50,7 +49,7 @@ func TestDeleteContext(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetCurrentContext(t *testing.T) {
|
||||
f, err := ioutil.TempFile("/tmp", "kubeconfig")
|
||||
f, err := os.CreateTemp("/tmp", "kubeconfig")
|
||||
if err != nil {
|
||||
t.Fatalf("Error not expected but got %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package kubeconfig
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
|
|
@ -201,7 +200,7 @@ func readOrNew(configPath ...string) (*api.Config, error) {
|
|||
fPath = configPath[0]
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(fPath)
|
||||
data, err := os.ReadFile(fPath)
|
||||
if os.IsNotExist(err) {
|
||||
return api.NewConfig(), nil
|
||||
} else if err != nil {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package kubeconfig
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
|
@ -229,7 +228,7 @@ func TestUpdate(t *testing.T) {
|
|||
|
||||
for _, test := range tests {
|
||||
t.Run(test.description, func(t *testing.T) {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Error making temp directory %v", err)
|
||||
}
|
||||
|
|
@ -242,7 +241,7 @@ func TestUpdate(t *testing.T) {
|
|||
|
||||
test.cfg.SetPath(filepath.Join(tmpDir, "kubeconfig"))
|
||||
if len(test.existingCfg) != 0 {
|
||||
if err := ioutil.WriteFile(test.cfg.filePath(), test.existingCfg, 0600); err != nil {
|
||||
if err := os.WriteFile(test.cfg.filePath(), test.existingCfg, 0600); err != nil {
|
||||
t.Fatalf("WriteFile: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
@ -460,7 +459,7 @@ func TestEmptyConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNewConfig(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", ".kube")
|
||||
dir, err := os.MkdirTemp("", ".kube")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -537,7 +536,7 @@ func Test_Endpoint(t *testing.T) {
|
|||
// tempFile creates a temporary with the provided bytes as its contents.
|
||||
// The caller is responsible for deleting file after use.
|
||||
func tempFile(t *testing.T, data []byte) string {
|
||||
tmp, err := ioutil.TempFile("", "kubeconfig")
|
||||
tmp, err := os.CreateTemp("", "kubeconfig")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
package kubeconfig
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync/atomic"
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
|
|||
cluster := api.NewCluster()
|
||||
cluster.Server = cfg.ClusterServerAddress
|
||||
if cfg.EmbedCerts {
|
||||
cluster.CertificateAuthorityData, err = ioutil.ReadFile(cfg.CertificateAuthority)
|
||||
cluster.CertificateAuthorityData, err = os.ReadFile(cfg.CertificateAuthority)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "reading CertificateAuthority %s", cfg.CertificateAuthority)
|
||||
}
|
||||
|
|
@ -100,11 +100,11 @@ func PopulateFromSettings(cfg *Settings, apiCfg *api.Config) error {
|
|||
userName := cfg.ClusterName
|
||||
user := api.NewAuthInfo()
|
||||
if cfg.EmbedCerts {
|
||||
user.ClientCertificateData, err = ioutil.ReadFile(cfg.ClientCertificate)
|
||||
user.ClientCertificateData, err = os.ReadFile(cfg.ClientCertificate)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "reading ClientCertificate %s", cfg.ClientCertificate)
|
||||
}
|
||||
user.ClientKeyData, err = ioutil.ReadFile(cfg.ClientKey)
|
||||
user.ClientKeyData, err = os.ReadFile(cfg.ClientKey)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "reading ClientKey %s", cfg.ClientKey)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package localpath
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
|
@ -29,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
func TestReplaceWinDriveLetterToVolumeName(t *testing.T) {
|
||||
path, err := ioutil.TempDir("", "repwindl2vn")
|
||||
path, err := os.MkdirTemp("", "repwindl2vn")
|
||||
if err != nil {
|
||||
t.Fatalf("Error make tmp directory: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package machine
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
@ -89,7 +88,7 @@ func TestCacheBinariesForBootstrapper(t *testing.T) {
|
|||
oldMinikubeHome := os.Getenv("MINIKUBE_HOME")
|
||||
defer os.Setenv("MINIKUBE_HOME", oldMinikubeHome)
|
||||
|
||||
minikubeHome, err := ioutil.TempDir("/tmp", "")
|
||||
minikubeHome, err := os.MkdirTemp("/tmp", "")
|
||||
if err != nil {
|
||||
t.Fatalf("error during creating tmp dir: %v", err)
|
||||
}
|
||||
|
|
@ -148,7 +147,7 @@ func TestExcludedBinariesNotDownloaded(t *testing.T) {
|
|||
oldMinikubeHome := os.Getenv("MINIKUBE_HOME")
|
||||
defer os.Setenv("MINIKUBE_HOME", oldMinikubeHome)
|
||||
|
||||
minikubeHome, err := ioutil.TempDir("/tmp", "")
|
||||
minikubeHome, err := os.MkdirTemp("/tmp", "")
|
||||
if err != nil {
|
||||
t.Fatalf("error during creating tmp dir: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package machine
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -105,7 +105,7 @@ func RemoteHostInfo(r command.Runner) (*HostInfo, error, error, error) {
|
|||
|
||||
// showLocalOsRelease shows systemd information about the current linux distribution, on the local host
|
||||
func showLocalOsRelease() {
|
||||
osReleaseOut, err := ioutil.ReadFile("/etc/os-release")
|
||||
osReleaseOut, err := os.ReadFile("/etc/os-release")
|
||||
if err != nil {
|
||||
klog.Errorf("ReadFile: %v", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package machine
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"testing"
|
||||
|
|
@ -67,7 +66,7 @@ func TestAddHostAliasInner(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
buff, err := ioutil.ReadFile(tempFilePath)
|
||||
buff, err := os.ReadFile(tempFilePath)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
@ -81,7 +80,7 @@ func TestAddHostAliasInner(t *testing.T) {
|
|||
}
|
||||
|
||||
func writeContentToTempFile(content string) (string, error) {
|
||||
etcHosts, err := ioutil.TempFile("", "hosts")
|
||||
etcHosts, err := os.CreateTemp("", "hosts")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ func configureMounts(wg *sync.WaitGroup) {
|
|||
if klog.V(8).Enabled() {
|
||||
mountDebugVal = 1
|
||||
}
|
||||
mountCmd := exec.Command(path, "mount", fmt.Sprintf("--v=%d", mountDebugVal), viper.GetString(mountString))
|
||||
profile := viper.GetString("profile")
|
||||
mountCmd := exec.Command(path, "mount", "-p", profile, fmt.Sprintf("--v=%d", mountDebugVal), viper.GetString(mountString))
|
||||
mountCmd.Env = append(os.Environ(), constants.IsMinikubeChildProcess+"=true")
|
||||
if klog.V(8).Enabled() {
|
||||
mountCmd.Stdout = os.Stdout
|
||||
|
|
@ -74,7 +75,7 @@ func configureMounts(wg *sync.WaitGroup) {
|
|||
if err := mountCmd.Start(); err != nil {
|
||||
exit.Error(reason.GuestMount, "Error starting mount", err)
|
||||
}
|
||||
if err := lock.WriteFile(filepath.Join(localpath.MiniPath(), constants.MountProcessFileName), []byte(strconv.Itoa(mountCmd.Process.Pid)), 0o644); err != nil {
|
||||
if err := lock.WriteFile(filepath.Join(localpath.Profile(profile), constants.MountProcessFileName), []byte(strconv.Itoa(mountCmd.Process.Pid)), 0o644); err != nil {
|
||||
exit.Error(reason.HostMountPid, "Error writing mount pid", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ package notify
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -185,7 +185,7 @@ func writeTimeToFile(path string, inputTime time.Time) error {
|
|||
}
|
||||
|
||||
func timeFromFileIfExists(path string) time.Time {
|
||||
lastUpdateCheckTime, err := ioutil.ReadFile(path)
|
||||
lastUpdateCheckTime, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return time.Time{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package notify
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
|
@ -223,7 +222,7 @@ func TestMaybePrintUpdateText(t *testing.T) {
|
|||
viper.Set(config.WantBetaUpdateNotification, tt.wantBetaUpdateNotification)
|
||||
lastUpdateCheckFilePath = filepath.Join(tempDir, "last_update_check")
|
||||
|
||||
tmpfile, err := ioutil.TempFile("", "")
|
||||
tmpfile, err := os.CreateTemp("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot create temp file: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import (
|
|||
"html"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
|
@ -382,7 +381,7 @@ func displayError(msg string, err error) {
|
|||
|
||||
func latestLogFilePath() (string, error) {
|
||||
tmpdir := os.TempDir()
|
||||
files, err := ioutil.ReadDir(tmpdir)
|
||||
files, err := os.ReadDir(tmpdir)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get list of files in tempdir: %v", err)
|
||||
}
|
||||
|
|
@ -392,11 +391,15 @@ func latestLogFilePath() (string, error) {
|
|||
if !strings.Contains(file.Name(), "minikube_") {
|
||||
continue
|
||||
}
|
||||
if !lastModTime.IsZero() && lastModTime.After(file.ModTime()) {
|
||||
fileInfo, err := file.Info()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get file info: %v", err)
|
||||
}
|
||||
if !lastModTime.IsZero() && lastModTime.After(fileInfo.ModTime()) {
|
||||
continue
|
||||
}
|
||||
lastModName = file.Name()
|
||||
lastModTime = file.ModTime()
|
||||
lastModTime = fileInfo.ModTime()
|
||||
}
|
||||
fullPath := filepath.Join(tmpdir, lastModName)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ package ssh
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -63,7 +66,17 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
|||
|
||||
d.IPAddress = cc.SSHIPAddress
|
||||
d.SSHUser = cc.SSHUser
|
||||
d.SSHKey = cc.SSHKey
|
||||
|
||||
if strings.HasPrefix(cc.SSHKey, "~") {
|
||||
dirname, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("Error determining path to ssh key: %v", err)
|
||||
}
|
||||
d.SSHKey = filepath.Join(dirname, cc.SSHKey[1:])
|
||||
} else {
|
||||
d.SSHKey = cc.SSHKey
|
||||
}
|
||||
|
||||
d.SSHPort = cc.SSHPort
|
||||
|
||||
return d, nil
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package schedule
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
|
@ -51,7 +50,7 @@ func KillExisting(profiles []string) {
|
|||
|
||||
func killPIDForProfile(profile string) error {
|
||||
file := localpath.PID(profile)
|
||||
f, err := ioutil.ReadFile(file)
|
||||
f, err := os.ReadFile(file)
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -91,7 +90,7 @@ func daemonize(profiles []string, duration time.Duration) error {
|
|||
func savePIDs(pid int, profiles []string) error {
|
||||
for _, p := range profiles {
|
||||
file := localpath.PID(p)
|
||||
if err := ioutil.WriteFile(file, []byte(fmt.Sprintf("%v", pid)), 0600); err != nil {
|
||||
if err := os.WriteFile(file, []byte(fmt.Sprintf("%v", pid)), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
@ -612,7 +611,7 @@ users:
|
|||
t.Run(test.description, func(t *testing.T) {
|
||||
mockK8sConfigByte := []byte(test.config)
|
||||
mockK8sConfigPath := test.kubeconfigPath
|
||||
err := ioutil.WriteFile(mockK8sConfigPath, mockK8sConfigByte, 0644)
|
||||
err := os.WriteFile(mockK8sConfigPath, mockK8sConfigByte, 0644)
|
||||
defer os.Remove(mockK8sConfigPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error when writing to file %v. Error: %v", test.kubeconfigPath, err)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package storageclass
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
@ -229,7 +228,7 @@ func TestGetStoragev1(t *testing.T) {
|
|||
err: true,
|
||||
},
|
||||
}
|
||||
configFile, err := ioutil.TempFile("/tmp", "")
|
||||
configFile, err := os.CreateTemp("/tmp", "")
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
}
|
||||
|
|
@ -255,7 +254,7 @@ func TestGetStoragev1(t *testing.T) {
|
|||
func setK8SConfig(config, kubeconfigPath string) error {
|
||||
mockK8sConfigByte := []byte(config)
|
||||
mockK8sConfigPath := kubeconfigPath
|
||||
err := ioutil.WriteFile(mockK8sConfigPath, mockK8sConfigByte, 0644)
|
||||
err := os.WriteFile(mockK8sConfigPath, mockK8sConfigByte, 0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unexpected error when writing to file %v. Error: %v", kubeconfigPath, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package tests
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -28,7 +27,7 @@ import (
|
|||
|
||||
// MakeTempDir creates the temp dir and returns the path
|
||||
func MakeTempDir() string {
|
||||
tempDir, err := ioutil.TempDir("", "minipath")
|
||||
tempDir, err := os.MkdirTemp("", "minipath")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package tunnel
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
|
@ -186,7 +186,7 @@ func (r *persistentRegistry) List() ([]*ID, error) {
|
|||
}
|
||||
return []*ID{}, nil
|
||||
}
|
||||
byteValue, _ := ioutil.ReadAll(f)
|
||||
byteValue, _ := io.ReadAll(f)
|
||||
var tunnels []*ID
|
||||
if len(byteValue) == 0 {
|
||||
return tunnels, nil
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package tunnel
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
|
@ -246,7 +245,7 @@ func TestTunnelTakeoverFromNonRunningProcess(t *testing.T) {
|
|||
|
||||
func tmpFile(t *testing.T) string {
|
||||
t.Helper()
|
||||
f, err := ioutil.TempFile(os.TempDir(), "reg_")
|
||||
f, err := os.CreateTemp(os.TempDir(), "reg_")
|
||||
f.Close()
|
||||
if err != nil {
|
||||
t.Errorf("failed to create temp file %s", err)
|
||||
|
|
@ -255,7 +254,7 @@ func tmpFile(t *testing.T) string {
|
|||
}
|
||||
|
||||
func createTestRegistry(t *testing.T) (reg *persistentRegistry, cleanup func()) {
|
||||
f, err := ioutil.TempFile(os.TempDir(), "reg_")
|
||||
f, err := os.CreateTemp(os.TempDir(), "reg_")
|
||||
f.Close()
|
||||
if err != nil {
|
||||
t.Errorf("failed to create temp file %s", err)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package tunnel
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -187,7 +186,7 @@ func writeResolverFile(route *Route) error {
|
|||
klog.Infof("preparing DNS forwarding config in %q:\n%s", resolverFile, content)
|
||||
|
||||
// write resolver content into tf, then copy it to /etc/resolver/clusterDomain
|
||||
tf, err := ioutil.TempFile("", "minikube-tunnel-resolver-")
|
||||
tf, err := os.CreateTemp("", "minikube-tunnel-resolver-")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "tempfile")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/tests"
|
||||
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
@ -485,7 +484,7 @@ func TestErrorCreatingTunnel(t *testing.T) {
|
|||
e: errors.New("error loading machine"),
|
||||
}
|
||||
|
||||
f, err := ioutil.TempFile(os.TempDir(), "reg_")
|
||||
f, err := os.CreateTemp(os.TempDir(), "reg_")
|
||||
f.Close()
|
||||
if err != nil {
|
||||
t.Errorf("failed to create temp file %s", err)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue