Skip to content

Commit aab4411

Browse files
authored
CP/DP Split: remove unneeded provisioner mode (#3180)
With the new deployment model, the provisioner mode for conformance tests is no longer needed. This code is removed, and at a later date the conformance tests will be updated to work with the new model. Renamed the "static-mode" to "controller". Also removed some unneeded metrics collection.
1 parent 785b809 commit aab4411

File tree

33 files changed

+27
-1511
lines changed

33 files changed

+27
-1511
lines changed

.github/workflows/conformance.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ jobs:
7676
type=ref,event=pr
7777
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
7878
79-
- name: Generate static deployment
80-
run: |
81-
ngf_prefix=ghcr.io/nginx/nginx-gateway-fabric
82-
ngf_tag=${{ steps.ngf-meta.outputs.version }}
83-
make generate-static-deployment PLUS_ENABLED=${{ inputs.image == 'plus' && 'true' || 'false' }} PREFIX=${ngf_prefix} TAG=${ngf_tag}
84-
working-directory: ./tests
85-
8679
- name: Build binary
8780
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
8881
with:
@@ -151,7 +144,6 @@ jobs:
151144
ngf_tag=${{ steps.ngf-meta.outputs.version }}
152145
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
153146
make helm-install-local${{ inputs.image == 'plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
154-
make deploy-updated-provisioner PREFIX=${ngf_prefix} TAG=${ngf_tag}
155147
working-directory: ./tests
156148

157149
- name: Run conformance tests

charts/nginx-gateway-fabric/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
spec:
3232
containers:
3333
- args:
34-
- static-mode
34+
- controller
3535
- --gateway-ctlr-name={{ .Values.nginxGateway.gatewayControllerName }}
3636
- --gatewayclass={{ .Values.nginxGateway.gatewayClassName }}
3737
- --config={{ include "nginx-gateway.config-name" . }}

cmd/gateway/commands.go

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
ctlrZap "sigs.k8s.io/controller-runtime/pkg/log/zap"
2222

2323
"github.com/nginx/nginx-gateway-fabric/internal/framework/file"
24-
"github.com/nginx/nginx-gateway-fabric/internal/mode/provisioner"
2524
"github.com/nginx/nginx-gateway-fabric/internal/mode/static"
2625
"github.com/nginx/nginx-gateway-fabric/internal/mode/static/config"
2726
"github.com/nginx/nginx-gateway-fabric/internal/mode/static/licensing"
@@ -53,7 +52,7 @@ func createRootCommand() *cobra.Command {
5352
return rootCmd
5453
}
5554

56-
func createStaticModeCommand() *cobra.Command {
55+
func createControllerCommand() *cobra.Command {
5756
// flag names
5857
const (
5958
gatewayFlag = "gateway"
@@ -145,8 +144,8 @@ func createStaticModeCommand() *cobra.Command {
145144
)
146145

147146
cmd := &cobra.Command{
148-
Use: "static-mode",
149-
Short: "Configure NGINX in the scope of a single Gateway resource",
147+
Use: "controller",
148+
Short: "Run the NGINX Gateway Fabric control plane",
150149
RunE: func(cmd *cobra.Command, _ []string) error {
151150
atom := zap.NewAtomicLevel()
152151

@@ -155,7 +154,7 @@ func createStaticModeCommand() *cobra.Command {
155154

156155
commit, date, dirty := getBuildInfo()
157156
logger.Info(
158-
"Starting NGINX Gateway Fabric in static mode",
157+
"Starting the NGINX Gateway Fabric control plane",
159158
"version", version,
160159
"commit", commit,
161160
"date", date,
@@ -443,56 +442,6 @@ func createStaticModeCommand() *cobra.Command {
443442
return cmd
444443
}
445444

446-
func createProvisionerModeCommand() *cobra.Command {
447-
var (
448-
gatewayCtlrName = stringValidatingValue{
449-
validator: validateGatewayControllerName,
450-
}
451-
gatewayClassName = stringValidatingValue{
452-
validator: validateResourceName,
453-
}
454-
)
455-
456-
cmd := &cobra.Command{
457-
Use: "provisioner-mode",
458-
Short: "Provision a static-mode NGINX Gateway Fabric Deployment per Gateway resource",
459-
Hidden: true,
460-
RunE: func(_ *cobra.Command, _ []string) error {
461-
logger := ctlrZap.New()
462-
commit, date, dirty := getBuildInfo()
463-
logger.Info(
464-
"Starting NGINX Gateway Fabric Provisioner",
465-
"version", version,
466-
"commit", commit,
467-
"date", date,
468-
"dirty", dirty,
469-
)
470-
471-
return provisioner.StartManager(provisioner.Config{
472-
Logger: logger,
473-
GatewayClassName: gatewayClassName.value,
474-
GatewayCtlrName: gatewayCtlrName.value,
475-
})
476-
},
477-
}
478-
479-
cmd.Flags().Var(
480-
&gatewayCtlrName,
481-
gatewayCtlrNameFlag,
482-
fmt.Sprintf(gatewayCtlrNameUsageFmt, domain),
483-
)
484-
utilruntime.Must(cmd.MarkFlagRequired(gatewayCtlrNameFlag))
485-
486-
cmd.Flags().Var(
487-
&gatewayClassName,
488-
gatewayClassFlag,
489-
gatewayClassNameUsage,
490-
)
491-
utilruntime.Must(cmd.MarkFlagRequired(gatewayClassFlag))
492-
493-
return cmd
494-
}
495-
496445
// FIXME(pleshakov): Remove this command once NGF min supported Kubernetes version supports sleep action in
497446
// preStop hook.
498447
// See https://github.com/kubernetes/enhancements/tree/4ec371d92dcd4f56a2ab18c8ba20bb85d8d20efe/keps/sig-node/3960-pod-lifecycle-sleep-action

cmd/gateway/commands_test.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,9 @@ func TestCommonFlagsValidation(t *testing.T) {
122122
}
123123

124124
for _, test := range tests {
125-
t.Run(test.name+"_static_mode", func(t *testing.T) {
125+
t.Run(test.name+"_controller", func(t *testing.T) {
126126
t.Parallel()
127-
testFlag(t, createStaticModeCommand(), test)
128-
})
129-
t.Run(test.name+"_provisioner_mode", func(t *testing.T) {
130-
t.Parallel()
131-
testFlag(t, createProvisionerModeCommand(), test)
127+
testFlag(t, createControllerCommand(), test)
132128
})
133129
}
134130
}
@@ -439,28 +435,12 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
439435
for _, test := range tests {
440436
t.Run(test.name, func(t *testing.T) {
441437
t.Parallel()
442-
cmd := createStaticModeCommand()
438+
cmd := createControllerCommand()
443439
testFlag(t, cmd, test)
444440
})
445441
}
446442
}
447443

448-
func TestProvisionerModeCmdFlagValidation(t *testing.T) {
449-
t.Parallel()
450-
testCase := flagTestCase{
451-
name: "valid flags",
452-
args: []string{
453-
"--gateway-ctlr-name=gateway.nginx.org/nginx-gateway", // common and required flag
454-
"--gatewayclass=nginx", // common and required flag
455-
},
456-
wantErr: false,
457-
}
458-
459-
// common flags validation is tested separately
460-
461-
testFlag(t, createProvisionerModeCommand(), testCase)
462-
}
463-
464444
func TestSleepCmdFlagValidation(t *testing.T) {
465445
t.Parallel()
466446
tests := []flagTestCase{

cmd/gateway/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ func main() {
2121
rootCmd := createRootCommand()
2222

2323
rootCmd.AddCommand(
24-
createStaticModeCommand(),
25-
createProvisionerModeCommand(),
24+
createControllerCommand(),
2625
createInitializeCommand(),
2726
createSleepCommand(),
2827
)

config/tests/static-deployment.yaml

Lines changed: 0 additions & 82 deletions
This file was deleted.

deploy/aws-nlb/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ spec:
200200
spec:
201201
containers:
202202
- args:
203-
- static-mode
203+
- controller
204204
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
205205
- --gatewayclass=nginx
206206
- --config=nginx-gateway-config

deploy/azure/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ spec:
200200
spec:
201201
containers:
202202
- args:
203-
- static-mode
203+
- controller
204204
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
205205
- --gatewayclass=nginx
206206
- --config=nginx-gateway-config

deploy/default/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ spec:
200200
spec:
201201
containers:
202202
- args:
203-
- static-mode
203+
- controller
204204
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
205205
- --gatewayclass=nginx
206206
- --config=nginx-gateway-config

deploy/experimental-nginx-plus/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ spec:
204204
spec:
205205
containers:
206206
- args:
207-
- static-mode
207+
- controller
208208
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
209209
- --gatewayclass=nginx
210210
- --config=nginx-gateway-config

0 commit comments

Comments
 (0)