Skip to content

Commit

Permalink
Merge pull request #865 from elezar/cherry-pick-7000a991
Browse files Browse the repository at this point in the history
[no-relnote] Create a go submodule for tests/e2e
  • Loading branch information
elezar authored Aug 7, 2024
2 parents 30ac6a0 + 3add075 commit 07ee362
Show file tree
Hide file tree
Showing 6,393 changed files with 1,879,914 additions and 1,242 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
78 changes: 70 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,42 @@ updates:
exclude-patterns:
- k8s.io/klog/*

- package-ecosystem: "gomod"
target-branch: main
directory: "tests/e2e"
schedule:
interval: "weekly"
day: "sunday"
labels:
- dependencies
- testing
groups:
k8sio:
patterns:
- k8s.io/*
exclude-patterns:
- k8s.io/klog/*

- package-ecosystem: "gomod"
target-branch: main
directory: "deployments/devel"
schedule:
interval: "weekly"
day: "sunday"

- package-ecosystem: "docker"
directory: "/deployments/container"
schedule:
interval: "daily"

- package-ecosystem: "docker"
target-branch: main
directory: "/deployments/devel"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
target-branch: release-0.15
target-branch: release-0.16
directory: "/"
schedule:
interval: "weekly"
Expand All @@ -39,33 +68,66 @@ updates:
exclude-patterns:
- k8s.io/klog/*

- package-ecosystem: "docker"
target-branch: release-0.15
directory: "/deployments/container"
- package-ecosystem: "gomod"
target-branch: release-0.16
directory: "tests/e2e"
schedule:
interval: "daily"
interval: "weekly"
day: "sunday"
labels:
- dependencies
- maintenance
- testing
groups:
k8sio:
patterns:
- k8s.io/*
exclude-patterns:
- k8s.io/klog/*

- package-ecosystem: "gomod"
target-branch: main
target-branch: release-0.16
directory: "deployments/devel"
schedule:
interval: "weekly"
day: "sunday"
labels:
- dependencies
- maintenance

# A dependabot rule to bump the golang version.
- package-ecosystem: "docker"
target-branch: main
target-branch: release-0.16
directory: "/deployments/container"
schedule:
interval: "daily"
labels:
- dependencies
- maintenance

- package-ecosystem: "docker"
target-branch: release-0.16
directory: "/deployments/devel"
schedule:
interval: "daily"
labels:
- dependencies
- maintenance

# Github actions need to be updated on main, release-*, and gh-pages branches.
- package-ecosystem: "github-actions"
target-branch: main
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
target-branch: release-0.16
directory: "/"
schedule:
interval: "daily"
labels:
- dependencies
- maintenance

- package-ecosystem: "github-actions"
target-branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
E2E_IMAGE_TAG: ${COMMIT_SHORT_SHA}-ubuntu22.04
LOG_ARTIFACTS: ${{ github.workspace }}/e2e_logs
run: |
make -f tests/e2e/Makefile e2e-test
make test-e2e
- name: Archive test logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand Down
48 changes: 23 additions & 25 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Run this workflow on new tags
name: Publish Helm Chart
name: Helm

on:
release:
pull_request:
types:
- published
- opened
- synchronize
branches:
- main
- release-*
push:
branches:
- main
- release-*

jobs:
update-helm-charts:
name: Update gh-pages branch helm charts and index
test:
name: Test
runs-on: ubuntu-latest
env:
HELM_REPO_PATH: releases/helm-${{ github.event.release.tag_name }}/
steps:
- name: Install Helm
uses: azure/[email protected]
with:
version: 3.14.4

- name: Check out repo
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Update helm index
- name: Get Golang version
id: vars
run: |
git config user.name "Github Actions"
git config user.email "[email protected]"
./hack/update-helm-index.sh --helm-repo-path $HELM_REPO_PATH --version ${{ github.event.release.tag_name }}
- name: Push updated Helm charts and index to gh-pages branch
run: |
git -C $HELM_REPO_PATH push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages
GOLANG_VERSION=$(./hack/golang-version.sh)
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- run: make test-helm
48 changes: 48 additions & 0 deletions .github/workflows/publish-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2024 NVIDIA CORPORATION
#
# 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.

# Run this workflow on new tags
name: Publish Helm Chart

on:
release:
types:
- published

jobs:
update-helm-charts:
name: Update gh-pages branch helm charts and index
runs-on: ubuntu-latest
env:
HELM_REPO_PATH: releases/helm-${{ github.event.release.tag_name }}/
steps:
- name: Install Helm
uses: azure/[email protected]
with:
version: 3.14.4

- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Update helm index
run: |
git config user.name "Github Actions"
git config user.email "[email protected]"
./hack/update-helm-index.sh --helm-repo-path $HELM_REPO_PATH --version ${{ github.event.release.tag_name }}
- name: Push updated Helm charts and index to gh-pages branch
run: |
git -C $HELM_REPO_PATH push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ examples: $(EXAMPLE_TARGETS)
$(EXAMPLE_TARGETS): example-%:
go build $(BUILDFLAGS) $(COMMAND_BUILD_OPTIONS) ./examples/$(*)

# We also add top-level targets for testing make targets:
.PHONY: $(TEST_TARGETS)
TESTS_FOLDERS := $(patsubst ./tests/%/,%,$(sort $(dir $(wildcard ./tests/*/))))
TEST_TARGETS := $(patsubst %,test-%,$(TESTS_FOLDERS))
$(TEST_TARGETS): test-%:
make -f tests/$(*)/Makefile test

