Skip to content

Commit 9958d7a

Browse files
committed
Add options for chart version and add command output (nginx#2332)
Problem: There's not a way to specify the version of the Chart and to see the command used to install. Solution: Add a parameter to specify the version of the Chart. When installing from a registry if no version is specified the latest tag will be installed. For now only the edge version will set the edge tag. Also output the command used to install.
1 parent 00f5376 commit 9958d7a

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

.golangci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ linters-settings:
1111
- name: blank-imports
1212
- name: context-as-argument
1313
- name: context-keys-type
14+
- name: dot-imports
15+
arguments:
16+
- allowedPackages:
17+
- github.com/onsi/gomega
18+
- github.com/onsi/ginkgo/v2
1419
- name: empty-block
1520
- name: error-naming
1621
- name: error-return
@@ -40,6 +45,10 @@ linters-settings:
4045
dupword:
4146
ignore:
4247
- "test"
48+
stylecheck:
49+
dot-import-whitelist:
50+
- github.com/onsi/gomega
51+
- github.com/onsi/ginkgo/v2
4352
linters:
4453
enable:
4554
- asasalint

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GW_API_VERSION ?= $(shell sed -n 's/.*ref=v\(.*\)/\1/p' ../config/crd/gateway-ap
99
GW_API_PREV_VERSION ?= 1.1.0## Supported Gateway API version from previous NGF release
1010
GW_SERVICE_TYPE = NodePort## Service type to use for the gateway
1111
GW_SVC_GKE_INTERNAL = false
12-
NGF_VERSION ?= $(shell git describe --tags $(shell git rev-list --tags --max-count=1))## NGF version to be tested (defaults to latest tag)
12+
NGF_VERSION ?= edge## NGF version to be tested
1313
PULL_POLICY = Never## Pull policy for the images
1414
PROVISIONER_MANIFEST = conformance/provisioner/provisioner.yaml
1515
SUPPORTED_FEATURES = HTTPRouteQueryParamMatching,HTTPRouteMethodMatching,HTTPRoutePortRedirect,HTTPRouteSchemeRedirect,HTTPRouteHostRewrite,HTTPRoutePathRewrite,GatewayPort8080,HTTPRouteResponseHeaderModification,GRPCExactMethodMatching,GRPCRouteListenerHostnameMatching,GRPCRouteHeaderMatching

tests/framework/ngf.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"time"
1010

11+
. "github.com/onsi/ginkgo/v2"
1112
core "k8s.io/api/core/v1"
1213
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1314
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -22,6 +23,7 @@ type InstallationConfig struct {
2223
ReleaseName string
2324
Namespace string
2425
ChartPath string
26+
ChartVersion string
2527
NgfImageRepository string
2628
NginxImageRepository string
2729
ImageTag string
@@ -58,17 +60,23 @@ func UninstallGatewayAPI(apiVersion string) ([]byte, error) {
5860
func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
5961
args := []string{
6062
"install",
63+
"--debug",
6164
cfg.ReleaseName,
6265
cfg.ChartPath,
6366
"--create-namespace",
6467
"--namespace", cfg.Namespace,
6568
"--wait",
6669
"--set", "nginxGateway.productTelemetry.enable=false",
6770
}
71+
if cfg.ChartVersion != "" {
72+
args = append(args, "--version", cfg.ChartVersion)
73+
}
6874

6975
args = append(args, setImageArgs(cfg)...)
7076
fullArgs := append(args, extraArgs...)
7177

78+
GinkgoWriter.Printf("Installing NGF with command: helm %v\n", strings.Join(fullArgs, " "))
79+
7280
return exec.Command("helm", fullArgs...).CombinedOutput()
7381
}
7482

@@ -81,16 +89,22 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
8189

8290
args := []string{
8391
"upgrade",
92+
"--debug",
8493
cfg.ReleaseName,
8594
cfg.ChartPath,
8695
"--namespace", cfg.Namespace,
8796
"--wait",
8897
"--set", "nginxGateway.productTelemetry.enable=false",
8998
}
99+
if cfg.ChartVersion != "" {
100+
args = append(args, "--version", cfg.ChartVersion)
101+
}
90102

91103
args = append(args, setImageArgs(cfg)...)
92104
fullArgs := append(args, extraArgs...)
93105

106+
GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " "))
107+
94108
return exec.Command("helm", fullArgs...).CombinedOutput()
95109
}
96110

tests/scripts/sync-files-to-vm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -eo pipefail
44

55
source scripts/vars.env
66

7-
NGF_DIR=$(dirname "$PWD")
7+
NGF_DIR=$(dirname "$PWD")/
88

99
gcloud compute config-ssh --ssh-config-file ngf-gcp.ssh >/dev/null
1010

11-
rsync -ave 'ssh -F ngf-gcp.ssh' "${NGF_DIR}" username@"${RESOURCE_NAME}"."${GKE_CLUSTER_ZONE}"."${GKE_PROJECT}":~
11+
rsync -ave 'ssh -F ngf-gcp.ssh' "${NGF_DIR}" username@"${RESOURCE_NAME}"."${GKE_CLUSTER_ZONE}"."${GKE_PROJECT}":~/nginx-gateway-fabric

tests/suite/system_suite_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ var (
7373
localChartPath string
7474
address string
7575
version string
76+
chartVersion string
7677
clusterInfo framework.ClusterInfo
7778
skipNFRTests bool
7879
)
@@ -173,6 +174,11 @@ func setup(cfg setupConfig, extraInstallArgs ...string) {
173174
}
174175
installCfg.ImageTag = *imageTag
175176
installCfg.ImagePullPolicy = *imagePullPolicy
177+
} else {
178+
if version == "edge" {
179+
chartVersion = "0.0.0-edge"
180+
installCfg.ChartVersion = chartVersion
181+
}
176182
}
177183

178184
output, err := framework.InstallGatewayAPI(cfg.gwAPIVersion)

tests/suite/upgrade_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ var _ = Describe("Upgrade testing", Label("nfr", "upgrade"), func() {
9292
ReleaseName: releaseName,
9393
Namespace: ngfNamespace,
9494
ChartPath: localChartPath,
95+
ChartVersion: chartVersion,
9596
NgfImageRepository: *ngfImageRepository,
9697
NginxImageRepository: nginxImage,
9798
ImageTag: *imageTag,

0 commit comments

Comments
 (0)