diff --git a/.github/workflows/common-build-docs.yaml b/.github/workflows/common-build-docs.yaml new file mode 100644 index 000000000..5dfd0f9ca --- /dev/null +++ b/.github/workflows/common-build-docs.yaml @@ -0,0 +1,36 @@ +name: Build documentation +on: + workflow_call: + inputs: + publish: + default: false + required: false + type: boolean + +jobs: + update-gh-pages: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v1 + + - name: Fetch gh-pages + run: git fetch --no-tags --prune --depth=1 origin refs/heads/gh-pages:refs/heads/gh-pages + + - name: Install build dependencies + run: | + pip3 install --user -r docs/requirements.txt + echo "`python3 -m site --user-base`/bin" >> $GITHUB_PATH + + - name: Add docs from this revision to gh-pages + run: | + git config user.name "Github" + git config user.email "no-reply@github.com" + ./scripts/build/update-gh-pages.sh + + - name: Publish gh-pages + if: ${{ inputs.publish }} + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages diff --git a/.github/workflows/common-build-images.yaml b/.github/workflows/common-build-images.yaml new file mode 100644 index 000000000..c36247bba --- /dev/null +++ b/.github/workflows/common-build-images.yaml @@ -0,0 +1,44 @@ +name: Build container images + +on: + workflow_call: + inputs: + image-tag: + default: ${{ github.ref_name }} + required: false + type: string + publish: + default: false + required: false + type: boolean + github-environment: + default: null + required: false + type: string + +jobs: + build-images: + name: Build and publish container images + runs-on: ubuntu-22.04 + environment: ${{ inputs.github-environment }} + env: + IMAGE_REPO: intel + IMAGE_VERSION: ${{ inputs.image-tag }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build images + run: "make images IMAGE_VERSION=${IMAGE_VERSION} Q=" + + - name: Login to Docker Hub + if: ${{ inputs.publish }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Push images + if: ${{ inputs.publish }} + run: "make images-push IMAGE_VERSION=${IMAGE_VERSION} Q=" + diff --git a/.github/workflows/common-codeql.yaml b/.github/workflows/common-codeql.yaml new file mode 100644 index 000000000..0697def35 --- /dev/null +++ b/.github/workflows/common-codeql.yaml @@ -0,0 +1,19 @@ +name: CodeQL scanning +on: + workflow_call: + +jobs: + codeql-scan: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: go + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/common-trivy.yaml b/.github/workflows/common-trivy.yaml new file mode 100644 index 000000000..e6981ce25 --- /dev/null +++ b/.github/workflows/common-trivy.yaml @@ -0,0 +1,90 @@ +name: Trivy scanning +on: + workflow_call: + inputs: + upload-to-github-security-tab: + default: false + required: false + type: boolean + export-csv: + default: false + required: false + type: boolean + +jobs: + trivy-scan-licenses: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Run Trivy in fs mode + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + scan-ref: . + exit-code: 1 + scanners: license + severity: "UNKNOWN,MEDIUM,HIGH,CRITICAL" + + trivy-scan-vulns: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Run Trivy in fs mode + continue-on-error: true + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + scan-ref: . + exit-code: 1 + list-all-pkgs: true + format: json + output: trivy-report.json + + - name: Show report in human-readable format + uses: aquasecurity/trivy-action@master + with: + scan-type: convert + vuln-type: '' + severity: '' + image-ref: trivy-report.json + format: table + + - name: Convert report to sarif + if: ${{ inputs.upload-to-github-security-tab }} + uses: aquasecurity/trivy-action@master + with: + scan-type: convert + vuln-type: '' + severity: '' + image-ref: trivy-report.json + format: sarif + output: trivy-report.sarif + + - name: Upload sarif report to GitHub Security tab + if: ${{ inputs.upload-to-github-security-tab }} + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: trivy-report.sarif + + - name: Convert report to csv + if: ${{ inputs.export-csv }} + uses: aquasecurity/trivy-action@master + with: + scan-type: convert + vuln-type: '' + severity: '' + image-ref: trivy-report.json + format: template + template: "@.github/workflows/trivy-csv.tpl" + output: trivy-report.csv + + - name: Upload CSV report as an artifact + if: ${{ inputs.export-csv }} + uses: actions/upload-artifact@v3 + with: + name: trivy-report + path: trivy-report.csv diff --git a/.github/workflows/common-verify-code.yaml b/.github/workflows/common-verify-code.yaml new file mode 100644 index 000000000..21fa87942 --- /dev/null +++ b/.github/workflows/common-verify-code.yaml @@ -0,0 +1,45 @@ +name: Verify code + +on: + - workflow_call + +jobs: + build-and-test: + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v1 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + id: go + + - name: Install golangci-lint + run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 + + - name: Gofmt + run: make format + + - name: Build + run: make + + - name: Test + run: make test + + - name: Golangci-lint + run: | + export PATH=$PATH:$(go env GOPATH)/bin + make golangci-lint + + - name: Codecov report + run: bash <(curl -s https://codecov.io/bash) + + trivy-scan: + uses: "./.github/workflows/common-trivy.yaml" + with: + upload-to-github-security-tab: true + + codeql-scan: + uses: "./.github/workflows/common-codeql.yaml" diff --git a/.github/workflows/publish-devel-images.yaml b/.github/workflows/publish-devel-images.yaml new file mode 100644 index 000000000..eea3fadff --- /dev/null +++ b/.github/workflows/publish-devel-images.yaml @@ -0,0 +1,23 @@ +name: Build and publish devel container images + +on: + push: + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + trivy-scan: + uses: "./.github/workflows/common-trivy.yaml" + + publish-images: + uses: "./.github/workflows/common-build-images.yaml" + needs: [trivy-scan] + secrets: inherit + with: + publish: true + image-tag: "devel" + github-environment: "staging" + diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index a8e9c2b6c..fc9686f00 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -1,44 +1,22 @@ -name: Publish +name: Publish documentation on: push: branches: - master - release-* + # Path filters are ignored for tags + paths: + - "docs/**" + - "Makefile" tags: - v* +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false jobs: update-gh-pages: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - - name: Turnstyle - uses: softprops/turnstyle@v1 - with: - abort-after-seconds: 600 - same-branch-only: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Fetch gh-pages - run: git fetch --no-tags --prune --depth=1 origin refs/heads/gh-pages:refs/heads/gh-pages - - - name: Install build dependencies - run: | - pip3 install --user -r docs/requirements.txt - echo "`python3 -m site --user-base`/bin" >> $GITHUB_PATH - - - name: Add docs from this revision to gh-pages - run: | - git config user.name "Github" - git config user.email "no-reply@github.com" - ./scripts/build/update-gh-pages.sh - - - name: Publish/push to gh-pages - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages + uses: "./.github/workflows/common-build-docs.yaml" + with: + publish: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..006dd3bfe --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,47 @@ +name: Build and publish release artifacts + +on: + push: + tags: [ 'v*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + trivy-scan: + uses: "./.github/workflows/common-trivy.yaml" + with: + export-csv: true + + publish-images: + uses: "./.github/workflows/common-build-images.yaml" + needs: [trivy-scan] + secrets: inherit + with: + publish: true + image-tag: ${{ github.ref_name }} + github-environment: "release" + + build-packages: + needs: [trivy-scan] + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build packages + run: "make cross-packages Q=" + + - name: Build vendored dist tarball + run: "make vendored-dist Q=" + + - name: Upload release assets + uses: softprops/action-gh-release@v1 + with: + name: ${{ github.ref_name }} + draft: true + append_body: true + files: | + packages/release-assets/* + vendored-cri-resource-manager-*.tar.gz diff --git a/.github/workflows/trivy-csv.tpl b/.github/workflows/trivy-csv.tpl new file mode 100644 index 000000000..0c1e50744 --- /dev/null +++ b/.github/workflows/trivy-csv.tpl @@ -0,0 +1,29 @@ +{{ range . }} +Trivy Vulnerability Scan Results ({{- .Target -}}) +VulnerabilityID,Severity,CVSS Score,Title,Library,Vulnerable Version,Fixed Version,Information URL,Triage Information +{{ range .Vulnerabilities }} + {{- .VulnerabilityID }}, + {{- .Severity }}, + {{- range $key, $value := .CVSS }} + {{- if (eq $key "nvd") }} + {{- .V3Score -}} + {{- end }} + {{- end }}, + {{- quote .Title }}, + {{- quote .PkgName }}, + {{- quote .InstalledVersion }}, + {{- quote .FixedVersion }}, + {{- .PrimaryURL }} +{{ else -}} + No vulnerabilities found at this time. +{{ end }} +Trivy Dependency Scan Results ({{ .Target }}) +ID,Name,Version,Notes +{{ range .Packages -}} + {{- quote .ID }}, + {{- quote .Name }}, + {{- quote .Version }} +{{ else -}} + No dependencies found at this time. +{{ end }} +{{ end }} diff --git a/.github/workflows/verify-periodic.yaml b/.github/workflows/verify-periodic.yaml new file mode 100644 index 000000000..abb1236cb --- /dev/null +++ b/.github/workflows/verify-periodic.yaml @@ -0,0 +1,14 @@ +name: Verify branches periodic + +on: + schedule: + - cron: '30 2 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify-code: + uses: "./.github/workflows/common-verify-code.yaml" + diff --git a/.github/workflows/verify-pr-code.yaml b/.github/workflows/verify-pr-code.yaml new file mode 100644 index 000000000..e126abf2e --- /dev/null +++ b/.github/workflows/verify-pr-code.yaml @@ -0,0 +1,15 @@ +name: Verify code + +on: + pull_request: + paths-ignore: + - "docs/**" + - "**.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + verify: + uses: "./.github/workflows/common-verify-code.yaml" diff --git a/.github/workflows/verify-pr-docs.yaml b/.github/workflows/verify-pr-docs.yaml new file mode 100644 index 000000000..b57cf112f --- /dev/null +++ b/.github/workflows/verify-pr-docs.yaml @@ -0,0 +1,15 @@ +name: Verify documentation + +on: + pull_request: + paths: + - "docs/**" + - "Makefile" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + verify-docs: + uses: "./.github/workflows/common-build-docs.yaml" diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml deleted file mode 100644 index cc0f890da..000000000 --- a/.github/workflows/verify.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Verify -on: [push, pull_request] -jobs: - - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - - name: Install golangci-lint - run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 - - - name: Gofmt - run: make format - - - name: Build - run: make - - - name: Test - run: make test - - - name: Golangci-lint - run: | - export PATH=$PATH:$(go env GOPATH)/bin - make golangci-lint - - - name: Codecov report - run: bash <(curl -s https://codecov.io/bash) - - - name: Build docs - run: | - make site-build - make clean-html - - - name: Install gh-pages build dependencies - run: | - pip3 install --user -r docs/requirements.txt - echo "`python3 -m site --user-base`/bin" >> $GITHUB_PATH - - - name: Verify update of gh-pages - run: | - git config user.name "Github" - git config user.email "no-reply@github.com" - ./scripts/build/update-gh-pages.sh diff --git a/Makefile b/Makefile index 7ff97ceb7..744c121fb 100644 --- a/Makefile +++ b/Makefile @@ -245,7 +245,7 @@ ifneq ($(V),1) endif # Default target: just build everything. -all: build update-workflows +all: build # # Generic targets: build, install, clean, build images. @@ -383,7 +383,7 @@ image-%: --build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION) \ -t $(IMAGE_REPO)$$bin:$(IMAGE_VERSION) -image-push-%: image-% +image-push-%: $(Q)bin=$(patsubst image-push-%,%,$@); \ if [ -z "$(IMAGE_REPO)" ]; then echo "ERROR: no IMAGE_REPO specified"; exit 1; fi; \ $(DOCKER) push $(IMAGE_REPO)$$bin:$(IMAGE_VERSION) @@ -591,13 +591,14 @@ cross-rpm.%: docker/cross-build/% clean-spec spec dist rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \ cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \ cp packaging/rpm/cri-resource-manager.spec $$builddir/input && \ - $(DOCKER) run --rm -ti $(DOCKER_OPTIONS) --user $$USER \ + $(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \ --env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \ -v $$(pwd)/$$builddir:/build \ -v $$(pwd)/$$outdir:/output \ -v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \ $$distro-build /bin/bash -c '$(DOCKER_RPM_BUILD)' && \ - rm -fr $$builddir + rm -fr $$builddir && \ + install -D -m644 $$outdir/cri-resource-manager-$(RPM_VERSION)-0.x86_64.rpm $(PACKAGES_DIR)/release-assets/cri-resource-manager-$(RPM_VERSION)-0.$$distro.x86_64.rpm src.rpm source-rpm: spec dist mkdir -p ~/rpmbuild/{SOURCES,SPECS} && \ @@ -634,13 +635,14 @@ cross-deb.%: docker/cross-build/% \ rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \ cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \ cp -r debian $$builddir/input && \ - $(DOCKER) run --rm -ti $(DOCKER_OPTIONS) --user $$USER \ + $(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \ --env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \ -v $$(pwd)/$$builddir:/build \ -v $$(pwd)/$$outdir:/output \ -v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \ $$distro-build /bin/bash -c '$(DOCKER_DEB_BUILD)' && \ - rm -fr $$builddir + rm -fr $$builddir && \ + install -D -m644 $$outdir/cri-resource-manager_$(DEB_VERSION)_amd64.deb $(PACKAGES_DIR)/release-assets/cri-resource-manager_$(DEB_VERSION)_$${distro}_amd64.deb deb: debian/changelog debian/control debian/rules debian/compat dist dpkg-buildpackage -uc @@ -653,7 +655,7 @@ cross-bin.%: docker/cross-build/% dist mkdir -p $(BINARIES_DIR)/$$distro && \ rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \ cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \ - $(DOCKER) run --rm -ti $(DOCKER_OPTIONS) --user $$USER \ + $(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \ --env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \ -v $$(pwd)/$$builddir:/build \ -v $$(pwd)/$$outdir:/output \ @@ -669,13 +671,14 @@ cross-tar cross-tarball: dist docker/cross-build/fedora mkdir -p $$outdir && \ rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \ cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \ - $(DOCKER) run --rm -ti $(DOCKER_OPTIONS) --user $$USER \ + $(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \ --env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \ -v $$(pwd)/$$builddir:/build \ -v $$(pwd)/$$outdir:/output \ -v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \ centos-7-build /bin/bash -c '$(DOCKER_TAR_BUILD)' && \ - rm -fr $$builddir + rm -fr $$builddir && \ + install -D -m644 -t $(PACKAGES_DIR)/release-assets $$outdir/cri-resource-manager-$(TAR_VERSION).x86_64.tar.gz # Build a docker image (for distro cross-building). docker/cross-build/%: dockerfiles/cross-build/Dockerfile.% @@ -683,7 +686,7 @@ docker/cross-build/%: dockerfiles/cross-build/Dockerfile.% echo "Building cross-build docker image for $$distro..." && \ img=$${distro}-build && $(DOCKER) rm $$distro-build || : && \ scripts/build/docker-build-image $$distro-build \ - --container $(DOCKER_PULL) \ + $(DOCKER_PULL) \ --build-arg GO_VERSION=$(GO_VERSION) \ --build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION) \ $(DOCKER_OPTIONS) @@ -719,12 +722,6 @@ install-protoc-gen-go-grpc: install-protoc-tools: install-protoc install-protoc-gen-go install-protoc-gen-go-grpc -# Rules for updating github workflows. -update-workflows: .github/workflows/verify.yml - -.github/workflows/verify.yml: go.mod - $(Q)sed -E -i "s/go-version:.*$$/go-version: $(GO_VERSION)/g" $@ - # # go dependencies for our binaries (careful with that axe, Eugene...) # @@ -816,7 +813,6 @@ pkg/cri/resource-manager/visualizer/bubbles/assets_gendata.go:: \ .PHONY: all build install clean test images images-push release-tests e2e-tests \ format vet cyclomatic-check lint golangci-lint \ cross-packages cross-rpm cross-deb \ - update-workflows # # Rules for documentation diff --git a/cmd/cri-resmgr-webhook/handlers.go b/cmd/cri-resmgr-webhook/handlers.go index 6d69c4435..d92ae94f2 100644 --- a/cmd/cri-resmgr-webhook/handlers.go +++ b/cmd/cri-resmgr-webhook/handlers.go @@ -20,7 +20,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "log" "net/http" @@ -75,7 +75,7 @@ func stringify(r interface{}) string { func handle(w http.ResponseWriter, r *http.Request) { var body []byte if r.Body != nil { - if data, err := ioutil.ReadAll(r.Body); err == nil { + if data, err := io.ReadAll(r.Body); err == nil { body = data } } diff --git a/demo/lib/distro.bash b/demo/lib/distro.bash index cd01d7abb..9ac6b4c75 100644 --- a/demo/lib/distro.bash +++ b/demo/lib/distro.bash @@ -891,7 +891,7 @@ Wants=network-online.target After=network-online.target [Service] -ExecStart=/snap/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime=remote --container-runtime-endpoint=${k8scri_sock} --pod-infra-container-image=k8s.gcr.io/pause:3.4.1 +ExecStart=/snap/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime-endpoint=${k8scri_sock} --pod-infra-container-image=k8s.gcr.io/pause:3.4.1 Restart=always StartLimitInterval=0 RestartSec=10 diff --git a/dockerfiles/cross-build/Dockerfile.centos-7 b/dockerfiles/cross-build/Dockerfile.centos-7 index beb32fd0a..1342d27c2 100644 --- a/dockerfiles/cross-build/Dockerfile.centos-7 +++ b/dockerfiles/cross-build/Dockerfile.centos-7 @@ -3,7 +3,6 @@ FROM centos:7 as centos-7-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG GIT_VERSION=2.27.0 ARG GIT_URLDIR=https://github.com/git/git/archive ARG CREATE_USER="build" @@ -11,27 +10,10 @@ ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN yum install -y --nogpgcheck rpm-build \ - kernel-devel clang gcc \ + kernel-devel gcc \ curl-devel zlib-devel openssl-devel expat-devel \ make wget -# fetch and build go from sources -RUN arch="$(rpm --eval %{_arch})"; \ - case "${arch}" in \ - x86_64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version - # fetch and build a recent git from sources, anything below 1.9.5 is known to not work for us RUN mkdir /git && cd /git && wget $GIT_URLDIR/v$GIT_VERSION.tar.gz && \ tar -xvzf v$GIT_VERSION.tar.gz && cd git-$GIT_VERSION && \ @@ -39,6 +21,11 @@ RUN mkdir /git && cd /git && wget $GIT_URLDIR/v$GIT_VERSION.tar.gz && \ yum remove -y git && \ make -j8 NO_TCLTK=1 NO_GETTEXT=1 prefix=/usr install +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz + RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} RUN [ -n "$CREATE_USER" -a "$CREATE_USER" != "root" ] && \ diff --git a/dockerfiles/cross-build/Dockerfile.centos-8 b/dockerfiles/cross-build/Dockerfile.centos-8 index 0f7d5ac35..b3fdd1e96 100644 --- a/dockerfiles/cross-build/Dockerfile.centos-8 +++ b/dockerfiles/cross-build/Dockerfile.centos-8 @@ -3,7 +3,6 @@ FROM centos:8 as centos-8-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="build" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -12,24 +11,13 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \ sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* RUN dnf install -y rpm-build \ - kernel-devel clang gcc \ - git-core make wget + kernel-devel gcc \ + git-core make -RUN arch="$(rpm --eval %{_arch})"; \ - case "${arch}" in \ - x86_64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.debian-10 b/dockerfiles/cross-build/Dockerfile.debian-10 index 56889d986..16ff5cd59 100644 --- a/dockerfiles/cross-build/Dockerfile.debian-10 +++ b/dockerfiles/cross-build/Dockerfile.debian-10 @@ -3,7 +3,6 @@ FROM debian:buster as debian-10-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="test" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -12,24 +11,13 @@ ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential fakeroot devscripts \ - bash git make sed debhelper wget ca-certificates && \ + bash git make sed debhelper ca-certificates && \ rm -rf /var/lib/apt/lists/* -RUN arch="$(dpkg --print-architecture)"; \ - case "${arch##*-}" in \ - amd64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.debian-sid b/dockerfiles/cross-build/Dockerfile.debian-sid index a3fe371ad..fa6f9acec 100644 --- a/dockerfiles/cross-build/Dockerfile.debian-sid +++ b/dockerfiles/cross-build/Dockerfile.debian-sid @@ -3,7 +3,6 @@ FROM debian:sid as debian-sid-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="test" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -12,24 +11,13 @@ ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential fakeroot devscripts \ - bash git make sed debhelper wget ca-certificates && \ + bash git make sed debhelper ca-certificates && \ rm -rf /var/lib/apt/lists/* -RUN arch="$(dpkg --print-architecture)"; \ - case "${arch##*-}" in \ - amd64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.fedora b/dockerfiles/cross-build/Dockerfile.fedora index 5fcfb7a68..11c5d59dc 100644 --- a/dockerfiles/cross-build/Dockerfile.fedora +++ b/dockerfiles/cross-build/Dockerfile.fedora @@ -3,30 +3,18 @@ FROM fedora:latest as fedora-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="build" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN dnf install -y rpm-build systemd-rpm-macros \ - kernel-devel gcc clang \ - git-core make wget + kernel-devel gcc \ + git-core make -RUN arch="$(rpm --eval %{_arch})"; \ - case "${arch}" in \ - x86_64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 b/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 index 3278c3477..f899da889 100644 --- a/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 +++ b/dockerfiles/cross-build/Dockerfile.opensuse-leap-15.4 @@ -3,31 +3,18 @@ FROM opensuse/leap:15.4 as suse-15.4-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="build" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN zypper install -y rpm-build \ - kernel-devel clang gcc \ - git make \ - wget + kernel-devel gcc \ + git make -RUN arch="$(rpm --eval %{_arch})"; \ - case "${arch}" in \ - x86_64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 index 49c92b6d1..af9412f55 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-18.04 @@ -3,7 +3,6 @@ FROM ubuntu:18.04 as ubuntu-18.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="test" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -12,24 +11,13 @@ ENV PATH /go/bin:/usr/local/go/bin:$PATH RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential fakeroot devscripts \ - bash git make sed debhelper wget ca-certificates && \ + bash git make sed debhelper ca-certificates && \ rm -rf /var/lib/apt/lists/* -RUN arch="$(dpkg --print-architecture)"; \ - case "${arch##*-}" in \ - amd64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 index 094d2142a..8c844df6f 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-20.04 @@ -3,7 +3,6 @@ FROM ubuntu:20.04 as ubuntu-20.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="test" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -13,24 +12,13 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ tzdata build-essential fakeroot devscripts \ - bash git make sed debhelper wget ca-certificates && \ + bash git make sed debhelper ca-certificates && \ rm -rf /var/lib/apt/lists/* -RUN arch="$(dpkg --print-architecture)"; \ - case "${arch##*-}" in \ - amd64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 b/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 index dc62461e3..cb6166bd9 100644 --- a/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 +++ b/dockerfiles/cross-build/Dockerfile.ubuntu-22.04 @@ -3,7 +3,6 @@ FROM ubuntu:22.04 as ubuntu-22.04-build ARG GO_VERSION=x.yz ARG GOLICENSES_VERSION -ARG GOLANG_URLDIR=https://dl.google.com/go ARG CREATE_USER="test" ARG USER_OPTIONS="" ENV PATH /go/bin:/usr/local/go/bin:$PATH @@ -13,24 +12,13 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ tzdata build-essential fakeroot devscripts \ - bash git make sed debhelper wget ca-certificates && \ + bash git make sed debhelper ca-certificates && \ rm -rf /var/lib/apt/lists/* -RUN arch="$(dpkg --print-architecture)"; \ - case "${arch##*-}" in \ - amd64) goarch=linux-amd64;; \ - i386) goarch=linux-386;; \ - armhf) goarch=linux-armv6l;; \ - ppc64el) goarch=linux-ppc64le;; \ - s390x) goarch=linux-s390x;; \ - esac; \ - \ - wget $GOLANG_URLDIR/go$GO_VERSION.$goarch.tar.gz -O go.tgz && \ - tar -C /usr/local -xvzf go.tgz && rm go.tgz && \ - \ - export PATH="/usr/local/go/bin:$PATH" && \ - echo "PATH=/usr/local/go/bin:$PATH" > /etc/profile.d/go.sh && \ - go version +ADD http://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz / + +RUN tar xf /go${GO_VERSION}.linux-amd64.tar.gz -C "/usr/local" && \ + rm /go${GO_VERSION}.linux-amd64.tar.gz RUN GOBIN=/go/bin go install github.com/google/go-licenses@${GOLICENSES_VERSION} diff --git a/docs/Dockerfile b/docs/Dockerfile index 2a1367f6d..2a1894f6a 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -3,8 +3,11 @@ FROM sphinxdoc/sphinx:5.3.0 RUN apt-get update && apt-get install -y wget git # Note: Any golang version that can 'go list -m -f {{.Variable}}' is fine... -RUN wget https://go.dev/dl/go1.18.3.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz +ADD https://go.dev/dl/go1.18.3.linux-amd64.tar.gz / + +RUN tar -C /usr/local -xzf /go1.18.3.linux-amd64.tar.gz && \ + rm /go1.18.3.linux-amd64.tar.gz + ENV PATH=$PATH:/usr/local/go/bin COPY requirements.txt . diff --git a/docs/requirements.txt b/docs/requirements.txt index 329afe4b4..946c94e2a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,4 +2,4 @@ sphinx==5.3.0 sphinx_rtd_theme myst-parser==0.18.1 sphinx-markdown-tables -Pygments==2.13.0 +Pygments==2.15.1 diff --git a/go.mod b/go.mod index 18e061693..2f4ec124b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/intel/cri-resource-manager -go 1.19 +go 1.20 require ( contrib.go.opencensus.io/exporter/jaeger v0.2.1 @@ -8,102 +8,63 @@ require ( github.com/cilium/ebpf v0.7.0 github.com/evanphx/json-patch v4.12.0+incompatible github.com/google/go-cmp v0.5.9 - github.com/hashicorp/go-multierror v1.1.1 github.com/intel/cri-resource-manager/pkg/topology v0.0.0 - github.com/intel/goresctrl v0.3.0 + github.com/intel/goresctrl v0.5.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.3.0 - github.com/prometheus/common v0.37.0 + github.com/prometheus/common v0.42.0 github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd github.com/stretchr/testify v1.8.1 go.opencensus.io v0.24.0 - golang.org/x/sys v0.10.0 + golang.org/x/sys v0.11.0 golang.org/x/time v0.3.0 google.golang.org/grpc v1.50.1 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.30.0 k8s.io/api v0.25.12 - k8s.io/apimachinery v0.25.12 + k8s.io/apimachinery v0.27.4 k8s.io/client-go v0.25.12 k8s.io/cri-api v0.25.12 - k8s.io/klog/v2 v2.70.1 - k8s.io/kubernetes v1.25.12 + k8s.io/klog/v2 v2.80.1 + k8s.io/utils v0.0.0-20230505201702-9f6742963106 sigs.k8s.io/yaml v1.3.0 ) require ( - cloud.google.com/go/compute v1.12.1 // indirect - cloud.google.com/go/compute/metadata v0.2.1 // indirect - github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect - github.com/Microsoft/go-winio v0.5.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/aws/aws-sdk-go v1.38.49 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect - github.com/containerd/console v1.0.3 // indirect - github.com/containerd/ttrpc v1.1.0 // indirect - github.com/coreos/go-systemd/v22 v22.3.2 // indirect - github.com/cyphar/filepath-securejoin v0.2.3 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect - github.com/docker/go-units v0.4.0 // indirect github.com/emicklei/go-restful/v3 v3.8.0 // indirect - github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.5 // indirect github.com/go-openapi/swag v0.19.14 // indirect - github.com/godbus/dbus/v5 v5.0.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/cadvisor v0.45.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/imdario/mergo v0.3.12 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/karrick/godirwalk v1.16.1 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989 // indirect - github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect - github.com/moby/spdystream v0.2.0 // indirect - github.com/moby/sys/mountinfo v0.6.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mrunalp/fileutils v0.5.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect - github.com/opencontainers/runc v1.1.6 // indirect - github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect - github.com/opencontainers/selinux v1.10.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/prometheus/statsd_exporter v0.22.8 // indirect - github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect - github.com/spf13/cobra v1.4.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect - github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 // indirect - github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect - golang.org/x/sync v0.1.0 // indirect + golang.org/x/oauth2 v0.5.0 // indirect + golang.org/x/sync v0.2.0 // indirect golang.org/x/term v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/api v0.103.0 // indirect @@ -112,16 +73,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiserver v0.25.12 // indirect - k8s.io/cloud-provider v0.24.1 // indirect - k8s.io/component-base v0.25.12 // indirect - k8s.io/component-helpers v0.25.12 // indirect - k8s.io/csi-translation-lib v0.24.1 // indirect k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect - k8s.io/kube-scheduler v0.24.1 // indirect - k8s.io/kubelet v0.24.1 // indirect - k8s.io/mount-utils v0.24.1 // indirect - k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) @@ -143,28 +95,9 @@ replace ( google.golang.org/grpc => google.golang.org/grpc v1.38.0 k8s.io/api => k8s.io/api v0.25.12 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.25.12 k8s.io/apimachinery => k8s.io/apimachinery v0.25.12 k8s.io/apiserver => k8s.io/apiserver v0.25.12 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.25.12 k8s.io/client-go => k8s.io/client-go v0.25.12 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.25.12 - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.25.12 - k8s.io/code-generator => k8s.io/code-generator v0.25.12 k8s.io/component-base => k8s.io/component-base v0.25.12 - k8s.io/component-helpers => k8s.io/component-helpers v0.25.12 - k8s.io/controller-manager => k8s.io/controller-manager v0.25.12 k8s.io/cri-api => k8s.io/cri-api v0.25.12 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.25.12 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.25.12 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.25.12 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.25.12 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.25.12 - k8s.io/kubectl => k8s.io/kubectl v0.25.12 - k8s.io/kubelet => k8s.io/kubelet v0.25.12 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.25.12 - k8s.io/metrics => k8s.io/metrics v0.25.12 - k8s.io/mount-utils => k8s.io/mount-utils v0.25.12 - k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.25.12 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.25.12 ) diff --git a/go.sum b/go.sum index 465eb1001..aecdcaa61 100644 --- a/go.sum +++ b/go.sum @@ -18,10 +18,6 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -38,14 +34,8 @@ contrib.go.opencensus.io/exporter/jaeger v0.2.1/go.mod h1:Y8IsLgdxqh1QxYxPC5IgXV contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab h1:UKkYhof1njT1/xq4SEg5z+VpTgjmNeHwPGRQl7takDI= -github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA= -github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= -github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= @@ -56,70 +46,34 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k= -github.com/aws/aws-sdk-go v1.38.49 h1:E31vxjCe6a5I+mJLmUGaZobiWmg9KdWaud9IfceYeYQ= -github.com/aws/aws-sdk-go v1.38.49/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= -github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v5 v5.3.0 h1:wpFFOoomK3389ue2lAb0Boag6XPht5QYpipxmSNL4d8= -github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cilium/ebpf v0.7.0 h1:1k/q3ATgxSXRdrmPfH8d7YK0GfqVsEKZAX9dQZvs56k= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/ttrpc v1.1.0 h1:GbtyLRxb0gOLR0TYQWt3O6B0NvT8tMdorEHqIQo/lWI= -github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= -github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= -github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= -github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE= -github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc= github.com/emicklei/go-restful/v3 v3.8.0 h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw= github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/euank/go-kmsg-parser v2.0.0+incompatible h1:cHD53+PLQuuQyLZeriD1V/esuG4MuU0Pjs5y6iknohY= -github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -134,8 +88,6 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -148,12 +100,7 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -168,8 +115,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -185,12 +130,11 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/cadvisor v0.45.1 h1:bXw2237sAtmfnHe9CN2YiUisCumA1tBwpkTdn3lMp5Y= -github.com/google/cadvisor v0.45.1/go.mod h1:vsMT3Uv2XjQ8M7WUtKARV74mU/HN64C4XtM1bJhUKcU= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -221,28 +165,15 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/intel/goresctrl v0.3.0 h1:K2D3GOzihV7xSBedGxONSlaw/un1LZgWsc9IfqipN4c= -github.com/intel/goresctrl v0.3.0/go.mod h1:fdz3mD85cmP9sHD8JUlrNWAxvwM86CrbmVXltEKd7zk= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/intel/goresctrl v0.5.0 h1:kcDhjE3ZF/mNrJuRzLS3LY2Hp6atFaF1XVFBT7SVL2g= +github.com/intel/goresctrl v0.5.0/go.mod h1:mIe63ggylWYr0cU/l8n11FAkesqfvuP3oktIsxvu0T0= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -255,19 +186,15 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= -github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -279,16 +206,6 @@ github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989 h1:PS1dLCGtD8bb9RPKJrc8bS7qHL6JnW1CZvwzH9dPoUs= -github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989/go.mod h1:2eu9pRWp8mo84xCg6KswZ+USQHjwgRhNp06sozOdsTY= -github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible h1:aKW/4cBs+yK6gpqU3K/oIwk9Q/XICqd3zOX/UFuvqmk= -github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= -github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/sys/mountinfo v0.6.0 h1:gUDhXQx58YNrpHlK4nSL+7y2pxFZkUcXqzFDKWdC0Oo= -github.com/moby/sys/mountinfo v0.6.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -296,9 +213,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -306,19 +220,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= -github.com/opencontainers/runc v1.1.6 h1:XbhB8IfG/EsnhNvZtNdLB0GBw92GYEFvKlhaJk9jUgA= -github.com/opencontainers/runc v1.1.6/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 h1:3snG66yBm59tKhhSPQrQ/0bCrv1LQbKt40LnUPiUxdc= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= -github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGqQpoHsF8w= -github.com/opencontainers/selinux v1.10.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -332,8 +233,8 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -345,72 +246,48 @@ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB8 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= github.com/prometheus/statsd_exporter v0.22.8 h1:Qo2D9ZzaQG+id9i5NYNGmbf1aa/KxKbB9aKfMS+Yib0= github.com/prometheus/statsd_exporter v0.22.8/go.mod h1:/DzwbTEaFTE0Ojz5PqcSk6+PFHOPWGxdXVr6yC8eFOM= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 h1:RpforrEYXWkmGwJHIGnLZ3tTWStkjVVstwzNGqxX2Ds= -github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0= github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= -github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24szfsn/3LvK9QHCq9oQw8+U= github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 h1:+UB2BJA852UkGH42H+Oee69djmxS3ANzl2b/JtT1YiA= -github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA= -github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -488,8 +365,6 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -502,8 +377,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -514,8 +389,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -525,22 +400,16 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -551,7 +420,6 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -559,19 +427,13 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= @@ -588,12 +450,9 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.2.0 h1:52I/1L54xyEQAYdtcSuxtiT84KGYTBGXwayxmIpNJhE= -golang.org/x/time v0.2.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -603,7 +462,6 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -677,7 +535,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -711,10 +568,10 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -736,7 +593,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -748,37 +604,16 @@ k8s.io/api v0.25.12 h1:vMyRHX3SASysor6zk81DsYXbkVdvzQEIL4gA+6+j6mQ= k8s.io/api v0.25.12/go.mod h1:pAGhdr4HvJlOa1g26QpNeiQLNnzc6nwU92MQSqY2pBk= k8s.io/apimachinery v0.25.12 h1:xLVMeHrUfO4Eq2CK60YS+ElVYv0AUNSGVYdHKZFBHRE= k8s.io/apimachinery v0.25.12/go.mod h1:IFwbcNi3gKkfDhuy0VYu3+BwbxbiIov3p6FR8ge1Epc= -k8s.io/apiserver v0.25.12 h1:Dn32Ow5NKztp8+4qzFrM11q5/HjL39tkvuRqiTyNfU8= -k8s.io/apiserver v0.25.12/go.mod h1:k98t1f3cE6DJf7P8qIEGuzBWIv4h9v9P5N24zHTp7ng= k8s.io/client-go v0.25.12 h1:LSwQNUqm368OjEoITifwM8+P/B+7wxvZ+yPKbFanVWI= k8s.io/client-go v0.25.12/go.mod h1:WD2cp9N7NLyz2jMoq49vC6+8HKkjhqaDkk93l3eJO0M= -k8s.io/cloud-provider v0.25.12 h1:9/1kKkTcizV3QpAUgaJqyiqWX7E6xmkdbzjD8eanJQ4= -k8s.io/cloud-provider v0.25.12/go.mod h1:eR1AJ+H018aqWiLk7wRXQSstDi04slgMWjSpABRltFQ= -k8s.io/component-base v0.25.12 h1:TAmD4poBNt08FQgtKbdiYr7AMbUmYw5b+51CX7UTOBc= -k8s.io/component-base v0.25.12/go.mod h1:tkIm/OiTy1PcV/EtYU8uiHQrCYhdejrOWnzT2AMBM4Y= -k8s.io/component-helpers v0.25.12 h1:DaaHbV1G6XGfPMCUVX0P6GBDyEB2HUcbjIUGDLRUTVs= -k8s.io/component-helpers v0.25.12/go.mod h1:/LobXzLYiOOS44f1eVIwEQf+xmKG8UPeGRQof10Dsok= k8s.io/cri-api v0.25.12 h1:clZ6d2Slzb8IdhSxwPbuEIyAA4sttCILprF9DZsAis4= k8s.io/cri-api v0.25.12/go.mod h1:yKsLus3raCZ+WbR2m5hS+3hUs5BgSldj2CFJTWyx48M= -k8s.io/csi-translation-lib v0.25.12 h1:U7V/1al+tN39BtcBMjCtMLFEwpvKjDSoZ9WipBgVb38= -k8s.io/csi-translation-lib v0.25.12/go.mod h1:y5jczv+eEJY26/8p/idJfAkUdxD7WjmEFRfN+rgVAwU= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= -k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= +k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= -k8s.io/kube-scheduler v0.25.12 h1:uCJmiTr5TedKyYg1tsoLDZ2GBBl/2ERSuRtLX0ikiyA= -k8s.io/kube-scheduler v0.25.12/go.mod h1:8WpYeJkcXtGXsfwfkMmjAdcAQ4xapG2pHgGKzlPb/JI= -k8s.io/kubelet v0.25.12 h1:86Brxxkw5aH6Y1H1oYGA5erFkrOOJu/CA2MFXFN2GTk= -k8s.io/kubelet v0.25.12/go.mod h1:NrdSM58TPG875yNGz/PZJCexu+ac9jv2DTC6tAHg8B0= -k8s.io/kubernetes v1.25.12 h1:KSvhgELGV/GOYRqxbuhzrxPpU2ON4Xp1/k08E2v/7SY= -k8s.io/kubernetes v1.25.12/go.mod h1:CjSm5tJyKxHyGhK5aAID68YMErzDhAjWLL7Nd7NMonU= -k8s.io/mount-utils v0.25.12 h1:wHRywLgHq4VxEFpTDrPsrMNjtnrdIHTggGyReU9wIHc= -k8s.io/mount-utils v0.25.12/go.mod h1:IM9QOFh15E1a4Nb6Rcn8FJ9Z1PbBpuyAPCty/qvKSAw= -k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= -k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= +k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/avx/collector.go b/pkg/avx/collector.go index b097f307f..66c579700 100644 --- a/pkg/avx/collector.go +++ b/pkg/avx/collector.go @@ -22,7 +22,7 @@ import ( "bytes" "flag" "fmt" - "io/ioutil" + "os" "path/filepath" "regexp" "strconv" @@ -110,7 +110,7 @@ type collector struct { func enablePerfTracepoint(prog *bpf.Program, tracepoint string) (int, error) { - id, err := ioutil.ReadFile(filepath.Join(kernelTracepointPath, tracepoint, "id")) + id, err := os.ReadFile(filepath.Join(kernelTracepointPath, tracepoint, "id")) if err != nil { return -1, errors.Wrap(err, "unable to read tracepoint ID") } diff --git a/pkg/avx/elfdump.go b/pkg/avx/elfdump.go index a61adc172..194125d8b 100644 --- a/pkg/avx/elfdump.go +++ b/pkg/avx/elfdump.go @@ -22,7 +22,6 @@ package main import ( "encoding/hex" "fmt" - "io/ioutil" "os" "strings" "text/template" @@ -37,7 +36,7 @@ type Program struct { } func main() { - f, err := ioutil.ReadFile("../../libexec/avx512.o") + f, err := os.ReadFile("../../libexec/avx512.o") if err != nil { fmt.Println("Note: AVX512 eBPF ELF not available.") } diff --git a/pkg/blockio/blockio.go b/pkg/blockio/blockio.go index acb02b88f..20377a130 100644 --- a/pkg/blockio/blockio.go +++ b/pkg/blockio/blockio.go @@ -17,8 +17,8 @@ limitations under the License. package blockio import ( + "errors" "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -29,8 +29,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" - "github.com/hashicorp/go-multierror" - "github.com/intel/cri-resource-manager/pkg/cgroups" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" logger "github.com/intel/cri-resource-manager/pkg/log" @@ -153,7 +151,7 @@ func getCurrentIOSchedulers() (map[string]string, error) { } for _, schedulerFile := range schedulerFiles { devName := strings.SplitN(schedulerFile, "/", 5)[3] - schedulerDataB, err := ioutil.ReadFile(schedulerFile) + schedulerDataB, err := os.ReadFile(schedulerFile) if err != nil { // A block device may be disconnected. Continue without error. log.Error("failed to read current IO scheduler %#v: %v\n", schedulerFile, err) @@ -181,27 +179,27 @@ func getCurrentIOSchedulers() (map[string]string, error) { // deviceParametersToOci converts single blockio class parameters into OCI BlockIO structure. func devicesParametersToOci(dps []DevicesParameters, currentIOSchedulers map[string]string) (cgroups.OciBlockIOParameters, error) { - var errors *multierror.Error + errs := []error{} oci := cgroups.NewOciBlockIOParameters() for _, dp := range dps { var err error var weight, throttleReadBps, throttleWriteBps, throttleReadIOPS, throttleWriteIOPS int64 weight, err = parseAndValidateInt64("Weight", dp.Weight, -1, 10, 1000) - errors = multierror.Append(errors, err) + errs = append(errs, err) throttleReadBps, err = parseAndValidateInt64("ThrottleReadBps", dp.ThrottleReadBps, -1, 0, -1) - errors = multierror.Append(errors, err) + errs = append(errs, err) throttleWriteBps, err = parseAndValidateInt64("ThrottleWriteBps", dp.ThrottleWriteBps, -1, 0, -1) - errors = multierror.Append(errors, err) + errs = append(errs, err) throttleReadIOPS, err = parseAndValidateInt64("ThrottleReadIOPS", dp.ThrottleReadIOPS, -1, 0, -1) - errors = multierror.Append(errors, err) + errs = append(errs, err) throttleWriteIOPS, err = parseAndValidateInt64("ThrottleWriteIOPS", dp.ThrottleWriteIOPS, -1, 0, -1) - errors = multierror.Append(errors, err) + errs = append(errs, err) if dp.Devices == nil { if weight > -1 { oci.Weight = weight } if throttleReadBps > -1 || throttleWriteBps > -1 || throttleReadIOPS > -1 || throttleWriteIOPS > -1 { - errors = multierror.Append(errors, fmt.Errorf("ignoring throttling (rbps=%#v wbps=%#v riops=%#v wiops=%#v): Devices not listed", + errs = append(errs, fmt.Errorf("ignoring throttling (rbps=%#v wbps=%#v riops=%#v wiops=%#v): Devices not listed", dp.ThrottleReadBps, dp.ThrottleWriteBps, dp.ThrottleReadIOPS, dp.ThrottleWriteIOPS)) } } else { @@ -239,7 +237,7 @@ func devicesParametersToOci(dps []DevicesParameters, currentIOSchedulers map[str } } } - return oci, errors.ErrorOrNil() + return oci, errors.Join(errs...) } // parseAndValidateInt64 parses quantities, like "64 M", and validates that they are in given range. @@ -278,7 +276,7 @@ var currentPlatform platformInterface = defaultPlatform{} func (dpm defaultPlatform) configurableBlockDevices(devWildcards []string) ([]BlockDeviceInfo, error) { // Return map {devNode: BlockDeviceInfo} // Example: {"/dev/sda": {Major:8, Minor:0, Origin:"from symlink /dev/disk/by-id/ata-VendorXSSD from wildcard /dev/disk/by-id/*SSD*"}} - var errors *multierror.Error + errs := []error{} blockDevices := []BlockDeviceInfo{} var origin string @@ -288,11 +286,11 @@ func (dpm defaultPlatform) configurableBlockDevices(devWildcards []string) ([]Bl for _, devWildcard := range devWildcards { devWildcardMatches, err := filepath.Glob(devWildcard) if err != nil { - errors = multierror.Append(errors, fmt.Errorf("bad device wildcard %#v: %w", devWildcard, err)) + errs = append(errs, fmt.Errorf("bad device wildcard %#v: %w", devWildcard, err)) continue } if len(devWildcardMatches) == 0 { - errors = multierror.Append(errors, fmt.Errorf("device wildcard %#v does not match any device nodes", devWildcard)) + errs = append(errs, fmt.Errorf("device wildcard %#v does not match any device nodes", devWildcard)) continue } for _, devMatch := range devWildcardMatches { @@ -311,7 +309,7 @@ func (dpm defaultPlatform) configurableBlockDevices(devWildcards []string) ([]Bl for devMatch, devOrigin := range devMatches { realDevNode, err := filepath.EvalSymlinks(devMatch) if err != nil { - errors = multierror.Append(errors, fmt.Errorf("cannot filepath.EvalSymlinks(%#v): %w", devMatch, err)) + errs = append(errs, fmt.Errorf("cannot filepath.EvalSymlinks(%#v): %w", devMatch, err)) continue } if realDevNode != devMatch { @@ -331,27 +329,27 @@ func (dpm defaultPlatform) configurableBlockDevices(devWildcards []string) ([]Bl } fileInfo, err := os.Stat(devRealpath) if err != nil { - errors = multierror.Append(errors, fmt.Errorf("cannot os.Stat(%#v): %w%s", devRealpath, err, origin)) + errs = append(errs, fmt.Errorf("cannot os.Stat(%#v): %w%s", devRealpath, err, origin)) continue } fileMode := fileInfo.Mode() if fileMode&os.ModeDevice == 0 { - errors = multierror.Append(errors, fmt.Errorf("file %#v is not a device%s", devRealpath, origin)) + errs = append(errs, fmt.Errorf("file %#v is not a device%s", devRealpath, origin)) continue } if fileMode&os.ModeCharDevice != 0 { - errors = multierror.Append(errors, fmt.Errorf("file %#v is a character device%s", devRealpath, origin)) + errs = append(errs, fmt.Errorf("file %#v is a character device%s", devRealpath, origin)) continue } sys, ok := fileInfo.Sys().(*syscall.Stat_t) major := unix.Major(sys.Rdev) minor := unix.Minor(sys.Rdev) if !ok { - errors = multierror.Append(errors, fmt.Errorf("cannot get syscall stat_t from %#v: %w%s", devRealpath, err, origin)) + errs = append(errs, fmt.Errorf("cannot get syscall stat_t from %#v: %w%s", devRealpath, err, origin)) continue } if minor&0xf != 0 { - errors = multierror.Append(errors, fmt.Errorf("skipping %#v: cannot weight/throttle partitions%s", devRealpath, origin)) + errs = append(errs, fmt.Errorf("skipping %#v: cannot weight/throttle partitions%s", devRealpath, origin)) continue } blockDevices = append(blockDevices, BlockDeviceInfo{ @@ -361,7 +359,7 @@ func (dpm defaultPlatform) configurableBlockDevices(devWildcards []string) ([]Bl Origin: devOrigin, }) } - return blockDevices, errors.ErrorOrNil() + return blockDevices, errors.Join(errs...) } // blockioError creates a formatted error message. diff --git a/pkg/cgroups/cgroupblkio.go b/pkg/cgroups/cgroupblkio.go index 9980a6e94..e06c9422d 100644 --- a/pkg/cgroups/cgroupblkio.go +++ b/pkg/cgroups/cgroupblkio.go @@ -15,15 +15,13 @@ package cgroups import ( + "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" "strings" - "github.com/hashicorp/go-multierror" - logger "github.com/intel/cri-resource-manager/pkg/log" ) @@ -160,9 +158,9 @@ type devMajMin struct { // ResetBlkioParameters adds new, changes existing and removes missing blockIO parameters in cgroupsDir func ResetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameters) error { - var errors *multierror.Error + errs := []error{} oldBlockIO, getErr := GetBlkioParameters(cgroupsDir) - errors = multierror.Append(errors, getErr) + errs = append(errs, getErr) newBlockIO := NewOciBlockIOParameters() newBlockIO.Weight = blockIO.Weight // Set new device weights @@ -181,8 +179,8 @@ func ResetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameters) error newBlockIO.ThrottleWriteBpsDevice = resetDevRates(oldBlockIO.ThrottleWriteBpsDevice, blockIO.ThrottleWriteBpsDevice) newBlockIO.ThrottleReadIOPSDevice = resetDevRates(oldBlockIO.ThrottleReadIOPSDevice, blockIO.ThrottleReadIOPSDevice) newBlockIO.ThrottleWriteIOPSDevice = resetDevRates(oldBlockIO.ThrottleWriteIOPSDevice, blockIO.ThrottleWriteIOPSDevice) - errors = multierror.Append(errors, SetBlkioParameters(cgroupsDir, newBlockIO)) - return errors.ErrorOrNil() + errs = append(errs, SetBlkioParameters(cgroupsDir, newBlockIO)) + return errors.Join(errs...) } // resetDevRates adds wanted rate parameters to new and resets unwated rates @@ -203,7 +201,7 @@ func resetDevRates(old, wanted []OciDeviceRate) []OciDeviceRate { // GetBlkioParameters returns OCI BlockIO parameters from files in cgroups blkio controller directory. func GetBlkioParameters(cgroupsDir string) (OciBlockIOParameters, error) { - var errors *multierror.Error + errs := []error{} blockIO := NewOciBlockIOParameters() content, err := readFromFileInDir(cgroupsDir, blkioWeightFiles) if err == nil { @@ -211,22 +209,22 @@ func GetBlkioParameters(cgroupsDir string) (OciBlockIOParameters, error) { if err == nil { blockIO.Weight = weight } else { - errors = multierror.Append(errors, fmt.Errorf("parsing weight from %#v failed: %w", content, err)) + errs = append(errs, fmt.Errorf("parsing weight from %#v failed: %w", content, err)) } } else { - errors = multierror.Append(errors, err) + errs = append(errs, err) } - errors = multierror.Append(errors, readOciDeviceParameters(cgroupsDir, blkioWeightDeviceFiles, &blockIO.WeightDevice)) - errors = multierror.Append(errors, readOciDeviceParameters(cgroupsDir, blkioThrottleReadBpsFiles, &blockIO.ThrottleReadBpsDevice)) - errors = multierror.Append(errors, readOciDeviceParameters(cgroupsDir, blkioThrottleWriteBpsFiles, &blockIO.ThrottleWriteBpsDevice)) - errors = multierror.Append(errors, readOciDeviceParameters(cgroupsDir, blkioThrottleReadIOPSFiles, &blockIO.ThrottleReadIOPSDevice)) - errors = multierror.Append(errors, readOciDeviceParameters(cgroupsDir, blkioThrottleWriteIOPSFiles, &blockIO.ThrottleWriteIOPSDevice)) - return blockIO, errors.ErrorOrNil() + errs = append(errs, readOciDeviceParameters(cgroupsDir, blkioWeightDeviceFiles, &blockIO.WeightDevice)) + errs = append(errs, readOciDeviceParameters(cgroupsDir, blkioThrottleReadBpsFiles, &blockIO.ThrottleReadBpsDevice)) + errs = append(errs, readOciDeviceParameters(cgroupsDir, blkioThrottleWriteBpsFiles, &blockIO.ThrottleWriteBpsDevice)) + errs = append(errs, readOciDeviceParameters(cgroupsDir, blkioThrottleReadIOPSFiles, &blockIO.ThrottleReadIOPSDevice)) + errs = append(errs, readOciDeviceParameters(cgroupsDir, blkioThrottleWriteIOPSFiles, &blockIO.ThrottleWriteIOPSDevice)) + return blockIO, errors.Join(errs...) } // readOciDeviceParameters parses device lines used for weights and throttling rates func readOciDeviceParameters(baseDir string, filenames []string, params OciDeviceParameters) error { - var errors *multierror.Error + errs := []error{} contents, err := readFromFileInDir(baseDir, filenames) if err != nil { return err @@ -239,29 +237,29 @@ func readOciDeviceParameters(baseDir string, filenames []string, params OciDevic // Expect syntax MAJOR:MINOR VALUE devVal := strings.Split(line, " ") if len(devVal) != 2 { - errors = multierror.Append(errors, fmt.Errorf("invalid line %q, single space expected", line)) + errs = append(errs, fmt.Errorf("invalid line %q, single space expected", line)) continue } majMin := strings.Split(devVal[0], ":") if len(majMin) != 2 { - errors = multierror.Append(errors, fmt.Errorf("invalid line %q, single colon expected before space", line)) + errs = append(errs, fmt.Errorf("invalid line %q, single colon expected before space", line)) continue } major, majErr := strconv.ParseInt(majMin[0], 10, 64) minor, minErr := strconv.ParseInt(majMin[1], 10, 64) value, valErr := strconv.ParseInt(devVal[1], 10, 64) if majErr != nil || minErr != nil || valErr != nil { - errors = multierror.Append(errors, fmt.Errorf("invalid number when parsing \"major:minor value\" from \"%s:%s %s\"", majMin[0], majMin[1], devVal[1])) + errs = append(errs, fmt.Errorf("invalid number when parsing \"major:minor value\" from \"%s:%s %s\"", majMin[0], majMin[1], devVal[1])) continue } params.Append(major, minor, value) } - return errors.ErrorOrNil() + return errors.Join(errs...) } // readFromFileInDir returns content from the first successfully read file. func readFromFileInDir(baseDir string, filenames []string) (string, error) { - var errors *multierror.Error + errs := []error{} // If reading all the files fails, return list of read errors. for _, filename := range filenames { filepath := filepath.Join(baseDir, filename) @@ -269,9 +267,9 @@ func readFromFileInDir(baseDir string, filenames []string) (string, error) { if err == nil { return content, nil } - errors = multierror.Append(errors, err) + errs = append(errs, err) } - err := errors.ErrorOrNil() + err := errors.Join(errs...) if err != nil { return "", fmt.Errorf("could not read any of files %q: %w", filenames, err) } @@ -281,26 +279,26 @@ func readFromFileInDir(baseDir string, filenames []string) (string, error) { // SetBlkioParameters writes OCI BlockIO parameters to files in cgroups blkio contoller directory. func SetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameters) error { log.Debug("configuring cgroups blkio controller in directory %#v with parameters %+v", cgroupsDir, blockIO) - var errors *multierror.Error + errs := []error{} if blockIO.Weight >= 0 { - errors = multierror.Append(errors, writeToFileInDir(cgroupsDir, blkioWeightFiles, strconv.FormatInt(blockIO.Weight, 10))) + errs = append(errs, writeToFileInDir(cgroupsDir, blkioWeightFiles, strconv.FormatInt(blockIO.Weight, 10))) } for _, weightDevice := range blockIO.WeightDevice { - errors = multierror.Append(errors, writeDevValueToFileInDir(cgroupsDir, blkioWeightDeviceFiles, weightDevice.Major, weightDevice.Minor, weightDevice.Weight)) + errs = append(errs, writeDevValueToFileInDir(cgroupsDir, blkioWeightDeviceFiles, weightDevice.Major, weightDevice.Minor, weightDevice.Weight)) } for _, rateDevice := range blockIO.ThrottleReadBpsDevice { - errors = multierror.Append(errors, writeDevValueToFileInDir(cgroupsDir, blkioThrottleReadBpsFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) + errs = append(errs, writeDevValueToFileInDir(cgroupsDir, blkioThrottleReadBpsFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) } for _, rateDevice := range blockIO.ThrottleWriteBpsDevice { - errors = multierror.Append(errors, writeDevValueToFileInDir(cgroupsDir, blkioThrottleWriteBpsFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) + errs = append(errs, writeDevValueToFileInDir(cgroupsDir, blkioThrottleWriteBpsFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) } for _, rateDevice := range blockIO.ThrottleReadIOPSDevice { - errors = multierror.Append(errors, writeDevValueToFileInDir(cgroupsDir, blkioThrottleReadIOPSFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) + errs = append(errs, writeDevValueToFileInDir(cgroupsDir, blkioThrottleReadIOPSFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) } for _, rateDevice := range blockIO.ThrottleWriteIOPSDevice { - errors = multierror.Append(errors, writeDevValueToFileInDir(cgroupsDir, blkioThrottleWriteIOPSFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) + errs = append(errs, writeDevValueToFileInDir(cgroupsDir, blkioThrottleWriteIOPSFiles, rateDevice.Major, rateDevice.Minor, rateDevice.Rate)) } - return errors.ErrorOrNil() + return errors.Join(errs...) } // writeDevValueToFileInDir writes MAJOR:MINOR VALUE to the first existing file under baseDir @@ -311,7 +309,7 @@ func writeDevValueToFileInDir(baseDir string, filenames []string, major, minor, // writeToFileInDir writes content to the first existing file in the list under baseDir. func writeToFileInDir(baseDir string, filenames []string, content string) error { - var errors *multierror.Error + errs := []error{} // Returns list of errors from writes, list of single error due to all filenames missing or nil on success. for _, filename := range filenames { filepath := filepath.Join(baseDir, filename) @@ -319,9 +317,9 @@ func writeToFileInDir(baseDir string, filenames []string, content string) error if err == nil { return nil } - errors = multierror.Append(errors, err) + errs = append(errs, err) } - err := errors.ErrorOrNil() + err := errors.Join(errs...) if err != nil { return fmt.Errorf("could not write content %#v to any of files %q: %w", content, filenames, err) } @@ -342,7 +340,7 @@ var currentPlatform platformInterface = defaultPlatform{} // readFromFile returns file contents as a string. func (dpm defaultPlatform) readFromFile(filename string) (string, error) { - content, err := ioutil.ReadFile(filename) + content, err := os.ReadFile(filename) return string(content), err } diff --git a/pkg/cgroups/cgroupstats.go b/pkg/cgroups/cgroupstats.go index a3bdf5a61..a34d2bdef 100644 --- a/pkg/cgroups/cgroupstats.go +++ b/pkg/cgroups/cgroupstats.go @@ -16,7 +16,7 @@ package cgroups import ( "fmt" - "io/ioutil" + "os" "path" "path/filepath" "strconv" @@ -89,7 +89,7 @@ type GlobalNumaStats struct { func readCgroupFileLines(filePath string) ([]string, error) { - f, err := ioutil.ReadFile(filePath) + f, err := os.ReadFile(filePath) if err != nil { return nil, err diff --git a/pkg/config/data.go b/pkg/config/data.go index dc2bc3957..17800506f 100644 --- a/pkg/config/data.go +++ b/pkg/config/data.go @@ -16,7 +16,7 @@ package config import ( "fmt" - "io/ioutil" + "os" "sigs.k8s.io/yaml" "strings" ) @@ -52,7 +52,7 @@ func DataFromStringMap(smap map[string]string) (Data, error) { // DataFromFile unmarshals the content of the given file into configuration data. func DataFromFile(path string) (Data, error) { - raw, err := ioutil.ReadFile(path) + raw, err := os.ReadFile(path) if err != nil { return nil, configError("failed to read file %q: %v", path, err) } diff --git a/pkg/cpuallocator/allocator.go b/pkg/cpuallocator/allocator.go index 8f9b8d19c..7983fe0af 100644 --- a/pkg/cpuallocator/allocator.go +++ b/pkg/cpuallocator/allocator.go @@ -18,11 +18,10 @@ import ( "fmt" "sort" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/utils" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/intel/goresctrl/pkg/sst" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -192,7 +191,7 @@ func (a *allocatorHelper) takeIdleCores() { if cset.IsEmpty() { return false } - return cset.Intersection(a.from).Equals(cset) && cset.ToSlice()[0] == int(id) + return cset.Intersection(a.from).Equals(cset) && cset.List()[0] == int(id) }) // sorted by id @@ -271,8 +270,8 @@ func (a *allocatorHelper) takeIdleThreads() { return iPkg < jPkg } - iCset := cpuset.NewCPUSet(int(cores[i])) - jCset := cpuset.NewCPUSet(int(cores[j])) + iCset := cpuset.New(int(cores[i])) + jCset := cpuset.New(int(cores[j])) if res := a.topology.cpuPriorities.cmpCPUSet(iCset, jCset, a.prefer, 0); res != 0 { return res > 0 } @@ -298,7 +297,7 @@ func (a *allocatorHelper) takeIdleThreads() { for _, id := range cores { cset := a.topology.core[id].Difference(offline) a.Debug(" => considering thread %v (#%s)...", id, cset) - cset = cpuset.NewCPUSet(int(id)) + cset = cpuset.New(int(id)) a.result = a.result.Union(cset) a.from = a.from.Difference(cset) a.cnt -= cset.Size() @@ -313,10 +312,10 @@ func (a *allocatorHelper) takeIdleThreads() { func (a *allocatorHelper) takeAny() { a.Debug("* takeAnyCores()...") - cpus := a.from.ToSlice() + cpus := a.from.List() if len(cpus) >= a.cnt { - cset := cpuset.NewCPUSet(cpus[0:a.cnt]...) + cset := cpuset.New(cpus[0:a.cnt]...) a.result = a.result.Union(cset) a.from = a.from.Difference(cset) a.cnt = 0 @@ -342,7 +341,7 @@ func (a *allocatorHelper) allocate() cpuset.CPUSet { return a.result } - return cpuset.NewCPUSet() + return cpuset.New() } func (ca *cpuAllocator) allocateCpus(from *cpuset.CPUSet, cnt int, prefer CPUPriority) (cpuset.CPUSet, error) { @@ -351,9 +350,9 @@ func (ca *cpuAllocator) allocateCpus(from *cpuset.CPUSet, cnt int, prefer CPUPri switch { case from.Size() < cnt: - result, err = cpuset.NewCPUSet(), fmt.Errorf("cpuset %s does not have %d CPUs", from, cnt) + result, err = cpuset.New(), fmt.Errorf("cpuset %s does not have %d CPUs", from, cnt) case from.Size() == cnt: - result, err, *from = from.Clone(), nil, cpuset.NewCPUSet() + result, err, *from = from.Clone(), nil, cpuset.New() default: a := newAllocatorHelper(ca.sys, ca.topologyCache) a.from = from.Clone() @@ -436,7 +435,7 @@ func (c *topologyCache) discoverSstCPUPriority(sys sysfs.System, pkgID idset.ID) pkg := sys.Package(pkgID) sst := pkg.SstInfo() - cpuIDs := c.pkg[pkgID].ToSlice() + cpuIDs := c.pkg[pkgID].List() prios := make(map[idset.ID]CPUPriority, len(cpuIDs)) // Determine SST-based priority. Based on experimentation there is some @@ -514,7 +513,7 @@ func (c *topologyCache) sstClosPriority(sys sysfs.System, pkgID idset.ID) map[in // Get a list of unique CLOS proportional priority values closPps := make(map[int]int) closIds := make(map[int]int) - for _, cpuID := range c.pkg[pkgID].ToSlice() { + for _, cpuID := range c.pkg[pkgID].List() { clos := sys.CPU(idset.ID(cpuID)).SstClos() pp := sstinfo.ClosInfo[clos].ProportionalPriority closPps[pp] = clos @@ -558,7 +557,7 @@ func (c *topologyCache) discoverCpufreqPriority(sys sysfs.System, pkgID idset.ID // Group cpus by base frequency and energy performance profile freqs := map[uint64][]idset.ID{} epps := map[sysfs.EPP][]idset.ID{} - cpuIDs := c.pkg[pkgID].ToSlice() + cpuIDs := c.pkg[pkgID].List() for _, num := range cpuIDs { id := idset.ID(num) cpu := sys.CPU(id) diff --git a/pkg/cpuallocator/cpuallocator_test.go b/pkg/cpuallocator/cpuallocator_test.go index 26b98364f..d6d19a53c 100644 --- a/pkg/cpuallocator/cpuallocator_test.go +++ b/pkg/cpuallocator/cpuallocator_test.go @@ -15,20 +15,18 @@ package cpuallocator import ( - "io/ioutil" "os" "path" "testing" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/utils" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) func TestAllocatorHelper(t *testing.T) { // Create tmpdir and decompress testdata there - tmpdir, err := ioutil.TempDir("", "cri-resource-manager-test-") + tmpdir, err := os.MkdirTemp("", "cri-resource-manager-test-") if err != nil { t.Fatalf("failed to create tmpdir: %v", err) } @@ -67,7 +65,7 @@ func TestAllocatorHelper(t *testing.T) { from: cpuset.MustParse("2,3,10-14,20"), prefer: PriorityNormal, cnt: 9, - expected: cpuset.NewCPUSet(), + expected: cpuset.New(), }, { description: "request all available CPUs", @@ -81,7 +79,7 @@ func TestAllocatorHelper(t *testing.T) { from: cpuset.MustParse("2,3,10-25"), prefer: PriorityHigh, cnt: 4, - expected: cpuset.NewCPUSet(2, 3, 15, 17), + expected: cpuset.New(2, 3, 15, 17), }, } diff --git a/pkg/cri/resource-manager/cache/cache.go b/pkg/cri/resource-manager/cache/cache.go index 4f0ca5b91..ecde89372 100644 --- a/pkg/cri/resource-manager/cache/cache.go +++ b/pkg/cri/resource-manager/cache/cache.go @@ -18,7 +18,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -27,13 +26,13 @@ import ( v1 "k8s.io/api/core/v1" criv1 "k8s.io/cri-api/pkg/apis/runtime/v1" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "github.com/intel/cri-resource-manager/pkg/apis/resmgr" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/config" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -1532,7 +1531,7 @@ func (cch *cache) Save() error { } tmpPath := cch.filePath + ".saving" - if err = ioutil.WriteFile(tmpPath, data, cacheFilePerm.prefer); err != nil { + if err = os.WriteFile(tmpPath, data, cacheFilePerm.prefer); err != nil { return cacheError("failed to write cache to file %q: %v", tmpPath, err) } if err := os.Rename(tmpPath, cch.filePath); err != nil { @@ -1547,7 +1546,7 @@ func (cch *cache) Save() error { func (cch *cache) Load() error { cch.Debug("loading cache from file '%s'...", cch.filePath) - data, err := ioutil.ReadFile(cch.filePath) + data, err := os.ReadFile(cch.filePath) switch { case os.IsNotExist(err): diff --git a/pkg/cri/resource-manager/cache/cache_test.go b/pkg/cri/resource-manager/cache/cache_test.go index dace31c4a..b58ca12e2 100644 --- a/pkg/cri/resource-manager/cache/cache_test.go +++ b/pkg/cri/resource-manager/cache/cache_test.go @@ -16,15 +16,12 @@ package cache import ( "fmt" - "io/ioutil" "os" "strings" "testing" v1 "k8s.io/api/core/v1" criv1 "k8s.io/cri-api/pkg/apis/runtime/v1" - kubecm "k8s.io/kubernetes/pkg/kubelet/cm" - kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" ) @@ -52,7 +49,7 @@ type fakeContainer struct { } func createTmpCache() (Cache, string, error) { - dir, err := ioutil.TempDir("", "cache-test") + dir, err := os.MkdirTemp("", "cache-test") if err != nil { return nil, "", err } @@ -75,7 +72,7 @@ func createFakePod(cch Cache, fp *fakePod) (Pod, error) { } fp.id = fmt.Sprintf("pod%4.4d", nextFakePodID) fp.uid = fmt.Sprintf("poduid%4.4d", nextFakePodID) - fp.labels[kubetypes.KubernetesPodUIDLabel] = fp.uid + fp.labels[kubernetes.PodUIDLabel] = fp.uid nextFakePodID++ if string(fp.qos) == "" { @@ -362,15 +359,15 @@ const ( // anything below 2 millicpus will yield 0 as an estimate minNonZeroRequest = 2 // check CPU request/limit estimate accuracy up to this many CPU cores - maxCPU = (kubecm.MaxShares / kubecm.SharesPerCPU) * kubecm.MilliCPUToCPU + maxCPU = (kubernetes.MaxShares / kubernetes.SharesPerCPU) * kubernetes.MilliCPUToCPU // we expect our estimates to be within 1 millicpu from the real ones expectedAccuracy = 1 ) func TestCPURequestCalculationAccuracy(t *testing.T) { for request := 0; request < maxCPU; request++ { - shares := MilliCPUToShares(request) - estimate := SharesToMilliCPU(shares) + shares := MilliCPUToShares(int64(request)) + estimate := SharesToMilliCPU(int64(shares)) diff := int64(request) - estimate if diff > expectedAccuracy || diff < -expectedAccuracy { @@ -403,7 +400,7 @@ func TestCPULimitCalculationAccuracy(t *testing.T) { if diff < 0 { diff = -diff } - if quota != kubecm.MinQuotaPeriod { + if quota != kubernetes.MinQuotaPeriod { t.Errorf("CPU limit %v: estimate %v, unexpected inaccuracy %v > %v", limit, estimate, diff, expectedAccuracy) } else { diff --git a/pkg/cri/resource-manager/cache/utils.go b/pkg/cri/resource-manager/cache/utils.go index 32ccc11b6..8a4bcb43c 100644 --- a/pkg/cri/resource-manager/cache/utils.go +++ b/pkg/cri/resource-manager/cache/utils.go @@ -15,7 +15,6 @@ package cache import ( - "io/ioutil" "os" "path" "strconv" @@ -25,12 +24,18 @@ import ( resapi "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/sets" criv1 "k8s.io/cri-api/pkg/apis/runtime/v1" - kubecm "k8s.io/kubernetes/pkg/kubelet/cm" "github.com/intel/cri-resource-manager/pkg/cgroups" + "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" ) -var memoryCapacity int64 +var ( + memoryCapacity int64 + SharesToMilliCPU = kubernetes.SharesToMilliCPU + QuotaToMilliCPU = kubernetes.QuotaToMilliCPU + MilliCPUToShares = kubernetes.MilliCPUToShares + MilliCPUToQuota = kubernetes.MilliCPUToQuota +) // IsPodQOSClassName returns true if the given class is one of the Pod QOS classes. func IsPodQOSClassName(class string) bool { @@ -84,52 +89,6 @@ func estimateComputeResources(lnx *criv1.LinuxContainerResources, cgroupParent s return resources } -// SharesToMilliCPU converts CFS CPU shares to milliCPU. -func SharesToMilliCPU(shares int64) int64 { - return sharesToMilliCPU(shares) -} - -// QuotaToMilliCPU converts CFS quota and period to milliCPU. -func QuotaToMilliCPU(quota, period int64) int64 { - return quotaToMilliCPU(quota, period) -} - -// sharesToMilliCPU converts CFS CPU shares to milliCPU. -func sharesToMilliCPU(shares int64) int64 { - if shares == kubecm.MinShares { - return 0 - } - return int64(float64(shares*kubecm.MilliCPUToCPU)/float64(kubecm.SharesPerCPU) + 0.5) -} - -// quotaToMilliCPU converts CFS quota and period to milliCPU. -func quotaToMilliCPU(quota, period int64) int64 { - if quota == 0 || period == 0 { - return 0 - } - return int64(float64(quota*kubecm.MilliCPUToCPU)/float64(period) + 0.5) -} - -// MilliCPUToShares converts milliCPU to CFS CPU shares. -func MilliCPUToShares(milliCPU int) int64 { - return int64(kubecm.MilliCPUToShares(int64(milliCPU))) -} - -// MilliCPUToQuota converts milliCPU to CFS quota and period values. -func MilliCPUToQuota(milliCPU int64) (int64, int64) { - if milliCPU == 0 { - return 0, 0 - } - - period := int64(kubecm.QuotaPeriod) - quota := (milliCPU * period) / kubecm.MilliCPUToCPU - if quota < kubecm.MinQuotaPeriod { - quota = kubecm.MinQuotaPeriod - } - - return quota, period -} - // getMemoryCapacity parses memory capacity from /proc/meminfo (mimicking cAdvisor). func getMemoryCapacity() int64 { var data []byte @@ -139,7 +98,7 @@ func getMemoryCapacity() int64 { return memoryCapacity } - if data, err = ioutil.ReadFile("/proc/meminfo"); err != nil { + if data, err = os.ReadFile("/proc/meminfo"); err != nil { return -1 } diff --git a/pkg/cri/resource-manager/control/blockio/blockio.go b/pkg/cri/resource-manager/control/blockio/blockio.go index cdb9ba514..0691ff1ca 100644 --- a/pkg/cri/resource-manager/control/blockio/blockio.go +++ b/pkg/cri/resource-manager/control/blockio/blockio.go @@ -15,10 +15,9 @@ package blockio import ( + "errors" "fmt" - "github.com/hashicorp/go-multierror" - "github.com/intel/cri-resource-manager/pkg/blockio" "github.com/intel/cri-resource-manager/pkg/config" "github.com/intel/cri-resource-manager/pkg/cri/client" @@ -162,7 +161,7 @@ func (ctl *blockioctl) configNotify(event config.Event, source config.Source) er // reconfigureRunningContainers force setting current blockio configuration to all containers running on the node func (ctl *blockioctl) reconfigureRunningContainers() error { - var errors *multierror.Error + errs := []error{} if ctl.cache == nil { return nil } @@ -171,10 +170,10 @@ func (ctl *blockioctl) reconfigureRunningContainers() error { log.Debug("%q: configure blockio class %q", c.PrettyName(), class) err := blockio.SetContainerClass(c, class) if err != nil { - errors = multierror.Append(errors, err) + errs = append(errs, err) } } - return errors.ErrorOrNil() + return errors.Join(errs...) } // blockioError creates a block I/O-controller-specific formatted error message. diff --git a/pkg/cri/resource-manager/control/cpu/cpu.go b/pkg/cri/resource-manager/control/cpu/cpu.go index 3e313036c..bd093f1dc 100644 --- a/pkg/cri/resource-manager/control/cpu/cpu.go +++ b/pkg/cri/resource-manager/control/cpu/cpu.go @@ -17,14 +17,13 @@ package cpu import ( "fmt" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - pkgcfg "github.com/intel/cri-resource-manager/pkg/config" "github.com/intel/cri-resource-manager/pkg/cri/client" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/control" logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/sysfs" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/intel/goresctrl/pkg/utils" ) @@ -155,7 +154,7 @@ func (ctl *cpuctl) enforceUncore(assignments cpuClassAssignments, affectedCPUs . return nil } - cpus := cpuset.NewCPUSet(affectedCPUs...) + cpus := cpuset.New(affectedCPUs...) for _, cpuPkgID := range ctl.system.PackageIDs() { cpuPkg := ctl.system.Package(cpuPkgID) @@ -164,7 +163,7 @@ func (ctl *cpuctl) enforceUncore(assignments cpuClassAssignments, affectedCPUs . // Check if this die is affected by the specified cpuset if cpus.Size() == 0 || dieCPUs.Intersection(cpus).Size() > 0 { - min, max, minCls, maxCls := effectiveUncoreFreqs(utils.NewIDSet(dieCPUs.ToSlice()...), ctl.config.Classes, assignments) + min, max, minCls, maxCls := effectiveUncoreFreqs(utils.NewIDSet(dieCPUs.List()...), ctl.config.Classes, assignments) if min == 0 && max == 0 { log.Debug("no uncore frequency limits for cpu package/die %d/%d", cpuPkgID, cpuDieID) diff --git a/pkg/cri/resource-manager/control/page-migrate/demoter.go b/pkg/cri/resource-manager/control/page-migrate/demoter.go index 09ed54601..6a6c93cf0 100644 --- a/pkg/cri/resource-manager/control/page-migrate/demoter.go +++ b/pkg/cri/resource-manager/control/page-migrate/demoter.go @@ -18,7 +18,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "math/rand" "os" "strconv" @@ -243,7 +242,7 @@ func (d *demoter) startDirtyBitResetTimer() { func resetDirtyBit(pid string) error { // Write magic value "4" to the clear_refs file. This resets the dirty bit. path := "/proc/" + pid + "/clear_refs" - err := ioutil.WriteFile(path, []byte("4"), 0600) + err := os.WriteFile(path, []byte("4"), 0600) return err } @@ -328,16 +327,16 @@ func (d *demoter) getPagesForContainer(c *container, sourceNodes idset.IDSet) (p pidNumber := int(pidNumber64) // Read /proc/pid/numa_maps and /proc/pid/maps numaMapsPath := "/proc/" + pid + "/numa_maps" - numaMapsBytes, err := ioutil.ReadFile(numaMapsPath) + numaMapsBytes, err := os.ReadFile(numaMapsPath) if err != nil { log.Error("Could not read numa_maps: %v", err) continue } mapsPath := "/proc/" + pid + "/maps" - mapsBytes, err := ioutil.ReadFile(mapsPath) + mapsBytes, err := os.ReadFile(mapsPath) if err != nil { log.Error("Could not read maps: %v\n", err) - os.Exit(1) + continue } mapsLines := strings.Split(string(mapsBytes), "\n") diff --git a/pkg/cri/resource-manager/kubernetes/kubernetes.go b/pkg/cri/resource-manager/kubernetes/kubernetes.go index acc2d7960..c389b5695 100644 --- a/pkg/cri/resource-manager/kubernetes/kubernetes.go +++ b/pkg/cri/resource-manager/kubernetes/kubernetes.go @@ -16,21 +16,18 @@ limitations under the License. package kubernetes -import ( - core "k8s.io/kubernetes/pkg/apis/core" - kubelet "k8s.io/kubernetes/pkg/kubelet/types" -) - const ( // ResmgrKeyNamespace is a CRI Resource Manager namespace ResmgrKeyNamespace = "cri-resource-manager.intel.com" // NamespaceSystem is the kubernetes system namespace. - NamespaceSystem = core.NamespaceSystem - // PodNameLabel is the label key for the kubernetes pod name. - PodNameLabel = kubelet.KubernetesPodNameLabel - // ContainerNameLabel is the label key for the kubernetes container name. - ContainerNameLabel = kubelet.KubernetesContainerNameLabel + NamespaceSystem = "kube-system" + // PodNameLabel is the key for the kubernetes pod name label. + PodNameLabel = "io.kubernetes.pod.name" + // PodNameLabel is the key for the kubernetes pod UID label. + PodUIDLabel = "io.kubernetes.pod.uid" + // ContainerNameLabel is the key for the kubernetes container name label. + ContainerNameLabel = "io.kubernetes.container.name" ) // ResmgrKey returns a full namespaced name of a resource manager specific key diff --git a/pkg/cri/resource-manager/kubernetes/resources.go b/pkg/cri/resource-manager/kubernetes/resources.go new file mode 100644 index 000000000..c97f2bc25 --- /dev/null +++ b/pkg/cri/resource-manager/kubernetes/resources.go @@ -0,0 +1,84 @@ +// Copyright The NRI Plugins Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package kubernetes + +const ( + // Constants for converting back and forth between CPU requirements in + // terms of milli-CPUs and kernel cgroup/scheduling parameters. + + // MinShares is the minimum cpu.shares accepted by cgroups. + MinShares = 2 + // MaxShares is the minimum cpu.shares accepted by cgroups. + MaxShares = 262144 + // SharesPerCPU is cpu.shares worth one full CPU. + SharesPerCPU = 1024 + // MilliCPUToCPU is milli-CPUs worth a full CPU. + MilliCPUToCPU = 1000 + // QuotaPeriod is 100000 microseconds, or 100ms + QuotaPeriod = 100000 + // MinQuotaPeriod is 1000 microseconds, or 1ms + MinQuotaPeriod = 1000 +) + +// MilliCPUToQuota converts milliCPU to CFS quota and period values. +// (Almost) identical to the same function in kubelet. +func MilliCPUToQuota(milliCPU int64) (quota, period int64) { + if milliCPU == 0 { + return 0, 0 + } + + // TODO(klihub): this is behind the CPUSFSQuotaPerdiod feature gate in kubelet + period = int64(QuotaPeriod) + + quota = (milliCPU * period) / MilliCPUToCPU + + if quota < MinQuotaPeriod { + quota = MinQuotaPeriod + } + + return quota, period +} + +// MilliCPUToShares converts the milliCPU to CFS shares. +// Identical to the same function in kubelet. +func MilliCPUToShares(milliCPU int64) uint64 { + if milliCPU == 0 { + return MinShares + } + shares := (milliCPU * SharesPerCPU) / MilliCPUToCPU + if shares < MinShares { + return MinShares + } + if shares > MaxShares { + return MaxShares + } + return uint64(shares) +} + +// SharesToMilliCPU converts CFS CPU shares to milli-CPUs. +func SharesToMilliCPU(shares int64) int64 { + if shares == MinShares { + return 0 + } + return int64(float64(shares*MilliCPUToCPU)/float64(SharesPerCPU) + 0.5) +} + +// QuotaToMilliCPU converts CFS quota and period to milli-CPUs. +func QuotaToMilliCPU(quota, period int64) int64 { + if quota == 0 || period == 0 { + return 0 + } + return int64(float64(quota*MilliCPUToCPU)/float64(period) + 0.5) +} diff --git a/pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy.go b/pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy.go index 533058054..5333f3250 100644 --- a/pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy.go @@ -21,7 +21,6 @@ import ( corev1 "k8s.io/api/core/v1" resapi "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" pkgcfg "github.com/intel/cri-resource-manager/pkg/config" "github.com/intel/cri-resource-manager/pkg/cpuallocator" @@ -34,6 +33,7 @@ import ( policyapi "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/utils" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -159,7 +159,7 @@ func CreateBalloonsPolicy(policyOptions *policy.BackendOptions) policy.Backend { p.allowed = policyOptions.System.CPUSet().Difference(policyOptions.System.Offlined()) } // p.reserved: CPUs reserved for kube-system pods, subset of p.allowed. - p.reserved = cpuset.NewCPUSet() + p.reserved = cpuset.New() if reserved, ok := p.options.Reserved[policyapi.DomainCPU]; ok { switch v := reserved.(type) { case cpuset.CPUSet: @@ -484,7 +484,7 @@ func (p *balloons) resetCpuClass() error { // containers on the balloon, including the reserved balloon. // // TODO: don't depend on cpu controller directly - cpucontrol.Assign(p.cch, p.bpoptions.IdleCpuClass, p.allowed.ToSliceNoSort()...) + cpucontrol.Assign(p.cch, p.bpoptions.IdleCpuClass, p.allowed.UnsortedList()...) log.Debugf("resetCpuClass available: %s; reserved: %s", p.allowed, p.reserved) return nil } @@ -509,7 +509,7 @@ func (p *balloons) useCpuClass(bln *Balloon) error { // - User-defined CPU AllocatorPriority: bln.Def.AllocatorPriority. // - All existing balloon instances: p.balloons. // - CPU configurations by user: bln.Def.CpuClass (for bln in p.balloons) - cpucontrol.Assign(p.cch, bln.Def.CpuClass, bln.Cpus.ToSliceNoSort()...) + cpucontrol.Assign(p.cch, bln.Def.CpuClass, bln.Cpus.UnsortedList()...) log.Debugf("useCpuClass Cpus: %s; CpuClass: %s", bln.Cpus, bln.Def.CpuClass) return nil } @@ -518,7 +518,7 @@ func (p *balloons) useCpuClass(bln *Balloon) error { func (p *balloons) forgetCpuClass(bln *Balloon) { // Use p.IdleCpuClass for bln.Cpus. // Usual inputs: see useCpuClass - cpucontrol.Assign(p.cch, p.bpoptions.IdleCpuClass, bln.Cpus.ToSliceNoSort()...) + cpucontrol.Assign(p.cch, p.bpoptions.IdleCpuClass, bln.Cpus.UnsortedList()...) log.Debugf("forgetCpuClass Cpus: %s; CpuClass: %s", bln.Cpus, bln.Def.CpuClass) } @@ -551,7 +551,7 @@ func (p *balloons) newBalloon(blnDef *BalloonDef, confCpus bool) (*Balloon, erro // So does the default balloon unless its CPU counts are tweaked. cpus = p.reserved } else { - addFromCpus, _, err := p.cpuTreeAllocator.ResizeCpus(cpuset.NewCPUSet(), p.freeCpus, blnDef.MinCpus) + addFromCpus, _, err := p.cpuTreeAllocator.ResizeCpus(cpuset.New(), p.freeCpus, blnDef.MinCpus) if err != nil { return nil, balloonsError("failed to choose a cpuset for allocating first %d CPUs from %#s", blnDef.MinCpus, p.freeCpus) } @@ -566,7 +566,7 @@ func (p *balloons) newBalloon(blnDef *BalloonDef, confCpus bool) (*Balloon, erro Instance: freeInstance, PodIDs: make(map[string][]string), Cpus: cpus, - SharedIdleCpus: cpuset.NewCPUSet(), + SharedIdleCpus: cpuset.New(), Mems: p.closestMems(cpus), } if confCpus { @@ -1086,7 +1086,7 @@ func (p *balloons) setConfig(bpoptions *BalloonsOptions) error { } // No errors in balloon creation, take new configuration into use. p.bpoptions = *bpoptions - p.updatePinning(p.shareIdleCpus(p.freeCpus, cpuset.NewCPUSet())...) + p.updatePinning(p.shareIdleCpus(p.freeCpus, cpuset.New())...) // (Re)configures all CPUs in balloons. p.resetCpuClass() for _, bln := range p.balloons { @@ -1179,7 +1179,7 @@ func (p *balloons) resizeBalloon(bln *Balloon, newMilliCpus int) error { log.Debugf("- old freeCpus: %#s, old bln.Cpus: %#s, releasing: %#s", p.freeCpus, bln.Cpus, removeFromCpus) p.freeCpus = p.freeCpus.Union(removeFromCpus) bln.Cpus = bln.Cpus.Difference(removeFromCpus) - p.updatePinning(p.shareIdleCpus(removeFromCpus, cpuset.NewCPUSet())...) + p.updatePinning(p.shareIdleCpus(removeFromCpus, cpuset.New())...) } log.Debugf("- resize successful: %s, freecpus: %#s", bln, p.freeCpus) p.updatePinning(bln) @@ -1217,7 +1217,7 @@ func (p *balloons) shareIdleCpus(addCpus, removeCpus cpuset.CPUSet) []*Balloon { if topoLevel == CPUTopologyLevelUndefined { continue } - idleCpusInTopoLevel := cpuset.NewCPUSet() + idleCpusInTopoLevel := cpuset.New() p.cpuTree.DepthFirstWalk(func(t *cpuTreeNode) error { // Dive in correct topology level. if t.level != topoLevel { @@ -1278,7 +1278,7 @@ func (p *balloons) pinCpuMem(c cache.Container, cpus cpuset.CPUSet, mems idset.I c.SetCpusetCpus(cpus.String()) if reqCpu, ok := c.GetResourceRequirements().Requests[corev1.ResourceCPU]; ok { mCpu := int(reqCpu.MilliValue()) - c.SetCPUShares(int64(cache.MilliCPUToShares(mCpu))) + c.SetCPUShares(int64(cache.MilliCPUToShares(int64(mCpu)))) } } if p.bpoptions.PinMemory == nil || *p.bpoptions.PinMemory { diff --git a/pkg/cri/resource-manager/policy/builtin/balloons/cputree.go b/pkg/cri/resource-manager/policy/builtin/balloons/cputree.go index a41be26e6..5f029ad58 100644 --- a/pkg/cri/resource-manager/policy/builtin/balloons/cputree.go +++ b/pkg/cri/resource-manager/policy/builtin/balloons/cputree.go @@ -22,7 +22,7 @@ import ( "strings" system "github.com/intel/cri-resource-manager/pkg/sysfs" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) type CPUTopologyLevel int @@ -142,7 +142,7 @@ func (tna cpuTreeNodeAttributes) String() string { func NewCpuTree(name string) *cpuTreeNode { return &cpuTreeNode{ name: name, - cpus: cpuset.NewCPUSet(), + cpus: cpuset.New(), } } @@ -236,17 +236,17 @@ func NewCpuTreeFromSystem() (*cpuTreeNode, error) { nodeTree.level = CPUTopologyLevelNuma dieTree.AddChild(nodeTree) node := sys.Node(nodeID) - for _, cpuID := range node.CPUSet().ToSlice() { + for _, cpuID := range node.CPUSet().List() { cpuTree := NewCpuTree(fmt.Sprintf("p%dd%dn%dcpu%d", packageID, dieID, nodeID, cpuID)) cpuTree.level = CPUTopologyLevelCore nodeTree.AddChild(cpuTree) cpu := sys.CPU(cpuID) - for _, threadID := range cpu.ThreadCPUSet().ToSlice() { + for _, threadID := range cpu.ThreadCPUSet().List() { threadTree := NewCpuTree(fmt.Sprintf("p%dd%dn%dcpu%dt%d", packageID, dieID, nodeID, cpuID, threadID)) threadTree.level = CPUTopologyLevelThread cpuTree.AddChild(threadTree) - threadTree.AddCpus(cpuset.NewCPUSet(threadID)) + threadTree.AddCpus(cpuset.New(threadID)) } } } @@ -414,8 +414,8 @@ func (ta *cpuTreeAllocator) ResizeCpus(currentCpus, freeCpus cpuset.CPUSet, delt // In multi-CPU removal, remove CPUs one by one instead of // trying to find a single topology element from which all of // them could be removed. - removeFrom := cpuset.NewCPUSet() - addFrom := cpuset.NewCPUSet() + removeFrom := cpuset.New() + addFrom := cpuset.New() for n := 0; n < -delta; n++ { _, removeSingleFrom, err := ta.resizeCpus(currentCpus, freeCpus, -1) if err != nil { diff --git a/pkg/cri/resource-manager/policy/builtin/balloons/cputree_test.go b/pkg/cri/resource-manager/policy/builtin/balloons/cputree_test.go index 762a02b68..05acd0cec 100644 --- a/pkg/cri/resource-manager/policy/builtin/balloons/cputree_test.go +++ b/pkg/cri/resource-manager/policy/builtin/balloons/cputree_test.go @@ -20,7 +20,7 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) type cpuInTopology struct { @@ -95,7 +95,7 @@ func newCpuTreeFromInt5(pdnct [5]int) (*cpuTreeNode, cpusInTopology) { threadTree := NewCpuTree(fmt.Sprintf("p%dd%dn%dc%02dt%d", packageID, dieID, numaID, coreID, threadID)) threadTree.level = CPUTopologyLevelThread coreTree.AddChild(threadTree) - threadTree.AddCpus(cpuset.NewCPUSet(cpuID)) + threadTree.AddCpus(cpuset.New(cpuID)) csit[cpuID] = cpuInTopology{ packageID, dieID, numaID, coreID, threadID, cpuID, packageTree.name, dieTree.name, numaTree.name, coreTree.name, threadTree.name, @@ -111,7 +111,7 @@ func newCpuTreeFromInt5(pdnct [5]int) (*cpuTreeNode, cpusInTopology) { } func verifyNotOn(t *testing.T, nameContents string, cpus cpuset.CPUSet, csit cpusInTopology) { - for _, cpuID := range cpus.ToSlice() { + for _, cpuID := range cpus.List() { name := csit[cpuID].threadName if strings.Contains(name, nameContents) { t.Errorf("cpu%d (%s) in unexpected region %s", cpuID, name, nameContents) @@ -122,7 +122,7 @@ func verifyNotOn(t *testing.T, nameContents string, cpus cpuset.CPUSet, csit cpu func verifySame(t *testing.T, topoLevel string, cpus cpuset.CPUSet, csit cpusInTopology) { seenName := "" seenCpuID := -1 - for _, cpuID := range cpus.ToSlice() { + for _, cpuID := range cpus.List() { cit := csit[cpuID] thisName := cit.TopoName(topoLevel) thisCpuID := cit.cpuID @@ -144,7 +144,7 @@ func verifySame(t *testing.T, topoLevel string, cpus cpuset.CPUSet, csit cpusInT func (csit cpusInTopology) getElements(topoLevel string, cpus cpuset.CPUSet) []string { elts := []string{} - for _, cpuID := range cpus.ToSlice() { + for _, cpuID := range cpus.List() { elts = append(elts, csit[cpuID].TopoName(topoLevel)) } return elts @@ -418,11 +418,11 @@ func TestResizeCpus(t *testing.T) { treeA := tree.NewAllocator(cpuTreeAllocatorOptions{ topologyBalancing: tc.allocatorTB, }) - currentCpus := cpuset.NewCPUSet() + currentCpus := cpuset.New() freeCpus := tree.Cpus() if len(tc.allocations) > 0 { - currentCpus = currentCpus.Union(cpuset.NewCPUSet(tc.allocations...)) - freeCpus = freeCpus.Difference(cpuset.NewCPUSet(tc.allocations...)) + currentCpus = currentCpus.Union(cpuset.New(tc.allocations...)) + freeCpus = freeCpus.Difference(cpuset.New(tc.allocations...)) } ccidCurrentCpus := map[int]cpuset.CPUSet{0: currentCpus} allocs := map[string]cpuset.CPUSet{"--:allo": currentCpus} @@ -452,26 +452,26 @@ func TestResizeCpus(t *testing.T) { } if tc.allocate { allocName := fmt.Sprintf("%02d:allo", i+1) - allocs[allocName] = cpuset.NewCPUSet() + allocs[allocName] = cpuset.New() - for n, cpuID := range addFrom.ToSlice() { + for n, cpuID := range addFrom.List() { if n >= delta { break } - freeCpus = freeCpus.Difference(cpuset.NewCPUSet(cpuID)) - currentCpus = currentCpus.Union(cpuset.NewCPUSet(cpuID)) - allocs[allocName] = allocs[allocName].Union(cpuset.NewCPUSet(cpuID)) + freeCpus = freeCpus.Difference(cpuset.New(cpuID)) + currentCpus = currentCpus.Union(cpuset.New(cpuID)) + allocs[allocName] = allocs[allocName].Union(cpuset.New(cpuID)) } allocName = fmt.Sprintf("%02d:free", i+1) - for n, cpuID := range removeFrom.ToSlice() { + for n, cpuID := range removeFrom.List() { if n >= -delta { break } - freeCpus = freeCpus.Union(cpuset.NewCPUSet(cpuID)) + freeCpus = freeCpus.Union(cpuset.New(cpuID)) if i < len(tc.operateOnCcid) && tc.operateOnCcid[i] > 0 { - currentCpus = currentCpus.Difference(cpuset.NewCPUSet(cpuID)) + currentCpus = currentCpus.Difference(cpuset.New(cpuID)) } - allocs[allocName] = allocs[allocName].Union(cpuset.NewCPUSet(cpuID)) + allocs[allocName] = allocs[allocName].Union(cpuset.New(cpuID)) } if i < len(tc.operateOnCcid) && tc.operateOnCcid[i] > 0 { ccidCurrentCpus[tc.operateOnCcid[i]] = currentCpus @@ -486,7 +486,7 @@ func TestResizeCpus(t *testing.T) { verifyNotOn(t, tc.expectCurrentNotOn[i], currentCpus, csit) } if i < len(tc.expectAllOnSame) && tc.expectAllOnSame[i] != "" { - allCpus := cpuset.NewCPUSet() + allCpus := cpuset.New() for _, cpus := range ccidCurrentCpus { allCpus = allCpus.Union(cpus) } @@ -580,7 +580,7 @@ func TestWalk(t *testing.T) { func TestCpuLocations(t *testing.T) { tree, _ := newCpuTreeFromInt5([5]int{2, 2, 2, 4, 2}) - cpus := cpuset.NewCPUSet(0, 1, 3, 4, 16) + cpus := cpuset.New(0, 1, 3, 4, 16) systemlocations := tree.CpuLocations(cpus) package1locations := tree.children[1].CpuLocations(cpus) if len(package1locations) != 5 { diff --git a/pkg/cri/resource-manager/policy/builtin/balloons/metrics.go b/pkg/cri/resource-manager/policy/builtin/balloons/metrics.go index 93ed3f086..fecf72935 100644 --- a/pkg/cri/resource-manager/policy/builtin/balloons/metrics.go +++ b/pkg/cri/resource-manager/policy/builtin/balloons/metrics.go @@ -20,8 +20,8 @@ import ( "strings" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/prometheus/client_golang/prometheus" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) // Prometheus Metric descriptor indices and descriptor table diff --git a/pkg/cri/resource-manager/policy/builtin/podpools/metrics.go b/pkg/cri/resource-manager/policy/builtin/podpools/metrics.go index 38f65d7f5..bbf8b8ff3 100644 --- a/pkg/cri/resource-manager/policy/builtin/podpools/metrics.go +++ b/pkg/cri/resource-manager/policy/builtin/podpools/metrics.go @@ -22,8 +22,8 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" "github.com/intel/cri-resource-manager/pkg/procstats" "github.com/intel/cri-resource-manager/pkg/sysfs" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/prometheus/client_golang/prometheus" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) // Metrics defines the podpools-specific metrics from policy level. @@ -94,7 +94,7 @@ func (p *podpools) PollMetrics() policy.Metrics { policyMetrics.PoolMetrics[pool.PrettyName()].DefName = pool.Def.Name policyMetrics.PoolMetrics[pool.PrettyName()].PrettyName = pool.PrettyName() policyMetrics.PoolMetrics[pool.PrettyName()].CPUs = pool.CPUs - policyMetrics.PoolMetrics[pool.PrettyName()].CPUIds = pool.CPUs.ToSlice() + policyMetrics.PoolMetrics[pool.PrettyName()].CPUIds = pool.CPUs.List() policyMetrics.PoolMetrics[pool.PrettyName()].MilliCPUs = strconv.Itoa(pool.CPUs.Size() * 1000) policyMetrics.PoolMetrics[pool.PrettyName()].Memory = pool.Mems.String() policyMetrics.PoolMetrics[pool.PrettyName()].ContainerNames = "" @@ -178,7 +178,7 @@ func updateCPUUsageMetrics() ([]prometheus.Metric, error) { } onlined := sys.CPUSet().Difference(sys.Offlined()) onlinedUsage := make([]prometheus.Metric, onlined.Size()) - for i, j := range onlined.ToSlice() { + for i, j := range onlined.List() { onlinedUsage[i] = prometheus.MustNewConstMetric( descriptors[cpuUsageDesc], prometheus.GaugeValue, @@ -220,7 +220,7 @@ func updatePoolCPUUsageMetrics(ppm *Metrics) ([]prometheus.Metric, error) { return nil, err } poolCPUOnlined := ppm.PoolMetrics[poolName].CPUs.Difference(sys.Offlined()) - poolCPUUsageList[poolName] = (1.0 - float64(poolDeltaIdleTime)/float64(poolDeltaTotalTime)) * 100.0 * float64(len(poolCPUOnlined.ToSlice())) + poolCPUUsageList[poolName] = (1.0 - float64(poolDeltaIdleTime)/float64(poolDeltaTotalTime)) * 100.0 * float64(len(poolCPUOnlined.List())) } poolCPUUsageMetrics[index] = prometheus.MustNewConstMetric( descriptors[poolCPUUsageDesc], diff --git a/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy.go b/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy.go index c7da37b33..2a78ced69 100644 --- a/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy.go @@ -22,7 +22,6 @@ import ( corev1 "k8s.io/api/core/v1" resapi "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" pkgcfg "github.com/intel/cri-resource-manager/pkg/config" "github.com/intel/cri-resource-manager/pkg/cpuallocator" @@ -34,6 +33,7 @@ import ( policyapi "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/utils" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -136,7 +136,7 @@ func CreatePodpoolsPolicy(policyOptions *policy.BackendOptions) policy.Backend { p.allowed = policyOptions.System.CPUSet().Difference(policyOptions.System.Offlined()) } // p.reserved: CPUs reserved for kube-system pods, subset of p.allowed. - p.reserved = cpuset.NewCPUSet() + p.reserved = cpuset.New() if reserved, ok := p.options.Reserved[policyapi.DomainCPU]; ok { switch v := reserved.(type) { case cpuset.CPUSet: @@ -731,7 +731,7 @@ func (p *podpools) pinCpuMem(c cache.Container, cpus cpuset.CPUSet, mems idset.I c.SetCpusetCpus(cpus.String()) if reqCpu, ok := c.GetResourceRequirements().Requests[corev1.ResourceCPU]; ok { mCpu := int(reqCpu.MilliValue()) - c.SetCPUShares(int64(cache.MilliCPUToShares(mCpu))) + c.SetCPUShares(int64(cache.MilliCPUToShares(int64(mCpu)))) } } if p.ppoptions.PinMemory { diff --git a/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy_test.go b/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy_test.go index 912ef2d09..bc3cc88de 100644 --- a/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy_test.go +++ b/pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy_test.go @@ -19,9 +19,8 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - "github.com/intel/cri-resource-manager/pkg/cpuallocator" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) func validateError(t *testing.T, expectedError string, err error) bool { @@ -65,18 +64,18 @@ type mockCpuAllocator struct{} func (mca *mockCpuAllocator) AllocateCpus(from *cpuset.CPUSet, cnt int, dontcare cpuallocator.CPUPriority) (cpuset.CPUSet, error) { switch { case from.Size() < cnt: - return cpuset.NewCPUSet(), fmt.Errorf("cpuset %s does not have %d CPUs", from, cnt) + return cpuset.New(), fmt.Errorf("cpuset %s does not have %d CPUs", from, cnt) case from.Size() == cnt: result := from.Clone() - *from = cpuset.NewCPUSet() + *from = cpuset.New() return result, nil default: - result := cpuset.NewCPUSet() - for _, cpu := range from.ToSlice() { + result := cpuset.New() + for _, cpu := range from.List() { if result.Size() >= cnt { break } - result = result.Union(cpuset.NewCPUSet(cpu)) + result = result.Union(cpuset.New(cpu)) } *from = from.Difference(result) return result, nil @@ -84,7 +83,7 @@ func (mca *mockCpuAllocator) AllocateCpus(from *cpuset.CPUSet, cnt int, dontcare } func (mca *mockCpuAllocator) ReleaseCpus(*cpuset.CPUSet, int, cpuallocator.CPUPriority) (cpuset.CPUSet, error) { - return cpuset.NewCPUSet(), nil + return cpuset.New(), nil } func TestApplyPoolDef(t *testing.T) { @@ -393,7 +392,7 @@ func TestApplyPoolDef(t *testing.T) { copyOfPool := (*tc.pools)[i] pools = append(pools, ©OfPool) } - freeCpus := cpuset.NewCPUSet() + freeCpus := cpuset.New() if tc.freeCpus != "" { freeCpus = cpuset.MustParse(tc.freeCpus) } @@ -404,7 +403,7 @@ func TestApplyPoolDef(t *testing.T) { if ok := validateError(t, tc.expectedError, err); ok { // check freeCpus modified by applyPoolDef if tc.expectedFreeCpus != "" { - expectedFreeCpus := cpuset.NewCPUSet() + expectedFreeCpus := cpuset.New() if tc.expectedFreeCpus != "-" { expectedFreeCpus = cpuset.MustParse(tc.expectedFreeCpus) } diff --git a/pkg/cri/resource-manager/policy/builtin/static-plus/static-plus-policy.go b/pkg/cri/resource-manager/policy/builtin/static-plus/static-plus-policy.go index f9f0615ca..2a3f16be0 100644 --- a/pkg/cri/resource-manager/policy/builtin/static-plus/static-plus-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/static-plus/static-plus-policy.go @@ -22,7 +22,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/prometheus/client_golang/prometheus" @@ -33,6 +32,7 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/introspect" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" "github.com/intel/cri-resource-manager/pkg/sysfs" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) const ( @@ -291,7 +291,7 @@ func (p *staticplus) setupPools(available, reserved policy.ConstraintSet) error qty := cpus.(resource.Quantity) count := (int(qty.MilliValue()) + 999) / 1000 if count < 2 && p.available.Contains(0) { - p.reserved = cpuset.NewCPUSet(0) + p.reserved = cpuset.New(0) p.available = p.available.Difference(p.reserved) } else { p.reserved, err = p.takeCPUs(&p.available, nil, count, cpuallocator.PriorityNormal) diff --git a/pkg/cri/resource-manager/policy/builtin/static-pools/config.go b/pkg/cri/resource-manager/policy/builtin/static-pools/config.go index d26e843ec..0fafe0dc5 100644 --- a/pkg/cri/resource-manager/policy/builtin/static-pools/config.go +++ b/pkg/cri/resource-manager/policy/builtin/static-pools/config.go @@ -18,7 +18,7 @@ package stp import ( "fmt" - "io/ioutil" + "os" "path" "regexp" "strconv" @@ -124,7 +124,7 @@ func parseConfData(raw []byte) (pools, error) { func readConfFile(filepath string) (pools, error) { // Read config data - data, err := ioutil.ReadFile(filepath) + data, err := os.ReadFile(filepath) if err != nil { return nil, stpError("Failed to read config file: %v", err) } @@ -137,7 +137,7 @@ func readConfDir(confDir string) (pools, error) { // List pools in the pools configuration directory poolsDir := path.Join(confDir, "pools") - pools, err := ioutil.ReadDir(poolsDir) + pools, err := os.ReadDir(poolsDir) if err != nil { return nil, stpError("Failed to list pools config directory %s: %v", poolsDir, err) } @@ -159,7 +159,7 @@ func readPoolConfDir(poolDir string) (poolConfig, error) { conf := poolConfig{Exclusive: false, CPULists: []*cpuList{}} // Read pool's exclusivity flag - exclusive, err := ioutil.ReadFile(path.Join(poolDir, "exclusive")) + exclusive, err := os.ReadFile(path.Join(poolDir, "exclusive")) if err != nil { return conf, fmt.Errorf("Failed to read pool exclusive setting in %s: %v", poolDir, err) } @@ -168,7 +168,7 @@ func readPoolConfDir(poolDir string) (poolConfig, error) { } // Read socket configurations (per-socket cpu lists) - files, err := ioutil.ReadDir(poolDir) + files, err := os.ReadDir(poolDir) if err != nil { return conf, fmt.Errorf("Failed to list pool config directory %s: %v", poolDir, err) } @@ -199,7 +199,7 @@ func readSocketConfDir(socketDir string) ([]*cpuList, error) { } // Socket directory contains a set of subdirectories, one per cpu list - cpuListDirs, err := ioutil.ReadDir(socketDir) + cpuListDirs, err := os.ReadDir(socketDir) if err != nil { return nil, fmt.Errorf("Failed to list socket directory %s: %v", socketDir, err) } diff --git a/pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy.go b/pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy.go index d05afa5d0..2cbe7ae79 100644 --- a/pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy.go @@ -17,7 +17,7 @@ package stp import ( "flag" "fmt" - "io/ioutil" + "io" "math/rand" "strconv" "strings" @@ -422,7 +422,7 @@ func parseCmkCmdline(args []string) *cmkLegacyArgs { // Create parser cmkCmd := flag.NewFlagSet("cmk-legacy", flag.ContinueOnError) - cmkCmd.SetOutput(ioutil.Discard) + cmkCmd.SetOutput(io.Discard) cmkCmd.StringVar(&parsedArgs.Pool, "pool", "", "pool to use") cmkCmd.Int64Var(&parsedArgs.SocketID, "socket-id", -1, "socket id to use") cmkCmd.BoolVar(&parsedArgs.NoAffinity, "no-affinity", false, "Do not set cpu affinity before forking the child command") diff --git a/pkg/cri/resource-manager/policy/builtin/static/static-policy.go b/pkg/cri/resource-manager/policy/builtin/static/static-policy.go index 880b79087..dc0de9ef2 100644 --- a/pkg/cri/resource-manager/policy/builtin/static/static-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/static/static-policy.go @@ -20,7 +20,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "github.com/intel/cri-resource-manager/pkg/config" logger "github.com/intel/cri-resource-manager/pkg/log" @@ -33,6 +32,7 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" "github.com/intel/cri-resource-manager/pkg/sysfs" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -335,7 +335,7 @@ func (s *static) allocateOrdinaryCPUs(numCPUs int) (cpuset.CPUSet, error) { result, err := s.takeByTopology(assignable, numCPUs, cpuallocator.PriorityHigh) if err != nil { - return cpuset.NewCPUSet(), err + return cpuset.New(), err } s.Info("allocated %d ordinary CPUs: %s", numCPUs, result.String()) diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/cache.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/cache.go index bfa60d790..859ea8f68 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/cache.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/cache.go @@ -18,9 +18,8 @@ import ( "encoding/json" "time" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/cache_test.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/cache_test.go index 412646987..2ba6abb67 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/cache_test.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/cache_test.go @@ -18,7 +18,7 @@ import ( "bytes" "testing" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) func TestToGrant(t *testing.T) { @@ -104,8 +104,8 @@ func TestAllocationMarshalling(t *testing.T) { node: node{ name: "testnode", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(0, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(0, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(0, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(0, 0, 0), createMemoryMap(0, 0, 0)), }, }, }, diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/hint.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/hint.go index db8d300a2..fdf9c868b 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/hint.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/hint.go @@ -20,8 +20,8 @@ import ( system "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) // Calculate the hint score of the given hint and CPUSet. diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/hint_test.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/hint_test.go index 07fda0ba3..b667e3a79 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/hint_test.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/hint_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) func TestCpuHintScore(t *testing.T) { @@ -51,7 +51,7 @@ func TestCpuHintScore(t *testing.T) { hint: topology.Hint{ CPUs: "1,2", }, - cpus: cpuset.NewCPUSet(1), + cpus: cpuset.New(1), expected: 0.5, }, } @@ -198,7 +198,7 @@ func TestHintCpus(t *testing.T) { hint: topology.Hint{ CPUs: "1", }, - expected: cpuset.NewCPUSet(1), + expected: cpuset.New(1), }, } for _, tc := range tcases { diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/mocks_test.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/mocks_test.go index 191b6ba1e..674f46f41 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/mocks_test.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/mocks_test.go @@ -23,11 +23,11 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/config" system "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/intel/goresctrl/pkg/sst" idset "github.com/intel/goresctrl/pkg/utils" v1 "k8s.io/api/core/v1" criv1 "k8s.io/cri-api/pkg/apis/runtime/v1" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) type mockSystemNode struct { @@ -63,7 +63,7 @@ func (fake *mockSystemNode) HasNormalMemory() bool { } func (fake *mockSystemNode) CPUSet() cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (fake *mockSystemNode) Distance() []int { @@ -85,7 +85,7 @@ func (p *mockCPUPackage) ID() idset.ID { } func (p *mockCPUPackage) CPUSet() cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (p *mockCPUPackage) NodeIDs() []idset.ID { @@ -97,7 +97,7 @@ func (p *mockCPUPackage) DieIDs() []idset.ID { } func (p *mockCPUPackage) DieCPUSet(idset.ID) cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (p *mockCPUPackage) DieNodeIDs(idset.ID) []idset.ID { @@ -138,7 +138,7 @@ func (c *mockCPU) CoreID() idset.ID { return c.id } func (c *mockCPU) ThreadCPUSet() cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (c *mockCPU) FrequencyRange() system.CPUFreq { return system.CPUFreq{} @@ -190,17 +190,17 @@ func (fake *mockSystem) Package(idset.ID) system.CPUPackage { return &mockCPUPackage{} } func (fake *mockSystem) Offlined() cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (fake *mockSystem) Isolated() cpuset.CPUSet { if fake.isolatedCPU > 0 { - return cpuset.NewCPUSet(fake.isolatedCPU) + return cpuset.New(fake.isolatedCPU) } - return cpuset.NewCPUSet() + return cpuset.New() } func (fake *mockSystem) CPUSet() cpuset.CPUSet { - return cpuset.NewCPUSet() + return cpuset.New() } func (fake *mockSystem) CPUIDs() []idset.ID { return []idset.ID{} diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/node.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/node.go index 25c23414f..c700c989b 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/node.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/node.go @@ -19,10 +19,8 @@ import ( system "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - - "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" ) // @@ -396,7 +394,7 @@ func (n *node) discoverSupply(assignedNUMANodes []idset.ID) Supply { n.Name()) } - n.noderes = newSupply(n, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, nil, nil) + n.noderes = newSupply(n, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, nil, nil) for _, c := range n.children { supply := c.GetSupply() n.noderes.Cumulate(supply) @@ -410,7 +408,7 @@ func (n *node) discoverSupply(assignedNUMANodes []idset.ID) Supply { log.Debug("%s: discovering attached/assigned resources...", n.Name()) mmap := createMemoryMap(0, 0, 0) - cpus := cpuset.NewCPUSet() + cpus := cpuset.New() for _, nodeID := range assignedNUMANodes { node := n.System().Node(nodeID) @@ -425,7 +423,7 @@ func (n *node) discoverSupply(assignedNUMANodes []idset.ID) Supply { case system.MemoryTypeDRAM: n.mem.Add(nodeID) mmap.AddDRAM(meminfo.MemTotal) - shortCPUs := kubernetes.ShortCPUSet(nodeCPUs) + shortCPUs := cpuset.ShortCPUSet(nodeCPUs) log.Debug(" + assigned DRAM NUMA node #%d (cpuset: %s, DRAM %.2fM)", nodeID, shortCPUs, float64(meminfo.MemTotal)/float64(1024*1024)) case system.MemoryTypePMEM: @@ -448,13 +446,13 @@ func (n *node) discoverSupply(assignedNUMANodes []idset.ID) Supply { sharable := allowed.Difference(isolated).Difference(reserved) if !reserved.IsEmpty() { - log.Debug(" allowed reserved CPUs: %s", kubernetes.ShortCPUSet(reserved)) + log.Debug(" allowed reserved CPUs: %s", cpuset.ShortCPUSet(reserved)) } if !sharable.IsEmpty() { - log.Debug(" allowed sharable CPUs: %s", kubernetes.ShortCPUSet(sharable)) + log.Debug(" allowed sharable CPUs: %s", cpuset.ShortCPUSet(sharable)) } if !isolated.IsEmpty() { - log.Debug(" allowed isolated CPUs: %s", kubernetes.ShortCPUSet(isolated)) + log.Debug(" allowed isolated CPUs: %s", cpuset.ShortCPUSet(isolated)) } cpus = cpus.Union(allowed) diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/pools.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/pools.go index c53d72bed..a7c0c41e1 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/pools.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/pools.go @@ -18,11 +18,10 @@ import ( "math" "sort" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" system "github.com/intel/cri-resource-manager/pkg/sysfs" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -657,7 +656,7 @@ func (p *policy) applyGrant(grant Grant) { // processes in the same pool. Also the 'data' process should run fine, since // it does not need to compete for CPU with any other processes in the system // as long as that allocation is genuinely system-wide exclusive. - container.SetCPUShares(int64(cache.MilliCPUToShares(cpuPortion))) + container.SetCPUShares(int64(cache.MilliCPUToShares(int64(cpuPortion)))) } if mems != "" { diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/pools_test.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/pools_test.go index 8d3d89ae1..6d9129b70 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/pools_test.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/pools_test.go @@ -16,7 +16,6 @@ package topologyaware import ( "fmt" - "io/ioutil" "os" "path" "testing" @@ -29,7 +28,7 @@ import ( system "github.com/intel/cri-resource-manager/pkg/sysfs" "github.com/intel/cri-resource-manager/pkg/utils" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) func findNodeWithID(id int, nodes []Node) Node { @@ -96,8 +95,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 100, name: "testnode0", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), }, id: 0, // system node id }, @@ -122,8 +121,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 100, name: "testnode0", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(9999, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(9999, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(9999, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(9999, 0, 0), createMemoryMap(0, 0, 0)), }, id: 0, // system node id }, @@ -148,8 +147,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 100, name: "testnode0", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), }, }, &numanode{ @@ -157,8 +156,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 101, name: "testnode1", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(10001, 0, 0), createMemoryMap(0, 0, 0)), }, id: 0, // system node id }, @@ -183,8 +182,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 100, name: "testnode0", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(12000, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(12000, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(12000, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(12000, 0, 0), createMemoryMap(0, 0, 0)), }, }, &numanode{ @@ -192,8 +191,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 101, name: "testnode1", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), }, id: 0, // system node id }, @@ -202,8 +201,8 @@ func TestMemoryLimitFiltering(t *testing.T) { id: 102, name: "testnode2", kind: UnknownNode, - noderes: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), - freeres: newSupply(&node{}, cpuset.NewCPUSet(), cpuset.NewCPUSet(), cpuset.NewCPUSet(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), + noderes: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), + freeres: newSupply(&node{}, cpuset.New(), cpuset.New(), cpuset.New(), 0, 0, createMemoryMap(6000, 0, 0), createMemoryMap(0, 0, 0)), }, id: 1, // system node id }, @@ -286,7 +285,7 @@ func TestPoolCreation(t *testing.T) { // Test pool creation with "real" sysfs data. // Create a temporary directory for the test data. - dir, err := ioutil.TempDir("", "cri-resource-manager-test-sysfs-") + dir, err := os.MkdirTemp("", "cri-resource-manager-test-sysfs-") if err != nil { panic(err) } @@ -437,7 +436,7 @@ func TestWorkloadPlacement(t *testing.T) { // server system. // Create a temporary directory for the test data. - dir, err := ioutil.TempDir("", "cri-resource-manager-test-sysfs-") + dir, err := os.MkdirTemp("", "cri-resource-manager-test-sysfs-") if err != nil { panic(err) } @@ -554,7 +553,7 @@ func TestContainerMove(t *testing.T) { // to be moved upwards in the tree. // Create a temporary directory for the test data. - dir, err := ioutil.TempDir("", "cri-resource-manager-test-sysfs-") + dir, err := os.MkdirTemp("", "cri-resource-manager-test-sysfs-") if err != nil { panic(err) } @@ -720,7 +719,7 @@ func TestAffinities(t *testing.T) { // // Create a temporary directory for the test data. - dir, err := ioutil.TempDir("", "cri-resource-manager-test-sysfs-") + dir, err := os.MkdirTemp("", "cri-resource-manager-test-sysfs-") if err != nil { panic(err) } diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/resources.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/resources.go index ed5929add..5e7293dcf 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/resources.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/resources.go @@ -20,12 +20,11 @@ import ( "time" v1 "k8s.io/api/core/v1" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "github.com/intel/cri-resource-manager/pkg/cpuallocator" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" - "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" "github.com/intel/cri-resource-manager/pkg/topology" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -783,16 +782,16 @@ func (cs *supply) DumpCapacity() string { cpu, mem, sep := "", cs.mem.String(), "" if !cs.isolated.IsEmpty() { - cpu = fmt.Sprintf("isolated:%s", kubernetes.ShortCPUSet(cs.isolated)) + cpu = fmt.Sprintf("isolated:%s", cpuset.ShortCPUSet(cs.isolated)) sep = ", " } if !cs.reserved.IsEmpty() { - cpu += sep + fmt.Sprintf("reserved:%s (%dm)", kubernetes.ShortCPUSet(cs.reserved), + cpu += sep + fmt.Sprintf("reserved:%s (%dm)", cpuset.ShortCPUSet(cs.reserved), 1000*cs.reserved.Size()) sep = ", " } if !cs.sharable.IsEmpty() { - cpu += sep + fmt.Sprintf("sharable:%s (%dm)", kubernetes.ShortCPUSet(cs.sharable), + cpu += sep + fmt.Sprintf("sharable:%s (%dm)", cpuset.ShortCPUSet(cs.sharable), 1000*cs.sharable.Size()) } @@ -820,11 +819,11 @@ func (cs *supply) DumpAllocatable() string { cpu, mem, sep := "", cs.mem.String(), "" if !cs.isolated.IsEmpty() { - cpu = fmt.Sprintf("isolated:%s", kubernetes.ShortCPUSet(cs.isolated)) + cpu = fmt.Sprintf("isolated:%s", cpuset.ShortCPUSet(cs.isolated)) sep = ", " } if !cs.reserved.IsEmpty() { - cpu += sep + fmt.Sprintf("reserved:%s (allocatable: %dm)", kubernetes.ShortCPUSet(cs.reserved), cs.AllocatableReservedCPU()) + cpu += sep + fmt.Sprintf("reserved:%s (allocatable: %dm)", cpuset.ShortCPUSet(cs.reserved), cs.AllocatableReservedCPU()) sep = ", " if cs.grantedReserved > 0 { cpu += sep + fmt.Sprintf("grantedReserved:%dm", cs.grantedReserved) @@ -833,7 +832,7 @@ func (cs *supply) DumpAllocatable() string { local_grantedShared := cs.grantedShared total_grantedShared := cs.node.GrantedSharedCPU() if !cs.sharable.IsEmpty() { - cpu += sep + fmt.Sprintf("sharable:%s (", kubernetes.ShortCPUSet(cs.sharable)) + cpu += sep + fmt.Sprintf("sharable:%s (", cpuset.ShortCPUSet(cs.sharable)) sep = "" if local_grantedShared > 0 || total_grantedShared > 0 { cpu += fmt.Sprintf("grantedShared:") diff --git a/pkg/cri/resource-manager/policy/builtin/topology-aware/topology-aware-policy.go b/pkg/cri/resource-manager/policy/builtin/topology-aware/topology-aware-policy.go index 4e32a2c3a..15d14c925 100644 --- a/pkg/cri/resource-manager/policy/builtin/topology-aware/topology-aware-policy.go +++ b/pkg/cri/resource-manager/policy/builtin/topology-aware/topology-aware-policy.go @@ -15,11 +15,11 @@ package topologyaware import ( + "errors" + v1 "k8s.io/api/core/v1" resapi "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - "github.com/hashicorp/go-multierror" "github.com/prometheus/client_golang/prometheus" "github.com/intel/cri-resource-manager/pkg/config" @@ -27,6 +27,7 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/events" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/introspect" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" policyapi "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy" system "github.com/intel/cri-resource-manager/pkg/sysfs" @@ -358,7 +359,7 @@ func (p *policy) ExportResourceData(c cache.Container) map[string]string { // reallocateResources reallocates the given containers using the given pool hints func (p *policy) reallocateResources(containers []cache.Container, pools map[string]string) error { - var errors *multierror.Error + errs := []error{} log.Info("reallocating resources...") @@ -372,14 +373,14 @@ func (p *policy) reallocateResources(containers []cache.Container, pools map[str grant, err := p.allocatePool(c, pools[c.GetCacheID()]) if err != nil { - errors = multierror.Append(errors, err) + errs = append(errs, err) } else { p.applyGrant(grant) } } - if err := errors.ErrorOrNil(); err != nil { - return err + if len(errs) > 0 { + return errors.Join(errs...) } p.updateSharedAllocations(nil) diff --git a/pkg/cri/resource-manager/policy/flags.go b/pkg/cri/resource-manager/policy/flags.go index 1bd1cb7e0..ffc733d1d 100644 --- a/pkg/cri/resource-manager/policy/flags.go +++ b/pkg/cri/resource-manager/policy/flags.go @@ -17,7 +17,6 @@ package policy import ( "encoding/json" "errors" - "io/ioutil" "os" "path/filepath" "sort" @@ -25,10 +24,10 @@ import ( "strings" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "github.com/intel/cri-resource-manager/pkg/cgroups" "github.com/intel/cri-resource-manager/pkg/config" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" ) const ( @@ -187,7 +186,7 @@ func (cs *ConstraintSet) parseCPUFromCgroup(dir string) error { // dir is none of the previous return policyError("failed to find cpuset.cpus for CPU cgroup constraint %q", dir) } - bytes, err := ioutil.ReadFile(path) + bytes, err := os.ReadFile(path) if err != nil { return policyError("failed read CPU cpuset cgroup constraint %q: %v", path, err) diff --git a/pkg/cri/resource-manager/policy/policy.go b/pkg/cri/resource-manager/policy/policy.go index 961d0b6c4..87059757d 100644 --- a/pkg/cri/resource-manager/policy/policy.go +++ b/pkg/cri/resource-manager/policy/policy.go @@ -22,7 +22,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "github.com/intel/cri-resource-manager/pkg/blockio" "github.com/intel/cri-resource-manager/pkg/config" @@ -31,6 +30,7 @@ import ( "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/control/rdt" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/events" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/introspect" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/prometheus/client_golang/prometheus" logger "github.com/intel/cri-resource-manager/pkg/log" diff --git a/pkg/instrumentation/http/http_test.go b/pkg/instrumentation/http/http_test.go index 249504c41..e312a9cb2 100644 --- a/pkg/instrumentation/http/http_test.go +++ b/pkg/instrumentation/http/http_test.go @@ -16,7 +16,7 @@ package http import ( "fmt" - "io/ioutil" + "io" "net/http" "testing" ) @@ -66,7 +66,7 @@ func checkURL(t *testing.T, srv *Server, path, response string, status int) { t.Errorf("http.Get(%s) status %d, expected %d", url, res.StatusCode, status) } - txt, err := ioutil.ReadAll(res.Body) + txt, err := io.ReadAll(res.Body) if err != nil { t.Errorf("http.Get(%s) failed to read response: %v", url, err) } diff --git a/pkg/instrumentation/instrumentation_test.go b/pkg/instrumentation/instrumentation_test.go index b2c538250..c57ca5478 100644 --- a/pkg/instrumentation/instrumentation_test.go +++ b/pkg/instrumentation/instrumentation_test.go @@ -15,7 +15,7 @@ package instrumentation import ( - "io/ioutil" + "io" "net/http" "strings" "testing" @@ -87,7 +87,7 @@ func checkPrometheus(t *testing.T, server string, shouldFail bool) { return } - _, err = ioutil.ReadAll(rpl.Body) + _, err = io.ReadAll(rpl.Body) rpl.Body.Close() if err != nil { t.Errorf("failed to read Prometheus response: %v", err) diff --git a/pkg/log/klogcontrol/klogcontrol.go b/pkg/log/klogcontrol/klogcontrol.go index 765b7508a..f15f3cc10 100644 --- a/pkg/log/klogcontrol/klogcontrol.go +++ b/pkg/log/klogcontrol/klogcontrol.go @@ -17,7 +17,7 @@ package klogcontrol import ( "flag" "fmt" - "io/ioutil" + "io" "os" "strings" @@ -188,7 +188,7 @@ func wrapKlogFlag(f *flag.Flag) { // init discovers klog flags and sets up dynamic control for them. func init() { ctl = &Control{flags: flag.NewFlagSet("klog flags", flag.ContinueOnError)} - ctl.flags.SetOutput(ioutil.Discard) + ctl.flags.SetOutput(io.Discard) klog.InitFlags(ctl.flags) ctl.flags.VisitAll(func(f *flag.Flag) { wrapKlogFlag(f) diff --git a/pkg/pidfile/pidfile_test.go b/pkg/pidfile/pidfile_test.go index bf3ee2bdb..81378eb17 100644 --- a/pkg/pidfile/pidfile_test.go +++ b/pkg/pidfile/pidfile_test.go @@ -15,7 +15,6 @@ package pidfile import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -242,7 +241,7 @@ func TestOwnerPid(t *testing.T) { } func mkTestDir(t *testing.T) (string, error) { - tmp, err := ioutil.TempDir("", ".pidfile-test*") + tmp, err := os.MkdirTemp("", ".pidfile-test*") if err != nil { return "", errors.Wrapf(err, "failed to create test directory") } diff --git a/pkg/procstats/procstats.go b/pkg/procstats/procstats.go index 5eae25b1d..bce6e6318 100644 --- a/pkg/procstats/procstats.go +++ b/pkg/procstats/procstats.go @@ -15,7 +15,7 @@ package procstats import ( - "io/ioutil" + "os" "strconv" "strings" "sync" @@ -51,7 +51,7 @@ func (t *CPUTimeStat) GetCPUTimeStat() error { // cpu0 40321 11452 49784 403099 2615 6076 6748 0 0 0 // cpu1 26585 2425 36639 151166 404 2533 3541 0 0 0 // ... - stats, err := ioutil.ReadFile(procStat) + stats, err := os.ReadFile(procStat) if err != nil { return err } @@ -99,7 +99,7 @@ func (t *CPUTimeStat) GetCPUTimeStat() error { t.PrevTotalTime[i] = t.CurTotalTime[i] } } - for _, i := range sys.Offlined().ToSlice() { + for _, i := range sys.Offlined().List() { t.DeltaIdleTime[i] = 0.0 t.DeltaTotalTime[i] = 0.0 t.PrevIdleTime[i] = t.CurIdleTime[i] diff --git a/pkg/sysfs/parsers.go b/pkg/sysfs/parsers.go index 74b2c72a5..f28ce21c5 100644 --- a/pkg/sysfs/parsers.go +++ b/pkg/sysfs/parsers.go @@ -15,7 +15,7 @@ package sysfs import ( - "io/ioutil" + "os" "strconv" "strings" ) @@ -119,7 +119,7 @@ func parseNumeric(path, value string, ptr interface{}) error { func ParseFileEntries(path string, values map[string]interface{}, pickFn PickEntryFn) error { var err error - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { sysfsError(path, "failed to read file: %v", err) } diff --git a/pkg/sysfs/system.go b/pkg/sysfs/system.go index 10893bd18..3608b9cf6 100644 --- a/pkg/sysfs/system.go +++ b/pkg/sysfs/system.go @@ -16,16 +16,15 @@ package sysfs import ( "fmt" - "io/ioutil" + "os" "path/filepath" "sort" "strconv" "strings" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" - logger "github.com/intel/cri-resource-manager/pkg/log" "github.com/intel/cri-resource-manager/pkg/utils" + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" "github.com/intel/goresctrl/pkg/sst" idset "github.com/intel/goresctrl/pkg/utils" ) @@ -728,9 +727,9 @@ func (c *cpu) SetFrequencyLimits(min, max uint64) error { func readCPUsetFile(base, entry string) (cpuset.CPUSet, error) { path := filepath.Join(base, entry) - blob, err := ioutil.ReadFile(path) + blob, err := os.ReadFile(path) if err != nil { - return cpuset.NewCPUSet(), sysfsError(path, "failed to read sysfs entry: %v", err) + return cpuset.New(), sysfsError(path, "failed to read sysfs entry: %v", err) } return cpuset.Parse(strings.Trim(string(blob), "\n")) @@ -770,16 +769,16 @@ func (sys *system) discoverNodes() error { memoryNodeIDs, err) } - cpuNodesBuilder := cpuset.NewBuilder() + cpuNodesSlice := []int{} for id, node := range sys.nodes { if node.cpus.Size() > 0 { - cpuNodesBuilder.Add(int(id)) + cpuNodesSlice = append(cpuNodesSlice, int(id)) } if normalMemNodes.Contains(int(id)) { node.normalMem = true } } - cpuNodes := cpuNodesBuilder.Result() + cpuNodes := cpuset.New(cpuNodesSlice...) sys.Logger.Info("NUMA nodes with CPUs: %s", cpuNodes.String()) sys.Logger.Info("NUMA nodes with (any) memory: %s", memoryNodes.String()) @@ -1051,7 +1050,7 @@ func (p *cpuPackage) DieCPUSet(id idset.ID) cpuset.CPUSet { if dieCPUs, ok := p.dieCPUs[id]; ok { return CPUSetFromIDSet(dieCPUs) } - return cpuset.NewCPUSet() + return cpuset.New() } func (p *cpuPackage) SstInfo() *sst.SstPackageInfo { diff --git a/pkg/sysfs/utils.go b/pkg/sysfs/utils.go index 385fc71b3..6e91a71c8 100644 --- a/pkg/sysfs/utils.go +++ b/pkg/sysfs/utils.go @@ -16,13 +16,13 @@ package sysfs import ( "fmt" - idset "github.com/intel/goresctrl/pkg/utils" - "io/ioutil" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" "os" "path/filepath" "strconv" "strings" + + "github.com/intel/cri-resource-manager/pkg/utils/cpuset" + idset "github.com/intel/goresctrl/pkg/utils" ) // Get the trailing enumeration part of a name. @@ -53,7 +53,7 @@ func readSysfsEntry(base, entry string, ptr interface{}, args ...interface{}) (s path := filepath.Join(base, entry) - blob, err := ioutil.ReadFile(path) + blob, err := os.ReadFile(path) if err != nil { return "", sysfsError(path, "failed to read sysfs entry: %v", err) } @@ -356,14 +356,14 @@ func formatValueList(sep string, value interface{}) (string, error) { // IDSetFromCPUSet returns an id set corresponding to a cpuset.CPUSet. func IDSetFromCPUSet(cset cpuset.CPUSet) idset.IDSet { - return idset.NewIDSetFromIntSlice(cset.ToSlice()...) + return idset.NewIDSetFromIntSlice(cset.List()...) } // CPUSetFromIDSet returns a cpuset.CPUSet corresponding to an id set. func CPUSetFromIDSet(s idset.IDSet) cpuset.CPUSet { - b := cpuset.NewBuilder() + cpus := []int{} for id := range s { - b.Add(int(id)) + cpus = append(cpus, int(id)) } - return b.Result() + return cpuset.New(cpus...) } diff --git a/pkg/testutils/verify.go b/pkg/testutils/verify.go index 6e4320c83..668082b6e 100644 --- a/pkg/testutils/verify.go +++ b/pkg/testutils/verify.go @@ -4,8 +4,6 @@ import ( "reflect" "strings" "testing" - - "github.com/hashicorp/go-multierror" ) // VerifyDeepEqual checks that two values (including structures) are equal, or else it fails the test. @@ -24,16 +22,13 @@ func VerifyError(t *testing.T, err error, expectedCount int, expectedSubstrings t.Errorf("error expected, got nil") return false } - merr, ok := err.(*multierror.Error) - if !ok { + if merr, ok := err.(interface{ Unwrap() []error }); !ok { t.Errorf("expected %d errors, but got %#v instead of multierror", expectedCount, err) return false - } - if len(merr.Errors) != expectedCount { - t.Errorf("expected %d errors, but got %d: %v", expectedCount, len(merr.Errors), merr) + } else if errs := merr.Unwrap(); len(errs) != expectedCount { + t.Errorf("expected %d errors, but got %d: %v", expectedCount, len(errs), merr) return false } - } else if expectedCount == 0 { if err != nil { t.Errorf("expected 0 errors, but got %v", err) diff --git a/pkg/topology/go.mod b/pkg/topology/go.mod index a08d533e0..a7d18ec3f 100644 --- a/pkg/topology/go.mod +++ b/pkg/topology/go.mod @@ -1,8 +1,8 @@ module github.com/intel/cri-resource-manager/pkg/topology -go 1.16 +go 1.20 require ( github.com/pkg/errors v0.9.1 - golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 + golang.org/x/sys v0.11.0 ) diff --git a/pkg/topology/topology.go b/pkg/topology/topology.go index 4ba2ddc8f..73ade1f76 100644 --- a/pkg/topology/topology.go +++ b/pkg/topology/topology.go @@ -16,7 +16,6 @@ package topology import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -64,7 +63,7 @@ func getDevicesFromVirtual(realDevPath string) (devs []string, err error) { switch dir { case "vfio/": iommuGroup := filepath.Join(sysRoot, "/sys/kernel/iommu_groups", file, "devices") - files, err := ioutil.ReadDir(iommuGroup) + files, err := os.ReadDir(iommuGroup) if err != nil { return nil, errors.Wrapf(err, "failed to read IOMMU group %s", iommuGroup) } @@ -229,7 +228,7 @@ func FindSysFsDevice(dev string) (string, error) { // readFilesInDirectory small helper to fill struct with content from sysfs entry func readFilesInDirectory(fileMap map[string]*string, dir string) error { for k, v := range fileMap { - b, err := ioutil.ReadFile(filepath.Join(dir, k)) + b, err := os.ReadFile(filepath.Join(dir, k)) if err != nil { if os.IsNotExist(err) { continue diff --git a/pkg/topology/topology_test.go b/pkg/topology/topology_test.go index 9d77a5148..e16884579 100644 --- a/pkg/topology/topology_test.go +++ b/pkg/topology/topology_test.go @@ -15,7 +15,6 @@ package topology import ( - "io/ioutil" "os" "path/filepath" "reflect" @@ -132,12 +131,12 @@ func TestReadFilesInDirectory(t *testing.T) { "non_existing": &empty, } - dir, err := ioutil.TempDir("", "readFilesInDirectory") + dir, err := os.MkdirTemp("", "readFilesInDirectory") if err != nil { t.Fatalf("unable to create test directory: %+v", err) } defer os.RemoveAll(dir) - ioutil.WriteFile(filepath.Join(dir, fname), content, 0644) + os.WriteFile(filepath.Join(dir, fname), content, 0644) if err = readFilesInDirectory(fileMap, dir); err != nil { t.Fatalf("unexpected failure: %v", err) diff --git a/pkg/cri/resource-manager/kubernetes/cpuset.go b/pkg/utils/cpuset/cpuset.go similarity index 76% rename from pkg/cri/resource-manager/kubernetes/cpuset.go rename to pkg/utils/cpuset/cpuset.go index 30251bc28..f9108ecaf 100644 --- a/pkg/cri/resource-manager/kubernetes/cpuset.go +++ b/pkg/utils/cpuset/cpuset.go @@ -1,4 +1,4 @@ -// Copyright 2020 Intel Corporation. All Rights Reserved. +// Copyright The NRI Plugins Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,15 +12,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -package kubernetes +package cpuset import ( + "fmt" "strconv" "strings" - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" + "k8s.io/utils/cpuset" ) +// CPUSet is an alias for k8s.io/utils/cpuset.CPUSet. +type CPUSet = cpuset.CPUSet + +var ( + // New is an alias for cpuset.New. + New = cpuset.New + // Parse is an alias for cpuset.Parse. + Parse = cpuset.Parse +) + +// MustParse panics if parsing the given cpuset string fails. +func MustParse(s string) cpuset.CPUSet { + cset, err := cpuset.Parse(s) + if err != nil { + panic(fmt.Errorf("failed to parse CPUSet %s: %w", s, err)) + } + return cset +} + // ShortCPUSet prints the cpuset as a string, trying to further shorten compared to .String(). func ShortCPUSet(cset cpuset.CPUSet) string { str, sep := "", "" diff --git a/pkg/cri/resource-manager/kubernetes/cpuset_test.go b/pkg/utils/cpuset/cpuset_test.go similarity index 94% rename from pkg/cri/resource-manager/kubernetes/cpuset_test.go rename to pkg/utils/cpuset/cpuset_test.go index 1d4564b6d..27d2f9725 100644 --- a/pkg/cri/resource-manager/kubernetes/cpuset_test.go +++ b/pkg/utils/cpuset/cpuset_test.go @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package kubernetes +package cpuset import ( "testing" - - "k8s.io/kubernetes/pkg/kubelet/cm/cpuset" ) func TestShortCPUSet(t *testing.T) { @@ -39,7 +37,7 @@ func TestShortCPUSet(t *testing.T) { }, } for _, tc := range tcases { - cset := cpuset.MustParse(tc.source) + cset := MustParse(tc.source) native := cset.String() if native != tc.native { t.Errorf("incorrect native CPUSet for %q, expected %q, got %q", diff --git a/scripts/build/docker-build-image b/scripts/build/docker-build-image index c6a26b2c6..ba1d643a4 100755 --- a/scripts/build/docker-build-image +++ b/scripts/build/docker-build-image @@ -1,45 +1,16 @@ #!/bin/bash -VOLUMES=(-v /sys:/sys -v /home:/mnt/host/home) IMAGE=$1 DOCKERFILE=dockerfiles/cross-build/Dockerfile.${IMAGE%-build} -shift 2 - -while [ -n "$1" ]; do - case $1 in - --volume|-v) - VOLUMES=("${VOLUMES[@]}" -v "$2") - shift 2 - ;; - --container|-c) - if [ -n "$2" ] && [ "${2#-}" = "$2" ]; then - CONTAINER="$2" - shift - else - CONTAINER="$IMAGE" - fi - shift - ;; - *) - PASSTHROUGH=("${PASSTHROUGH[@]}" "$1") - shift - ;; - esac -done +shift 1 echo "* Building docker images with" echo " - Dockerfile: $DOCKERFILE" echo " - image name: $IMAGE" -echo " - container : $CONTAINER" -echo " - volumes : " "${VOLUMES[@]}" -echo " - options : " "${PASSTHROUGH[@]}" +echo " - options : $@" docker build . \ -f "$DOCKERFILE" -t "$IMAGE" \ --build-arg "CREATE_USER=$USER" \ --build-arg USER_OPTIONS="-u $(id -u)" \ - "${PASSTHROUGH[@]}" || exit 1 - -if [ -n "$CONTAINER" ]; then - docker create --name "$CONTAINER" "${VOLUMES[@]}" "$IMAGE" -fi + "$@" || exit 1 diff --git a/test/e2e/policies.test-suite/static-pools/n4c16/test99-cleanup/code.var.sh b/test/e2e/policies.test-suite/static-pools/n4c16/test99-cleanup/code.var.sh new file mode 100644 index 000000000..b51648190 --- /dev/null +++ b/test/e2e/policies.test-suite/static-pools/n4c16/test99-cleanup/code.var.sh @@ -0,0 +1,5 @@ +# This test cleans up static-pools test suite configurations from vm. +# Other policy tests can be run after this test on the same vm without +# recreating the vm from scratch. + +static-pools-cleanup diff --git a/test/e2e/policies.test-suite/static-pools/static-pools-lib.source.sh b/test/e2e/policies.test-suite/static-pools/static-pools-lib.source.sh index 62261d4d7..184bb5e07 100644 --- a/test/e2e/policies.test-suite/static-pools/static-pools-lib.source.sh +++ b/test/e2e/policies.test-suite/static-pools/static-pools-lib.source.sh @@ -23,3 +23,11 @@ static-pools-relaunch-cri-resmgr() { launch cri-resmgr-webhook fi } + +static-pools-cleanup() { + ( terminate cri-resmgr-agent ) + ( uninstall cri-resmgr-webhook ) + ( extended-resources remove cmk.intel.com/exclusive-cpus >/dev/null ) + ( terminate cri-resmgr ) + vm-command 'kubectl taint node $(hostname) cmk=true:NoSchedule-' || true +} diff --git a/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion-deprecated-syntax/code.var.sh b/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion-deprecated-syntax/code.var.sh index 6fd98c016..f91616740 100644 --- a/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion-deprecated-syntax/code.var.sh +++ b/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion-deprecated-syntax/code.var.sh @@ -36,7 +36,7 @@ pages_per_second_per_process="$(awk ' # After how many rounds (seconds) first migrations should be visible. first_migrations_visible="$(awk ' - /PageScanInterval:/{gsub(/[^0-9]/, "", $2); print $2+3} + /PageScanInterval:/{gsub(/[^0-9]/, "", $2); print $2+8} ' < "$cri_resmgr_cfg")" # Expected migrated number of pages when fully migrated. diff --git a/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion/code.var.sh b/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion/code.var.sh index 53ca4e0db..df4be333f 100644 --- a/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion/code.var.sh +++ b/test/e2e/policies.test-suite/topology-aware/c4pmem4/test04-dynamic-page-demotion/code.var.sh @@ -38,7 +38,7 @@ pages_per_second_per_process="$(awk ' # After how many rounds (seconds) first migrations should be visible. first_migrations_visible="$(awk ' - /PageScanInterval:/{gsub(/[^0-9]/, "", $2); print $2+3} + /PageScanInterval:/{gsub(/[^0-9]/, "", $2); print $2+8} ' < "$cri_resmgr_cfg")" # Expected migrated number of pages when fully migrated. diff --git a/test/e2e/policies.test-suite/topology-aware/n4c16/test09-container-exit/code.var.sh b/test/e2e/policies.test-suite/topology-aware/n4c16/test09-container-exit/code.var.sh index 6c9e48bf2..3b9ebc520 100644 --- a/test/e2e/policies.test-suite/topology-aware/n4c16/test09-container-exit/code.var.sh +++ b/test/e2e/policies.test-suite/topology-aware/n4c16/test09-container-exit/code.var.sh @@ -8,7 +8,13 @@ pyexec 'assert "pod0c0" in allocations' out '### Crash and restart pod0c0' vm-command "kubectl get pods pod0" -vm-command "kill -KILL \$(pgrep -f pod0c0)" + +vm-command "set -x; [[ -n \"\$(pgrep -f pod0c0)\" ]] && [[ \"\$(pgrep -f pod0c0 --oldest)\" != \"\$(pgrep -f pod0c0 --newest)\" ]]" || { + command-error "There must be separate parent and child 'pod0c0' processes in order to run this test" +} + +out '### Kill the root process in pod0c0. The container should get Restarted.' +vm-command "kill -KILL \$(pgrep -f pod0c0 --oldest)" sleep 2 vm-command 'kubectl wait --for=condition=Ready pods/pod0' vm-run-until --timeout 30 "pgrep -f pod0c0 > /dev/null 2>&1" @@ -17,10 +23,10 @@ report allowed verify 'len(cpus["pod0c0"]) == 1' pyexec 'assert "pod0c0" in allocations' -out '### Exit and complete pod0c0 by killing "sleep inf"' -out '### => sh (the init process in the container) will exit with status 0' +out '### Kill the child process in pod0c0. The root process exits with status 0, the container should get Completed.' vm-command "kubectl get pods pod0" -vm-command "kill -KILL \$(pgrep --parent \$(pgrep -f pod0c0) sleep)" +vm-command "ps axf | grep pod0c0; echo newest: \$(pgrep -f pod0c0 --newest)" +vm-command "kill -KILL \$(pgrep -f pod0c0 --newest)" sleep 2 vm-command "kubectl get pods pod0" # pod0c0 process is not on vm anymore diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 64eee9468..66df96094 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -1,7 +1,7 @@ #!/bin/bash DEMO_TITLE="Container Runtime End-to-End Testing" -DEFAULT_DISTRO="ubuntu-20.04" +DEFAULT_DISTRO="ubuntu-22.04" PV='pv -qL' diff --git a/test/e2e/run_tests.sh b/test/e2e/run_tests.sh index 110399173..710d75d88 100755 --- a/test/e2e/run_tests.sh +++ b/test/e2e/run_tests.sh @@ -3,7 +3,7 @@ TESTS_DIR="$1" RUN_SH="${0%/*}/run.sh" -DEFAULT_DISTRO="ubuntu-20.04" +DEFAULT_DISTRO="ubuntu-22.04" usage() { echo "Usage: run_tests.sh TESTS_DIR" diff --git a/test/functional/e2e_test.go b/test/functional/e2e_test.go index 827ce8224..518f2579d 100644 --- a/test/functional/e2e_test.go +++ b/test/functional/e2e_test.go @@ -18,17 +18,15 @@ import ( "context" "flag" "fmt" - "io/ioutil" "net" "os" "path/filepath" "testing" "time" - kubetypes "k8s.io/kubernetes/pkg/kubelet/types" - resmgr "github.com/intel/cri-resource-manager/pkg/cri/resource-manager" "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache" + "github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes" "github.com/intel/cri-resource-manager/pkg/dump" "google.golang.org/grpc" criv1 "k8s.io/cri-api/pkg/apis/runtime/v1" @@ -64,7 +62,7 @@ func (env *testEnv) Run(name string, testFunction func(context.Context, *testEnv t.Helper() t.Run(name, func(t *testing.T) { - tmpDir, err := ioutil.TempDir(testDir, "requests-") + tmpDir, err := os.MkdirTemp(testDir, "requests-") if err != nil { t.Fatalf("unable to create temp directory: %+v", err) } @@ -94,7 +92,7 @@ func (env *testEnv) Run(name string, testFunction func(context.Context, *testEnv if env.forceConfig != "" { path := filepath.Join(tmpDir, "forcedconfig.cfg") - if err := ioutil.WriteFile(path, []byte(env.forceConfig), 0644); err != nil { + if err := os.WriteFile(path, []byte(env.forceConfig), 0644); err != nil { t.Fatalf("failed to create configuration file %s: %v", path, err) } if err := flag.Set("force-config", path); err != nil { @@ -449,7 +447,7 @@ func createPodRequest(name, uid, namespace string, if labels == nil { labels = map[string]string{} } - labels[kubetypes.KubernetesPodUIDLabel] = uid + labels[kubernetes.PodUIDLabel] = uid return &criv1.RunPodSandboxRequest{ Config: &criv1.PodSandboxConfig{ Metadata: &criv1.PodSandboxMetadata{