Skip to content

Commit b855c1d

Browse files
authored
Merge branch 'main' into docs/proposals/observability-policy
2 parents 2f286b2 + f29eddb commit b855c1d

20 files changed

+1135
-289
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
fail-build: false
153153

154154
- name: Upload scan result to GitHub Security tab
155-
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
155+
uses: github/codeql-action/upload-sarif@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10
156156
continue-on-error: true
157157
with:
158158
sarif_file: ${{ steps.scan.outputs.sarif }}

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
run: make unit-test
7474

7575
- name: Upload coverage reports to Codecov
76-
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1
76+
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
7777
with:
7878
token: ${{ secrets.CODECOV_TOKEN }}
7979

@@ -101,7 +101,7 @@ jobs:
101101
run: npm --prefix ${{ github.workspace }}/internal/mode/static/nginx/modules install-ci-test
102102

103103
- name: Upload coverage reports to Codecov
104-
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1
104+
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
105105
with:
106106
token: ${{ secrets.CODECOV_TOKEN }}
107107

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
47+
uses: github/codeql-action/init@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -63,7 +63,7 @@ jobs:
6363
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6464
# If this step fails, then you should remove it and run the build manually (see below)
6565
- name: Autobuild
66-
uses: github/codeql-action/autobuild@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
66+
uses: github/codeql-action/autobuild@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10
6767

6868
# ℹ️ Command-line programs to run using the OS shell.
6969
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -76,6 +76,6 @@ jobs:
7676
# ./location_of_script_within_repo/buildscript.sh
7777

7878
- name: Perform CodeQL Analysis
79-
uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
79+
uses: github/codeql-action/analyze@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10
8080
with:
8181
category: "/language:${{matrix.language}}"

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060

6161
# Upload the results to GitHub's code scanning dashboard.
6262
- name: "Upload to code-scanning"
63-
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
63+
uses: github/codeql-action/upload-sarif@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10
6464
with:
6565
sarif_file: results.sarif

.yamllint.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ yaml-files:
55

66
ignore:
77
- deploy/helm-chart/templates/
8-
- deploy/helm-chart/crds/
8+
- config/crd/bases/
99
- .github/workflows/
1010

1111
rules:
@@ -30,7 +30,6 @@ rules:
3030
check-multi-line-strings: true
3131
ignore: |
3232
deploy/manifests/nginx-gateway.yaml
33-
deploy/manifests/crds
3433
key-duplicates: enable
3534
key-ordering: disable
3635
line-length:
@@ -40,7 +39,6 @@ rules:
4039
ignore: |
4140
.github/
4241
deploy/manifests/nginx-gateway.yaml
43-
deploy/manifests/crds
4442
tests/suite/manifests/longevity/cronjob.yaml
4543
.goreleaser.yml
4644
new-line-at-end-of-file: enable

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,10 @@ generate: ## Run go generate
100100

101101
.PHONY: generate-crds
102102
generate-crds: ## Generate CRDs and Go types using kubebuilder
103-
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd paths=./apis/... output:crd:dir=deploy/helm-chart/crds
104-
go run sigs.k8s.io/controller-tools/cmd/controller-gen object paths=./apis/...
103+
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
105104

