Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcode for NIC version in docs #5953

Merged
merged 11 commits into from
Jul 5, 2024
39 changes: 21 additions & 18 deletions .github/scripts/release-version-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ FILE_TO_UPDATE_HELM_CHART_VERSION=(
)

usage() {
echo "Usage: $0 <current_ic_version> <current_helm_chart_version> <new_ic_version> <new_helm_chart_version>"
echo "Usage: $0 <current_ic_version> <current_helm_chart_version> <current_operator_version> <new_ic_version> <new_helm_chart_version> <new_operator_version>"
exit 1
}

current_ic_version=$1
current_helm_chart_version=$2
new_ic_version=$3
new_helm_chart_version=$4
current_operator_version=$3
new_ic_version=$4
new_helm_chart_version=$5
new_operator_version=$6

if [ -z "${current_ic_version}" ]; then
usage
Expand All @@ -46,6 +48,10 @@ if [ -z "${current_helm_chart_version}" ]; then
usage
fi

if [ -z "${current_operator_version}" ]; then
usage
fi

if [ -z "${new_ic_version}" ]; then
usage
fi
Expand All @@ -54,15 +60,23 @@ if [ -z "${new_helm_chart_version}" ]; then
usage
fi

if [ -z "${new_operator_version}" ]; then
usage
fi


escaped_current_ic_version=$(printf '%s' "$current_ic_version" | sed -e 's/\./\\./g');
escaped_current_helm_chart_version=$(printf '%s' "$current_helm_chart_version" | sed -e 's/\./\\./g');
escaped_current_operator_version=$(printf '%s' "$current_operator_version" | sed -e 's/\./\\./g');

echo "Updating versions: "
echo "ic_version: ${current_ic_version} -> ${new_ic_version}"
echo "helm_chart_version: ${current_helm_chart_version} -> ${new_helm_chart_version}"
echo "operator_version: ${current_operator_version} -> ${new_operator_version}"

regex_ic="s#$escaped_current_ic_version#$new_ic_version#g"
regex_helm="s#$escaped_current_helm_chart_version#$new_helm_chart_version#g"
regex_operator="s#$escaped_current_operator_version#$new_operator_version#g"

mv "${HELM_CHART_PATH}/values.schema.json" "${TMPDIR}/"
jq --arg version "${new_ic_version}" \
Expand Down Expand Up @@ -107,20 +121,9 @@ for i in "${FILE_TO_UPDATE_HELM_CHART_VERSION[@]}"; do
done

# update docs with new versions
docs_files=$(find "${DOCS_TO_UPDATE_FOLDER}" -type f -name "*.md" ! -name releases.md ! -name CHANGELOG.md)
for i in ${docs_files}; do
if [ "${DEBUG}" != "false" ]; then
echo "Processing ${i}"
fi
file_name=$(basename "${i}")
mv "${i}" "${TMPDIR}/${file_name}"
cat "${TMPDIR}/${file_name}" | sed -e "$regex_ic" | sed -e "$regex_helm" > "${i}"
if [ $? -ne 0 ]; then
echo "ERROR: failed processing ${i}"
mv "${TMPDIR}/${file_name}" "${i}"
exit 2
fi
done
echo -n "${new_ic_version}" > ./docs/layouts/shortcodes/nic-version.html
echo -n "${new_helm_chart_version}" > ./docs/layouts/shortcodes/nic-helm-version.html
echo -n "${new_operator_version}" > ./docs/layouts/shortcodes/nic-operator-version.html

# update examples with new versions
example_files=$(find "${EXAMPLES_PATH}" -type f -name "*.md")
Expand All @@ -130,7 +133,7 @@ for i in ${example_files}; do
fi
file_name=$(basename "${i}")
mv "${i}" "${TMPDIR}/${file_name}"
cat "${TMPDIR}/${file_name}" | sed -e "$regex_ic" | sed -e "$regex_helm" > "${i}"
cat "${TMPDIR}/${file_name}" | sed -e "$regex_ic" | sed -e "$regex_helm" | sed -e "$regex_operator" > "${i}"
if [ $? -ne 0 ]; then
echo "ERROR: failed processing ${i}"
mv "${TMPDIR}/${file_name}" "${i}"
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ on:
description: "Helm version to release"
required: true
default: "1.1.3"
current_operator_version:
description: "Current operator version to replace"
required: true
default: "2.3.0"
new_operator_version:
description: "Operator version to release"
required: true
default: "2.3.1"
k8s_versions:
description: "Kubernetes versions this release has been tested on"
required: true
Expand Down Expand Up @@ -56,7 +64,9 @@ jobs:

- name: Replace
run: |
.github/scripts/release-version-update.sh ${{ github.event.inputs.current_version }} ${{ github.event.inputs.current_helm_version }} ${{ github.event.inputs.new_version }} ${{ github.event.inputs.new_helm_version }}
.github/scripts/release-version-update.sh \
${{ github.event.inputs.current_version }} ${{ github.event.inputs.current_helm_version }} ${{ github.event.inputs.current_operator_version }} \
${{ github.event.inputs.new_version }} ${{ github.event.inputs.new_helm_version }} ${{ github.event.inputs.new_operator_version }}
.github/scripts/release-notes-update.sh ${{ github.event.inputs.new_version }} ${{ github.event.inputs.new_helm_version }} "${{ github.event.inputs.k8s_versions }}" "${{ github.event.inputs.release_date }}"

- name: Create Pull Request
Expand Down
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repos:
- id: trailing-whitespace
exclude: '(\.md|\.snap)$'
- id: end-of-file-fixer
exclude: docs/layouts/shortcodes/nic-.*.html
- id: check-yaml
args: [--allow-multiple-documents]
exclude: ^(charts/nginx-ingress/templates)
Expand Down Expand Up @@ -68,7 +69,12 @@ repos:
hooks:
- id: autoflake
files: tests/.*\.py$
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]

- repo: https:/python-jsonschema/check-jsonschema
rev: 0.28.6
Expand All @@ -94,7 +100,7 @@ repos:
types: ["yaml"]
files: ^\.github/workflows/
entry: actionlint
args: ["-shellcheck",""]
args: ["-shellcheck", ""]

ci:
skip: [golang-diff, golangci-lint, check-jsonschema, markdownlint-cli2]
4 changes: 2 additions & 2 deletions docs/content/configuration/configuration-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ weight: 400

Our [GitHub repo](https:/nginxinc/kubernetes-ingress) includes a number of configuration examples:

- [*Examples of Custom Resources*](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/custom-resources) show how to advanced NGINX features by using VirtualServer, VirtualServerRoute, TransportServer and Policy Custom Resources.
- [*Examples of Ingress Resources*](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources) show how to use advanced NGINX features in Ingress resources with annotations.
- [*Examples of Custom Resources*](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/custom-resources) show how to advanced NGINX features by using VirtualServer, VirtualServerRoute, TransportServer and Policy Custom Resources.
- [*Examples of Ingress Resources*](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources) show how to use advanced NGINX features in Ingress resources with annotations.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ For more information, view the [VirtualServer and VirtualServerRoute resources](
|*server-names-hash-max-size* | Sets the value of the [server_names_hash_max_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#server_names_hash_max_size) directive. | *1024* | |
|*map-hash-bucket-size* | Sets the value of the [map_hash_bucket_size](http://nginx.org/en/docs/http/ngx_http_map_module.html#map_hash_bucket_size) directive.| *256* | |
|*map-hash-max-size* | Sets the value of the [map_hash_max_size](http://nginx.org/en/docs/http/ngx_http_map_module.html#map_hash_max_size) directive. | *2048* | |
|*resolver-addresses* | Sets the value of the [resolver](https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver) addresses. Note: If you use a DNS name (for example, *kube-dns.kube-system.svc.cluster.local* ) as a resolver address, NGINX Plus will resolve it using the system resolver during the start and on every configuration reload. If the name cannot be resolved or the DNS server doesn't respond, NGINX Plus will fail to start or reload. To avoid this, we recommend using IP addresses as resolver addresses instead of DNS names. Supported in NGINX Plus only. | N/A | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources/externalname-services). |
|*resolver-ipv6* | Enables IPv6 resolution in the resolver. Supported in NGINX Plus only. | *True* | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources/externalname-services). |
|*resolver-valid* | Sets the time NGINX caches the resolved DNS records. Supported in NGINX Plus only. | TTL value of a DNS record | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources/externalname-services). |
|*resolver-timeout* | Sets the [resolver_timeout](https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver_timeout) for name resolution. Supported in NGINX Plus only. | *30s* | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources/externalname-services). |
|*resolver-addresses* | Sets the value of the [resolver](https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver) addresses. Note: If you use a DNS name (for example, *kube-dns.kube-system.svc.cluster.local* ) as a resolver address, NGINX Plus will resolve it using the system resolver during the start and on every configuration reload. If the name cannot be resolved or the DNS server doesn't respond, NGINX Plus will fail to start or reload. To avoid this, we recommend using IP addresses as resolver addresses instead of DNS names. Supported in NGINX Plus only. | N/A | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/externalname-services). |
|*resolver-ipv6* | Enables IPv6 resolution in the resolver. Supported in NGINX Plus only. | *True* | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/externalname-services). |
|*resolver-valid* | Sets the time NGINX caches the resolved DNS records. Supported in NGINX Plus only. | TTL value of a DNS record | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/externalname-services). |
|*resolver-timeout* | Sets the [resolver_timeout](https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver_timeout) for name resolution. Supported in NGINX Plus only. | *30s* | [Support for Type ExternalName Services](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/externalname-services). |
|*keepalive-timeout* | Sets the value of the [keepalive_timeout](https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout) directive. | *75s* | |
|*keepalive-requests* | Sets the value of the [keepalive_requests](https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests) directive. | *1000* | |
|*variables-hash-bucket-size* | Sets the value of the [variables_hash_bucket_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#variables_hash_bucket_size) directive. | *256* | |
Expand All @@ -115,9 +115,9 @@ For more information, view the [VirtualServer and VirtualServerRoute resources](
|*error-log-level* | Sets the global [error log level](https://nginx.org/en/docs/ngx_core_module.html#error_log) for NGINX. | *notice* | |
|*access-log-off* | Disables the [access log](https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log). | *False* | |
|*default-server-access-log-off* | Disables the [access log](https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log) for the default server. If access log is disabled globally (*access-log-off: "True"*), then the default server access log is always disabled. | *False* | |
|*log-format* | Sets the custom [log format](https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format) for HTTP and HTTPS traffic. For convenience, it is possible to define the log format across multiple lines (each line separated by *\n*). In that case, the Ingress Controller will replace every *\n* character with a space character. All *'* characters must be escaped. | See the [template file](https:/nginxinc/kubernetes-ingress/blob/v3.6.1/internal/configs/version1/nginx.tmpl) for the access log. | [Custom Log Format](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/shared-examples/custom-log-format). |
|*log-format* | Sets the custom [log format](https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format) for HTTP and HTTPS traffic. For convenience, it is possible to define the log format across multiple lines (each line separated by *\n*). In that case, the Ingress Controller will replace every *\n* character with a space character. All *'* characters must be escaped. | See the [template file](https:/nginxinc/kubernetes-ingress/blob/v{{< nic-version >}}/internal/configs/version1/nginx.tmpl) for the access log. | [Custom Log Format](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/shared-examples/custom-log-format). |
|*log-format-escaping* | Sets the characters escaping for the variables of the log format. Supported values: *json* (JSON escaping), *default* (the default escaping) *none* (disables escaping). | *default* | |
|*stream-log-format* | Sets the custom [log format](https://nginx.org/en/docs/stream/ngx_stream_log_module.html#log_format) for TCP, UDP, and TLS Passthrough traffic. For convenience, it is possible to define the log format across multiple lines (each line separated by *\n*). In that case, the Ingress Controller will replace every *\n* character with a space character. All *'* characters must be escaped. | See the [template file](https:/nginxinc/kubernetes-ingress/blob/v3.6.1/internal/configs/version1/nginx.tmpl). | |
|*stream-log-format* | Sets the custom [log format](https://nginx.org/en/docs/stream/ngx_stream_log_module.html#log_format) for TCP, UDP, and TLS Passthrough traffic. For convenience, it is possible to define the log format across multiple lines (each line separated by *\n*). In that case, the Ingress Controller will replace every *\n* character with a space character. All *'* characters must be escaped. | See the [template file](https:/nginxinc/kubernetes-ingress/blob/v{{< nic-version >}}/internal/configs/version1/nginx.tmpl). | |
|*stream-log-format-escaping* | Sets the characters escaping for the variables of the stream log format. Supported values: *json* (JSON escaping), *default* (the default escaping) *none* (disables escaping). | *default* | |
{{</bootstrap-table>}}

Expand Down Expand Up @@ -159,7 +159,7 @@ For more information, view the [VirtualServer and VirtualServerRoute resources](
|ConfigMap Key | Description | Default | Example |
| ---| ---| ---| --- |
|*http2* | Enables HTTP/2 in servers with SSL enabled. | *False* | |
|*proxy-protocol* | Enables PROXY Protocol for incoming connections. | *False* | [Proxy Protocol](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/shared-examples/proxy-protocol). |
|*proxy-protocol* | Enables PROXY Protocol for incoming connections. | *False* | [Proxy Protocol](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/shared-examples/proxy-protocol). |
{{</bootstrap-table>}}

---
Expand Down Expand Up @@ -187,7 +187,7 @@ For more information, view the [VirtualServer and VirtualServerRoute resources](
|*http-snippets* | Sets a custom snippet in http context. | N/A | |
|*location-snippets* | Sets a custom snippet in location context. | N/A | |
|*server-snippets* | Sets a custom snippet in server context. | N/A | |
|*stream-snippets* | Sets a custom snippet in stream context. | N/A | [Support for TCP/UDP Load Balancing](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/ingress-resources/tcp-udp). |
|*stream-snippets* | Sets a custom snippet in stream context. | N/A | [Support for TCP/UDP Load Balancing](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/ingress-resources/tcp-udp). |
|*main-template* | Sets the main NGINX configuration template. | By default the template is read from the file in the container. | [Custom Templates](/nginx-ingress-controller/configuration/global-configuration/custom-templates). |
|*ingress-template* | Sets the NGINX configuration template for an Ingress resource. | By default the template is read from the file on the container. | [Custom Templates](/nginx-ingress-controller/configuration/global-configuration/custom-templates). |
|*virtualserver-template* | Sets the NGINX configuration template for an VirtualServer resource. | By default the template is read from the file on the container. | [Custom Templates](/nginx-ingress-controller/configuration/global-configuration/custom-templates). |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ weight: 500
---


F5 NGINX Ingress Controller uses templates to generate NGINX configuration for Ingress resources, VirtualServer resources and the main NGINX configuration file. You can customize the templates and apply them via the ConfigMap. See the [corresponding example](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/shared-examples/custom-templates).
F5 NGINX Ingress Controller uses templates to generate NGINX configuration for Ingress resources, VirtualServer resources and the main NGINX configuration file. You can customize the templates and apply them via the ConfigMap. See the [corresponding example](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/shared-examples/custom-templates).
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ It is possible to merge configuration for multiple Ingress resources for the sam

The [Cross-namespace configuration]({{< relref "configuration/ingress-resources/cross-namespace-configuration.md">}}) topic has more information.

It is *not* possible to merge the configurations for multiple VirtualServer resources for the same host. However, you can split the VirtualServers into multiple VirtualServerRoute resources, which a single VirtualServer can then reference. See the [corresponding example](https:/nginxinc/kubernetes-ingress/tree/v3.6.1/examples/custom-resources/cross-namespace-configuration) on GitHub.
It is *not* possible to merge the configurations for multiple VirtualServer resources for the same host. However, you can split the VirtualServers into multiple VirtualServerRoute resources, which a single VirtualServer can then reference. See the [corresponding example](https:/nginxinc/kubernetes-ingress/tree/v{{< nic-version >}}/examples/custom-resources/cross-namespace-configuration) on GitHub.

It is *not* possible to merge configuration for multiple TransportServer resources.

Expand Down
Loading