Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1alpha1/gatewayproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ type ControlPlaneProvider struct {

Service *ProviderService `json:"service,omitempty"`
// TlsVerify specifies whether to verify the TLS certificate of the control plane.
// Defaults to true. Setting it to false disables certificate verification and
// exposes the AdminKey to man-in-the-middle attacks over https endpoints.
// +optional
// +kubebuilder:default=true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This default breaks the live suites in this PR: the July 25 E2E rerun sends tlsSkipVerify:false to the HTTPS control plane and every sync returns self-signed certificate; the conformance and three E2E jobs fail for the same reason. This is not only test plumbing: ControlPlaneProvider and the ADC task expose no CA bundle, so private-CA deployments can only set tlsVerify:false. Please provide a trusted-CA path and an upgrade migration, then update the generated test and example GatewayProxy manifests before changing the default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in the latest push:

  • Control-plane CA support has landed in feat: support a CA bundle for the control plane connection #447, the ADC-side support has landed in feat(server): support custom tls config per endpoint adc#552, and the controller now pins ADC 0.29.0.
  • All four self-signed local examples explicitly set tlsVerify: false and label it as development-only.
  • Both API7 E2E GatewayProxy templates that use the self-signed HTTPS dashboard endpoint now explicitly set tlsVerify: false.
  • The upgrade guide documents the effect of CRD defaulting on existing GatewayProxy objects and the migration paths through the system trust store, caCert, or a temporary development opt-out.
  • The branch is merged with current master; translator, scaffold, and API7 E2E packages compile successfully.

TlsVerify *bool `json:"tlsVerify,omitempty"`

// CaCert specifies the CA certificate used to verify the control plane's TLS
Expand Down
7 changes: 5 additions & 2 deletions config/crd-nocel/apisix.apache.org_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2309,8 +2309,11 @@ spec:
- name
type: object
tlsVerify:
description: TlsVerify specifies whether to verify the TLS
certificate of the control plane.
default: true
description: |-
TlsVerify specifies whether to verify the TLS certificate of the control plane.
Defaults to true. Setting it to false disables certificate verification and
exposes the AdminKey to man-in-the-middle attacks over https endpoints.
type: boolean
required:
- auth
Expand Down
7 changes: 5 additions & 2 deletions config/crd/bases/apisix.apache.org_gatewayproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ spec:
- name
type: object
tlsVerify:
description: TlsVerify specifies whether to verify the TLS
certificate of the control plane.
default: true
description: |-
TlsVerify specifies whether to verify the TLS certificate of the control plane.
Defaults to true. Setting it to false disables certificate verification and
exposes the AdminKey to man-in-the-middle attacks over https endpoints.
type: boolean
required:
- auth
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/reference/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ ControlPlaneProvider defines configuration for control plane provider.
| `mode` _string_ | Mode specifies the mode of control plane provider. Can be `apisix` or `apisix-standalone`. |
| `endpoints` _string array_ | Endpoints specifies the list of control plane endpoints. |
| `service` _[ProviderService](#providerservice)_ | |
| `tlsVerify` _boolean_ | TlsVerify specifies whether to verify the TLS certificate of the control plane. |
| `tlsVerify` _boolean_ | TlsVerify specifies whether to verify the TLS certificate of the control plane. Defaults to true. Setting it to false disables certificate verification and exposes the AdminKey to man-in-the-middle attacks over https endpoints. |
| `caCert` _[ControlPlaneCaCert](#controlplanecacert)_ | CaCert specifies the CA certificate used to verify the control plane's TLS certificate, in place of the system trust store. Set it when the control plane uses a self-signed or private CA certificate. It has no effect when tlsVerify is false. |
| `auth` _[ControlPlaneAuth](#controlplaneauth)_ | Auth specifies the authentication configuration. |

Expand Down
22 changes: 21 additions & 1 deletion docs/en/latest/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ keywords:
#
-->

## GatewayProxy control-plane TLS verification

TLS certificate verification is enabled by default for HTTPS control-plane
connections. Kubernetes CRD defaulting also applies to existing `GatewayProxy`
objects when they are read after the CRD is upgraded. As a result, an existing
object that omits `spec.provider.controlPlane.tlsVerify` will begin verifying
the control plane's certificate after upgrading to a release that contains
this change.

Before upgrading, check every `GatewayProxy` that uses an HTTPS control-plane
endpoint:

- No change is required when the certificate is trusted by the system trust
store.
- For a self-signed certificate or private CA, configure the PEM-encoded CA
certificate or bundle in `spec.provider.controlPlane.caCert.value`.
- Use `spec.provider.controlPlane.tlsVerify: false` only as a temporary
development workaround. It disables certificate verification and exposes
the AdminKey to man-in-the-middle attacks.

## Upgrading from 1.x.x to 2.0.0: Key Changes and Considerations

This document outlines the major updates, configuration compatibility changes, API behavior differences, and critical considerations when upgrading the APISIX Ingress Controller from version 1.x.x to 2.0.0. Please read carefully and assess the impact on your existing system before proceeding with the upgrade.
Expand Down Expand Up @@ -128,7 +148,7 @@ spec:
type: ControlPlane
controlPlane:
endpoints:
- https://127.0.0.1:9180
- http://127.0.0.1:9180
auth:
type: AdminKey
adminKey:
Expand Down
2 changes: 2 additions & 0 deletions examples/httpbin/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
controlPlane:
endpoints:
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
# The local quick-start endpoint uses a self-signed development certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
2 changes: 2 additions & 0 deletions examples/httpbin/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ spec:
controlPlane:
endpoints:
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
# The local quick-start endpoint uses a self-signed development certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
2 changes: 2 additions & 0 deletions examples/httpbin/quickstart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ spec:
controlPlane:
endpoints:
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
# The local quick-start endpoint uses a self-signed development certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
2 changes: 2 additions & 0 deletions examples/httpbin/tcproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
controlPlane:
endpoints:
- ${ADMIN_ENDPOINT} # https://127.0.0.1:7443
# The local quick-start endpoint uses a self-signed development certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
3 changes: 3 additions & 0 deletions internal/adc/translator/gatewayproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func (t *Translator) TranslateGatewayProxyToConfig(tctx *provider.TranslateConte
BackendType: cp.Mode,
}

// Verify the control plane's TLS certificate by default; only an explicit
// tlsVerify:false opts out.
cfg.TlsVerify = true
if cp.TlsVerify != nil {
cfg.TlsVerify = *cp.TlsVerify
}
Expand Down
23 changes: 23 additions & 0 deletions internal/adc/translator/gatewayproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,29 @@ func newGatewayProxy(tlsVerify *bool, caCert string) *v1alpha1.GatewayProxy {
}
}

func TestTranslateGatewayProxyToConfig_TlsVerifyDefault(t *testing.T) {
cases := []struct {
name string
tlsVerify *bool
want bool
}{
{"unset defaults to verify", nil, true},
{"explicit false opts out", ptr.To(false), false},
{"explicit true verifies", ptr.To(true), true},
}

translator := NewTranslator(logr.Discard(), "")
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
tctx := provider.NewDefaultTranslateContext(context.Background())
cfg, err := translator.TranslateGatewayProxyToConfig(tctx, newGatewayProxy(c.tlsVerify, ""), false)
require.NoError(t, err)
require.NotNil(t, cfg)
require.Equal(t, c.want, cfg.TlsVerify)
})
}
}

func TestTranslateGatewayProxyToConfigCaCert(t *testing.T) {
t.Run("carries the CA certificate into the config", func(t *testing.T) {
tr := &Translator{Log: logr.Discard()}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/api7/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ spec:
controlPlane:
endpoints:
- https://api7ee3-dashboard:7443
# The API7 E2E dashboard uses a self-signed test certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/scaffold/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ spec:
controlPlane:
endpoints:
- %s
# The API7 E2E dashboard uses a self-signed test certificate.
tlsVerify: false
auth:
type: AdminKey
adminKey:
Expand Down
Loading