Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Add max connections configuration to GatewayClassConfig CRD #405

Merged
merged 5 commits into from
Oct 27, 2022

Conversation

nathancoleman
Copy link
Member

@nathancoleman nathancoleman commented Oct 11, 2022

Changes proposed in this PR:

Add a new field to our GatewayClassConfig CRD that is piped down to the ingress-gateway config entry for overriding the default connection maximum in Envoy (1,024)

How I've tested this PR:

Create new Gateways with and without this setting in the GatewayClassConfig. For each Gateway, check the corresponding ingress-gateway config entry in Consul for the proper override.

Example
$ kubectl get gatewayclassconfig consul-api-gateway -o yaml | yq .spec.connectionManagement
maxConnections: 4096

$ consul config read -kind ingress-gateway -name api-gateway
{
    "Kind": "ingress-gateway",
    "Name": "api-gateway",
    "TLS": {
        "Enabled": false
    },
    "Listeners": null,
    "Meta": {
        "consul-api-gateway/k8s/Gateway.Name": "api-gateway",
        "consul-api-gateway/k8s/Gateway.Namespace": "consul",
        "external-source": "consul-api-gateway"
    },
    "Defaults": {
        "MaxConnections": 4096,
        "MaxPendingRequests": 0,
        "MaxConcurrentRequests": 0
    },
    "CreateIndex": 42,
    "ModifyIndex": 42
}

How I expect reviewers to test this PR:

See above

Checklist:

  • Tests added
  • CHANGELOG entry added

    Run make changelog-entry for guidance in authoring a changelog entry, and
    commit the resulting file, which should have a name matching your PR number.
    Entries should use imperative present tense (e.g. Add support for...)

Notably, K8sGateway.Config was not previously exported and so wasn't included by the marshaler when writing Gateways into the store backend. This meant that the GatewayClassConfig was missing when re-syncing the Gateways from the store into Consul in the background, and so the max_connections value would be lost
go.mod Outdated Show resolved Hide resolved
@nathancoleman nathancoleman self-assigned this Oct 11, 2022
@nathancoleman nathancoleman added pr/no-changelog Skip the CI check that requires a changelog entry do not merge labels Oct 11, 2022
@nathancoleman nathancoleman removed the pr/no-changelog Skip the CI check that requires a changelog entry label Oct 19, 2022
@nathancoleman nathancoleman marked this pull request as ready for review October 19, 2022 20:20
@nathancoleman nathancoleman requested review from mikemorris, sarahalsmiller and andrewstucki and removed request for mikemorris October 19, 2022 20:20
Copy link
Member Author

@nathancoleman nathancoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal review

description: Configuration information for managing connections in
Envoy
properties:
maxConnections:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectionManagement.maxConnections is somewhat long; however, I opted not to abbreviate to something like connMgmt.maxConns since we haven't abbreviated any other parts of the spec.

ID GatewayID
Meta map[string]string
Listeners []ResolvedListener
MaxConnections *uint32
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ResolvedGateway is what we have access to when deriving the ingress-gateway config entry that we're sending to Consul, so it needs to be aware of any config that we depend on there. This is internal, so it can evolve in the future if we wind up having other connection management config values to pipe through.

@@ -20,15 +26,15 @@ type K8sGateway struct {
*gwv1beta1.Gateway
GatewayState *state.GatewayState

config apigwv1alpha1.GatewayClassConfig
Config apigwv1alpha1.GatewayClassConfig
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exported this so that the JSON marshaler includes it when we serialize for writing to the store backend.

If not exported, we don't have any idea what the max connections value is when rehydrating from the store and syncing into Consul, which we do at an interval in the background for resiliency.

Copy link
Member

@sarahalsmiller sarahalsmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, appreciate your clarifying comments as always

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants