Skip to content

Commit

Permalink
CP/DP Split: remove unneeded provisioner mode (#3180)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sjberman committed Mar 4, 2025
1 parent 9ff3f4e commit afa658a
Show file tree
Hide file tree
Showing 33 changed files with 27 additions and 1,511 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ jobs:
type=ref,event=pr
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
- name: Generate static deployment
run: |
ngf_prefix=ghcr.io/nginx/nginx-gateway-fabric
ngf_tag=${{ steps.ngf-meta.outputs.version }}
make generate-static-deployment PLUS_ENABLED=${{ inputs.image == 'plus' && 'true' || 'false' }} PREFIX=${ngf_prefix} TAG=${ngf_tag}
working-directory: ./tests

- name: Build binary
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
with:
Expand Down Expand Up @@ -151,7 +144,6 @@ jobs:
ngf_tag=${{ steps.ngf-meta.outputs.version }}
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
make helm-install-local${{ inputs.image == 'plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
make deploy-updated-provisioner PREFIX=${ngf_prefix} TAG=${ngf_tag}
working-directory: ./tests

- name: Run conformance tests
Expand Down
2 changes: 1 addition & 1 deletion charts/nginx-gateway-fabric/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name={{ .Values.nginxGateway.gatewayControllerName }}
- --gatewayclass={{ .Values.nginxGateway.gatewayClassName }}
- --config={{ include "nginx-gateway.config-name" . }}
Expand Down
59 changes: 4 additions & 55 deletions cmd/gateway/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
ctlrZap "sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/nginx/nginx-gateway-fabric/internal/framework/file"
"github.com/nginx/nginx-gateway-fabric/internal/mode/provisioner"
"github.com/nginx/nginx-gateway-fabric/internal/mode/static"
"github.com/nginx/nginx-gateway-fabric/internal/mode/static/config"
"github.com/nginx/nginx-gateway-fabric/internal/mode/static/licensing"
Expand Down Expand Up @@ -53,7 +52,7 @@ func createRootCommand() *cobra.Command {
return rootCmd
}

func createStaticModeCommand() *cobra.Command {
func createControllerCommand() *cobra.Command {
// flag names
const (
gatewayFlag = "gateway"
Expand Down Expand Up @@ -145,8 +144,8 @@ func createStaticModeCommand() *cobra.Command {
)

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

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

commit, date, dirty := getBuildInfo()
logger.Info(
"Starting NGINX Gateway Fabric in static mode",
"Starting the NGINX Gateway Fabric control plane",
"version", version,
"commit", commit,
"date", date,
Expand Down Expand Up @@ -443,56 +442,6 @@ func createStaticModeCommand() *cobra.Command {
return cmd
}

func createProvisionerModeCommand() *cobra.Command {
var (
gatewayCtlrName = stringValidatingValue{
validator: validateGatewayControllerName,
}
gatewayClassName = stringValidatingValue{
validator: validateResourceName,
}
)

cmd := &cobra.Command{
Use: "provisioner-mode",
Short: "Provision a static-mode NGINX Gateway Fabric Deployment per Gateway resource",
Hidden: true,
RunE: func(_ *cobra.Command, _ []string) error {
logger := ctlrZap.New()
commit, date, dirty := getBuildInfo()
logger.Info(
"Starting NGINX Gateway Fabric Provisioner",
"version", version,
"commit", commit,
"date", date,
"dirty", dirty,
)

return provisioner.StartManager(provisioner.Config{
Logger: logger,
GatewayClassName: gatewayClassName.value,
GatewayCtlrName: gatewayCtlrName.value,
})
},
}

cmd.Flags().Var(
&gatewayCtlrName,
gatewayCtlrNameFlag,
fmt.Sprintf(gatewayCtlrNameUsageFmt, domain),
)
utilruntime.Must(cmd.MarkFlagRequired(gatewayCtlrNameFlag))

cmd.Flags().Var(
&gatewayClassName,
gatewayClassFlag,
gatewayClassNameUsage,
)
utilruntime.Must(cmd.MarkFlagRequired(gatewayClassFlag))

return cmd
}

// FIXME(pleshakov): Remove this command once NGF min supported Kubernetes version supports sleep action in
// preStop hook.
// See https://github.com/kubernetes/enhancements/tree/4ec371d92dcd4f56a2ab18c8ba20bb85d8d20efe/keps/sig-node/3960-pod-lifecycle-sleep-action
Expand Down
26 changes: 3 additions & 23 deletions cmd/gateway/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ func TestCommonFlagsValidation(t *testing.T) {
}

for _, test := range tests {
t.Run(test.name+"_static_mode", func(t *testing.T) {
t.Run(test.name+"_controller", func(t *testing.T) {
t.Parallel()
testFlag(t, createStaticModeCommand(), test)
})
t.Run(test.name+"_provisioner_mode", func(t *testing.T) {
t.Parallel()
testFlag(t, createProvisionerModeCommand(), test)
testFlag(t, createControllerCommand(), test)
})
}
}
Expand Down Expand Up @@ -439,28 +435,12 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
cmd := createStaticModeCommand()
cmd := createControllerCommand()
testFlag(t, cmd, test)
})
}
}

func TestProvisionerModeCmdFlagValidation(t *testing.T) {
t.Parallel()
testCase := flagTestCase{
name: "valid flags",
args: []string{
"--gateway-ctlr-name=gateway.nginx.org/nginx-gateway", // common and required flag
"--gatewayclass=nginx", // common and required flag
},
wantErr: false,
}

// common flags validation is tested separately

testFlag(t, createProvisionerModeCommand(), testCase)
}

func TestSleepCmdFlagValidation(t *testing.T) {
t.Parallel()
tests := []flagTestCase{
Expand Down
3 changes: 1 addition & 2 deletions cmd/gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ func main() {
rootCmd := createRootCommand()

rootCmd.AddCommand(
createStaticModeCommand(),
createProvisionerModeCommand(),
createControllerCommand(),
createInitializeCommand(),
createSleepCommand(),
)
Expand Down
82 changes: 0 additions & 82 deletions config/tests/static-deployment.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/aws-nlb/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/azure/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/default/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/experimental-nginx-plus/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/experimental/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/nginx-plus/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/nodeport/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/openshift/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/snippets-filters-nginx-plus/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
2 changes: 1 addition & 1 deletion deploy/snippets-filters/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ spec:
spec:
containers:
- args:
- static-mode
- controller
- --gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
- --gatewayclass=nginx
- --config=nginx-gateway-config
Expand Down
5 changes: 2 additions & 3 deletions docs/developer/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ To create a new release, follow these steps:
1. Kick off the [longevity tests](https://github.com/nginx/nginx-gateway-fabric/blob/main/tests/README.md#longevity-testing) for both OSS and Plus. You'll need to create two clusters and VMs for this. Before running, update your `vars.env` file with the proper image tag and prefixes. NGF and nginx images will be available from `ghcr.io`, and nginx plus will be available in GCP (`us-docker.pkg.dev/<GCP_PROJECT_ID>/nginx-gateway-fabric/nginx-plus`). These tests need to run for 4 days before releasing. The results should be committed to the main branch and then cherry-picked to the release branch.
2. Kick off the [NFR workflow](https://github.com/nginx/nginx-gateway-fabric/actions/workflows/nfr.yml) in the browser. For `image_tag`, use `release-X.X-rc`, and for `version`, use the upcoming `X.Y.Z` NGF version. Run the workflow on the new release branch. This will run all of the NFR tests which are automated and open a PR with the results files when it is complete. Review this PR and make any necessary changes before merging. Once merged, be sure to cherry-pick the commit to the main branch as well (the original PR targets the release branch).
5. Run the [Release PR](https://github.com/nginx/nginx-gateway-fabric/actions/workflows/release-pr.yml) workflow to update the repo files for the release. Then there are a few manual steps to complete:
1. Update the version tag used in the [provisioner manifest](/tests/conformance/provisioner/provisioner.yaml) and [getting started guide](/site/content/get-started.md).
2. Update the [README](/README.md) to include information about the release.
3. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly.
1. Update the [README](/README.md) to include information about the release.
2. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly.
- At the top there will be a list of all PRs that are labeled with `release-notes`.
The changelog includes only important (from the user perspective)
changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next
Expand Down
2 changes: 1 addition & 1 deletion docs/proposals/nginx-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ spec:
name: my-annotation
```

Infrastructure labels and annotations should be applied to all resources created in response to the Gateway. This only applies to _automated deployments_ (i.e., provisioner mode), implementations that automatically deploy the data plane based on a Gateway.
Infrastructure labels and annotations should be applied to all resources created in response to the Gateway.
Other use cases for this API are Service type, Service IP, CPU memory requests, affinity rules, and Gateway routability (public, private, and cluster).

### TLS Options
Expand Down
11 changes: 0 additions & 11 deletions embedded.go

This file was deleted.

Loading

0 comments on commit afa658a

Please sign in to comment.