106105
.PHONY: generate-manifests
107106
generate-manifests: ## Generate manifests using Helm.
108-
cp $(CHART_DIR)/crds/* $(MANIFEST_DIR)/crds/
109107
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-gateway.yaml
110108
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) --set nginx.plus=true --set nginx.image.repository=$(NGINX_PLUS_PREFIX) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-plus-gateway.yaml
111109
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) --set nginxGateway.gwAPIExperimentalFeatures.enable=true -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-gateway-experimental.yaml
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
6+
)
7+
8+
// +kubebuilder:object:root=true
9+
// +kubebuilder:storageversion
10+
// +kubebuilder:subresource:status
11+
// +kubebuilder:resource:categories=nginx-gateway-fabric,shortName=cspolicy
12+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
13+
// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=inherited"
14+
15+
// ClientSettingsPolicy is an Inherited Attached Policy. It provides a way to configure the behavior of the connection
16+
// between the client and NGINX Gateway Fabric.
17+
type ClientSettingsPolicy struct {
18+
metav1.TypeMeta `json:",inline"`
19+
metav1.ObjectMeta `json:"metadata,omitempty"`
20+
21+
// Spec defines the desired state of the ClientSettingsPolicy.
22+
Spec ClientSettingsPolicySpec `json:"spec"`
23+
24+
// Status defines the state of the ClientSettingsPolicy.
25+
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
26+
}
27+
28+
// +kubebuilder:object:root=true
29+
30+
// ClientSettingsPolicyList contains a list of ClientSettingsPolicies.
31+
type ClientSettingsPolicyList struct {
32+
metav1.TypeMeta `json:",inline"`
33+
metav1.ListMeta `json:"metadata,omitempty"`
34+
Items []ClientSettingsPolicy `json:"items"`
35+
}
36+
37+
// ClientSettingsPolicySpec defines the desired state of ClientSettingsPolicy.
38+
type ClientSettingsPolicySpec struct {
39+
// TargetRef identifies an API object to apply the policy to.
40+
// Object must be in the same namespace as the policy.
41+
//
42+
// Support: Gateway, HTTPRoute
43+
TargetRef gatewayv1alpha2.PolicyTargetReference `json:"targetRef"`
44+
45+
// Body defines the client request body settings.
46+
//
47+
// +optional
48+
Body *ClientBody `json:"body,omitempty"`
49+
50+
// KeepAlive defines the keep-alive settings.
51+
//
52+
// +optional
53+
KeepAlive *ClientKeepAlive `json:"keepAlive,omitempty"`
54+
}
55+
56+
// ClientBody contains the settings for the client request body.
57+
type ClientBody struct {
58+
// MaxSize sets the maximum allowed size of the client request body.
59+
// If the size in a request exceeds the configured value,
60+
// the 413 (Request Entity Too Large) error is returned to the client.
61+
// Setting size to 0 disables checking of client request body size.
62+
// Default: https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size.
63+
//
64+
// +optional
65+
MaxSize *Size `json:"maxSize,omitempty"`
66+
67+
// Timeout defines a timeout for reading client request body. The timeout is set only for a period between
68+
// two successive read operations, not for the transmission of the whole request body.
69+
// If a client does not transmit anything within this time, the request is terminated with the
70+
// 408 (Request Time-out) error.
71+
// Default: https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout.
72+
//
73+
// +optional
74+
Timeout *Duration `json:"timeout,omitempty"`
75+
}
76+
77+
// ClientKeepAlive defines the keep-alive settings for clients.
78+
type ClientKeepAlive struct {
79+
// Requests sets the maximum number of requests that can be served through one keep-alive connection.
80+
// After the maximum number of requests are made, the connection is closed. Closing connections periodically
81+
// is necessary to free per-connection memory allocations. Therefore, using too high maximum number of requests
82+
// is not recommended as it can lead to excessive memory usage.
83+
// Default: https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests.
84+
//
85+
// +optional
86+
// +kubebuilder:validation:Minimum=0
87+
Requests *int32 `json:"requests,omitempty"`
88+
89+
// Time defines the maximum time during which requests can be processed through one keep-alive connection.
90+
// After this time is reached, the connection is closed following the subsequent request processing.
91+
// Default: https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_time.
92+
//
93+
// +optional
94+
Time *Duration `json:"time,omitempty"`
95+
96+
// Timeout defines the keep-alive timeouts for clients.
97+
//
98+
// +optional
99+
Timeout *ClientKeepAliveTimeout `json:"timeout,omitempty"`
100+
}
101+
102+
// ClientKeepAliveTimeout defines the timeouts related to keep-alive client connections.
103+
// Default: Default: https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout.
104+
type ClientKeepAliveTimeout struct {
105+
// Server sets the timeout during which a keep-alive client connection will stay open on the server side.
106+
// Setting this value to 0 disables keep-alive client connections.
107+
//
108+
// +optional
109+
Server *Duration `json:"server,omitempty"`
110+
111+
// Header sets the timeout in the "Keep-Alive: timeout=time" response header field.
112+
//
113+
// +optional
114+
Header *Duration `json:"header,omitempty"`
115+
}
116+
117+
// Duration is a string value representing a duration in time.
118+
// Duration can be specified in milliseconds (ms) or seconds (s) A value without a suffix is seconds.
119+
// Examples: 120s, 50ms.
120+
//
121+
// +kubebuilder:validation:Pattern=`^\d{1,4}(ms|s)?$`
122+
type Duration string
123+
124+
// Size is a string value representing a size. Size can be specified in bytes, kilobytes (k), megabytes (m),
125+
// or gigabytes (g).
126+
// Examples: 1024, 8k, 1m.
127+
//
128+
// +kubebuilder:validation:Pattern=`^\d{1,4}(k|m|g)?$`
129+
type Size string

apis/v1alpha1/nginxgateway_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
55
// +kubebuilder:object:root=true
66
// +kubebuilder:storageversion
77
// +kubebuilder:subresource:status
8+
// +kubebuilder:resource:categories=nginx-gateway-fabric
9+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
810

911
// NginxGateway represents the dynamic configuration for an NGINX Gateway Fabric control plane.
1012
type NginxGateway struct {

apis/v1alpha1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
3434
scheme.AddKnownTypes(SchemeGroupVersion,
3535
&NginxGateway{},
3636
&NginxGatewayList{},
37+
&ClientSettingsPolicy{},
38+
&ClientSettingsPolicyList{},
3739
)
3840
// AddToGroupVersion allows the serialization of client types like ListOptions.
3941
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

0 commit comments

Comments
 (0)