Backport of docs: Fix Kubernetes CRD example configs into release/1.16.x (#19438)

docs: Fix Kubernetes CRD example configs (#18878)

Fixes configuration examples for several Consul Kubernetes CRDs. The
CRDs were missing required fields such as `apiVersion`, `metadata`,
and `spec`.

Co-authored-by: Tu Nguyen <im2nguyen@gmail.com>
This commit is contained in:
Blake Covarrubias 2023-10-31 09:07:06 -04:00 committed by GitHub
parent f0c23587e0
commit 588e108c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 156 additions and 126 deletions

View File

@ -87,20 +87,25 @@ Catalog = {
``` ```
```yaml ```yaml
kind: control-plane-request-limit apiVersion: consul.hashicorp.com/v1alpha1
mode: permissive kind: ControlPlaneRequestLimit
name: <name-for-the-entry> metadata:
read_rate: 100 name: <name-for-the-entry>
write_rate: 100 spec:
kv: mode: permissive
read_rate: 100 # the maximum number of read requests per second that the agent allows.
write_rate: 100 readRate: 100
acl: # the maximum number of write requests per second that the agent allows.
read_rate: 100 writeRate: 100
write_rate: 100 kv:
catalog: readRate: 100
read_rate: 100 writeRate: 100
write_rate: 100 acl:
readRate: 100
writeRate: 100
catalog:
readRate: 100
writeRate: 100
``` ```
</CodeTabs> </CodeTabs>

View File

@ -1281,12 +1281,12 @@ Forwarding = {
```yaml ```yaml
apiVersion: consul.hashicorp.com/v1alpha1 apiVersion: consul.hashicorp.com/v1alpha1
kind: jwtProvider kind: JWTProvider
metadata: metadata:
name: okta name: okta
spec: spec:
issuer: okta issuer: okta
jsonwebkeyset: jsonWebKeySet:
remote: remote:
uri: https://<org>.okta.com/oauth2/default/v1/keys uri: https://<org>.okta.com/oauth2/default/v1/keys
cacheDuration: 30m cacheDuration: 30m

View File

@ -15,13 +15,13 @@ Datacenters can reside in different clouds or runtime environments where general
Mesh gateways can be used with any of the following Consul configurations for managing separate datacenters or partitions. Mesh gateways can be used with any of the following Consul configurations for managing separate datacenters or partitions.
1. WAN Federation 1. WAN Federation
* [Mesh gateways can be used to route service-to-service traffic between datacenters](/consul/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters) * [Mesh gateways can be used to route service-to-service traffic between datacenters](/consul/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters)
* [Mesh gateways can be used to route all WAN traffic, including from Consul servers](/consul/docs/connect/gateways/mesh-gateway/wan-federation-via-mesh-gateways) * [Mesh gateways can be used to route all WAN traffic, including from Consul servers](/consul/docs/connect/gateways/mesh-gateway/wan-federation-via-mesh-gateways)
2. Cluster Peering 2. Cluster Peering
* [Mesh gateways can be used to route service-to-service traffic between datacenters](/consul/docs/connect/cluster-peering/usage/establish-cluster-peering) * [Mesh gateways can be used to route service-to-service traffic between datacenters](/consul/docs/connect/cluster-peering/usage/establish-cluster-peering)
* [Mesh gateways can be used to route control-plane traffic from Consul servers](/consul/docs/connect/gateways/mesh-gateway/peering-via-mesh-gateways) * [Mesh gateways can be used to route control-plane traffic from Consul servers](/consul/docs/connect/gateways/mesh-gateway/peering-via-mesh-gateways)
3. Admin Partitions 3. Admin Partitions
* [Mesh gateways can be used to route service-to-service traffic between admin partitions in the same Consul datacenter](/consul/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions) * [Mesh gateways can be used to route service-to-service traffic between admin partitions in the same Consul datacenter](/consul/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions)
### Consul ### Consul
@ -84,21 +84,24 @@ Use the following example configurations to help you understand some of the comm
The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode. The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode.
<CodeTabs heading="Example: Enabling gateways globally."> <CodeTabs heading="Example: Enabling gateways globally">
```hcl ```hcl
Kind = "proxy-defaults" Kind = "proxy-defaults"
Name = "global" Name = "global"
MeshGateway { MeshGateway {
Mode = "local" Mode = "local"
} }
``` ```
```yaml ```yaml
Kind: proxy-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ProxyDefaults
- Mode: local metadata:
Name: global name: global
spec:
meshGateway:
mode: local
``` ```
```json ```json
@ -123,15 +126,18 @@ The following `service-defaults` configuration will enable gateways for all mesh
Kind = "service-defaults" Kind = "service-defaults"
Name = "web" Name = "web"
MeshGateway { MeshGateway {
Mode = "local" Mode = "local"
} }
``` ```
```yaml ```yaml
Kind: service-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ServiceDefaults
- Mode: local metadata:
Name: web name: web
spec:
meshGateway:
mode: local
``` ```
```json ```json
@ -155,22 +161,22 @@ The following [proxy service configuration](/consul/docs/connect/proxies/deploy-
```hcl ```hcl
service { service {
name = "web-sidecar-proxy" name = "web-sidecar-proxy"
kind = "connect-proxy" kind = "connect-proxy"
port = 8181 port = 8181
proxy { proxy {
destination_service_name = "web" destination_service_name = "web"
mesh_gateway { mesh_gateway {
mode = "remote" mode = "remote"
}
upstreams = [
{
destination_name = "api"
datacenter = "secondary"
local_bind_port = 10000
} }
upstreams = [ ]
{ }
destination_name = "api"
datacenter = "secondary"
local_bind_port = 10000
}
]
}
} }
# Or alternatively inline with the service definition: # Or alternatively inline with the service definition:
@ -230,38 +236,38 @@ The following service definition will enable gateways in the `local` mode for on
```hcl ```hcl
service { service {
name = "web-sidecar-proxy" name = "web-sidecar-proxy"
kind = "connect-proxy" kind = "connect-proxy"
port = 8181 port = 8181
proxy { proxy {
destination_service_name = "web" destination_service_name = "web"
upstreams = [ upstreams = [
{ {
destination_name = "api" destination_name = "api"
destination_peer = "cluster-01" destination_peer = "cluster-01"
local_bind_port = 10000 local_bind_port = 10000
mesh_gateway { mesh_gateway {
mode = "remote" mode = "remote"
} }
}, },
{ {
destination_name = "db" destination_name = "db"
datacenter = "secondary" datacenter = "secondary"
local_bind_port = 10001 local_bind_port = 10001
mesh_gateway { mesh_gateway {
mode = "local" mode = "local"
} }
}, },
{ {
destination_name = "logging" destination_name = "logging"
datacenter = "secondary" datacenter = "secondary"
local_bind_port = 10002 local_bind_port = 10002
mesh_gateway { mesh_gateway {
mode = "none" mode = "none"
} }
}, },
] ]
} }
} }
``` ```
```json ```json

View File

@ -121,9 +121,13 @@ Peering {
``` ```
```yaml ```yaml
Kind: mesh apiVersion: consul.hashicorp.com/v1alpha1
Peering: kind: Mesh
PeerThroughMeshGateways: true metadata:
name: mesh
spec:
peering:
peerThroughMeshGateways: true
``` ```
</CodeTabs> </CodeTabs>

View File

@ -78,7 +78,7 @@ Use the following example configurations to help you understand some of the comm
The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode. The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode.
<CodeTabs heading="Example: Enabling gateways globally."> <CodeTabs heading="Example: Enabling gateways globally">
```hcl ```hcl
Kind = "proxy-defaults" Kind = "proxy-defaults"
@ -89,10 +89,13 @@ MeshGateway {
``` ```
```yaml ```yaml
Kind: proxy-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ProxyDefaults
- Mode: local metadata:
Name: global name: global
spec:
meshGateway:
mode: local
``` ```
```json ```json
@ -122,10 +125,13 @@ MeshGateway {
``` ```
```yaml ```yaml
Kind: service-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ServiceDefaults
- Mode: local metadata:
Name: web name: web
spec:
meshGateway:
mode: local
``` ```
```json ```json

View File

@ -94,7 +94,7 @@ Use the following example configurations to help you understand some of the comm
The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode. The following `proxy-defaults` configuration will enable gateways for all mesh services in the `local` mode.
<CodeTabs heading="Example: Enabling gateways globally."> <CodeTabs heading="Example: Enabling gateways globally">
```hcl ```hcl
Kind = "proxy-defaults" Kind = "proxy-defaults"
@ -105,10 +105,13 @@ MeshGateway {
``` ```
```yaml ```yaml
Kind: proxy-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ProxyDefaults
- Mode: local metadata:
Name: global name: global
spec:
meshGateway:
mode: local
``` ```
```json ```json
@ -137,10 +140,13 @@ MeshGateway {
``` ```
```yaml ```yaml
Kind: service-defaults apiVersion: consul.hashicorp.com/v1alpha1
MeshGateway: kind: ServiceDefaults
- Mode: local metadata:
Name: web name: web
spec:
meshGateway:
mode: local
``` ```
```json ```json

View File

@ -80,7 +80,7 @@ EnvoyExtensions = [
</CodeBlockConfig> </CodeBlockConfig>
</Tab> </Tab>
<Tab heading="Kubernetes" group="yaml"> <Tab heading="Kubernetes" group="yaml">
<CodeBlockConfig filename="api-auth-service-defaults"> <CodeBlockConfig filename="api-auth-service-defaults.yaml">
```yaml ```yaml
apiVersion: consul.hashicorp.com/v1alpha1 apiVersion: consul.hashicorp.com/v1alpha1

View File

@ -222,4 +222,4 @@ end
] ]
``` ```
</CodeBlockConfig> </CodeBlockConfig>

View File

@ -125,30 +125,33 @@ EOF
<CodeBlockConfig filename="wasm-extension-serve-waf.yaml"> <CodeBlockConfig filename="wasm-extension-serve-waf.yaml">
```yaml ```yaml
kind: service-defaults apiVersion: consul.hashicorp.com/v1alpha1
name: api kind: ServiceDefaults
protocol: http metadata:
envoyExtensions: name: api
- name: builtin/wasm spec:
required: true protocol: http
arguments: envoyExtensions:
protocol: http - name: builtin/wasm
listenerType: inbound required: true
pluginConfig: arguments:
VmConfig: protocol: http
Code: listenerType: inbound
Remote: pluginConfig:
HttpURI: VmConfig:
Service: Code:
Name: file-server Remote:
URI: https://file-server/waf.wasm HttpURI:
Configuration: Service:
rules: Name: file-server
- Include @demo-conf URI: https://file-server/waf.wasm
- Include @crs-setup-demo-conf Configuration:
- SecDebugLogLevel 9 rules:
- SecRuleEngine On - Include @demo-conf
- Include @owasp_crs/*.conf - Include @crs-setup-demo-conf
- SecDebugLogLevel 9
- SecRuleEngine On
- Include @owasp_crs/*.conf
``` ```
</CodeBlockConfig> </CodeBlockConfig>