all: check test build binaries
check: $(CHECK_TARGETS)

Expand Down
43 changes: 41 additions & 2 deletions deployments/helm/nvidia-device-plugin/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Security context for the plugin
{{ toYaml .Values.securityContext }}
{{- else if .Values.compatWithCPUManager -}}
privileged: true
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
{{- else if eq (include "nvidia-device-plugin.requiresCapSysAdmin" .) "true" -}}
capabilities:
add:
- SYS_ADMIN
Expand All @@ -110,7 +110,7 @@ Security context for GFD
{{- define "gpu-feature-discovery.securityContext" -}}
{{- if ne (len .Values.gfd.securityContext) 0 -}}
{{ toYaml .Values.gfd.securityContext }}
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
{{- else if eq (include "nvidia-device-plugin.requiresCapSysAdmin" .) "true" -}}
capabilities:
add:
- SYS_ADMIN
Expand All @@ -121,6 +121,19 @@ capabilities:
{{- end -}}
{{- end -}}

{{/*
Check whether the SYS_ADMIN capability should be included.
*/}}
{{- define "nvidia-device-plugin.requiresCapSysAdmin" -}}
{{- $result := false -}}
{{- if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
{{- $result = true -}}
{{- else if eq (include "nvidia-device-plugin.deviceListStrategyIncludesVolumeMount" .) "true" -}}
{{- $result = true -}}
{{- end -}}
{{- $result -}}
{{- end -}}

{{/*
Check if migStrategy (from all possible configurations) is "none"
*/}}
Expand All @@ -145,6 +158,32 @@ Check if migStrategy (from all possible configurations) is "none"
{{- $result -}}
{{- end }}

{{/*
Check if volume-mounts is included in the set of device-list-strategies
*/}}
{{- define "nvidia-device-plugin.deviceListStrategyIncludesVolumeMount" -}}
{{- $result := false -}}
{{- if .Values.deviceListStrategy -}}
{{- $result = ( contains "volume-mounts" .Values.deviceListStrategy ) -}}
{{- else if eq (include "nvidia-device-plugin.hasConfigMap" .) "true" -}}
{{- $result = true -}}
{{- else -}}
{{- range $name, $contents := $.Values.config.map -}}
{{- $config := $contents | fromYaml -}}
{{- if $config.flags -}}
{{- if $config.flags.plugin -}}
{{- if typeIs "string" $config.flags.plugin.deviceListStrategy }}
{{- $result = ( contains "volume-mounts" $config.flags.plugin.deviceListStrategy ) -}}
{{- else if typeIs "list" $config.flags.plugin.deviceListStrategy }}
{{- $result = ( has "volume-mounts" $config.flags.plugin.deviceListStrategy ) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $result -}}
{{- end }}

{{/*
Check if an explicit set of configs has been provided or not
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ spec:
- name: DEVICE_DISCOVERY_STRATEGY
value: {{ .Values.deviceDiscoveryStrategy }}
{{- end }}
- name: DEVICE_PLUGIN_MODE
value: "{{ .Values.devicePlugin.mode }}"
- name: NVIDIA_VISIBLE_DEVICES
value: all
- name: NVIDIA_DRIVER_CAPABILITIES
Expand Down
Loading

0 comments on commit 07ee362

Please sign in to comment.