Skip to content

Commit d273c18

Browse files
authored
refactor(vcluster): move Gateway API and remove cert-manager examples (#701)
1 parent c09a06a commit d273c18

File tree

3 files changed

+68
-29
lines changed

3 files changed

+68
-29
lines changed

platform/install/advanced/air-gapped.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Detailed steps are only provided for how to pull and push the vCluster Platform
280280
<Flow id="offline-helm-chart">
281281
<Step>
282282

283-
:::notes
283+
:::note
284284
If you haven’t already set the environment variables, set them now before continuing.
285285
:::
286286

vcluster/configure/vcluster-yaml/sync/from-host/nodes.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Nodes
33
sidebar_label: nodes
44
sidebar_position: 2
5-
description: Configuration for ...
5+
description: Configuration for node synchronization in vCluster, including pseudo and real node syncing options.
66
---
77

88
import SyncNodes from '../../../../_partials/config/sync/fromHost/nodes.mdx'
@@ -15,10 +15,12 @@ vCluster syncs pseudo nodes from the host cluster where there are virtual cluste
1515
However, when you need to access specific node information, you can choose to sync real nodes from the host cluster to the virtual cluster. This requires a cluster role.
1616

1717
:::info Node IP obfuscation
18-
By default, vCluster obfuscates node IP addresses—replacing real IPs with placeholder values—when syncing real nodes. This prevents internal network details from being exposed within the virtual cluster. For more information, see [Control node IP visibility](../../../../learn-how-to/control-node-ip-visibility.mdx).
18+
By default, vCluster obfuscates node IP addresses when syncing real nodes to protect sensitive information. Learn how to [control node IP visibility](../../../../learn-how-to/control-node-ip-visibility.mdx) for your use case.
1919
:::
2020

21-
### Sync pseudo nodes
21+
### Sync pseudo nodes (default)
22+
23+
### Sync pseudo nodes
2224

2325
Sync pseudo nodes to the virtual cluster. This is enabled by default. This default configuration does not require a cluster role.
2426

@@ -29,7 +31,7 @@ sync:
2931
enabled: false
3032
```
3133
32-
vCluster ignores the `selector.all` and `selector.labels` fields. However, if a pod is created with `spec.nodeSelector`, the syncer generates a pseudo node in the virtual cluster. This pseudo node includes annotations and labels from the real node, allowing the pods node selector to match a corresponding node within the virtual cluster.
34+
vCluster ignores the `selector.all` and `selector.labels` fields. However, if a pod is created with `spec.nodeSelector`, the syncer generates a pseudo node in the virtual cluster. This pseudo node includes annotations and labels from the real node, allowing the pod's node selector to match a corresponding node within the virtual cluster.
3335

3436
For more information, see the Kubernetes documentation on [`spec.nodeSelector`](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector).
3537

@@ -145,5 +147,4 @@ For more advanced use cases, such as controlling node IP visibility, see the [co
145147

146148
## Config reference
147149

148-
<SyncNodes/>
149-
150+
<SyncNodes/>

vcluster/configure/vcluster-yaml/sync/to-host/advanced/custom-resources.mdx

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import CertManagerConfig from '!!raw-loader!@site/vcluster/configure/vcluster-ya
1616

1717
vCluster allows you to sync custom resources from the virtual cluster to the host cluster. This allows you to sync arbitrary resources that are by default not synced by vCluster. This only works for resources that have a custom resource definition in the host cluster.
1818

19-
If those custom resources will create other resources inside the host cluster, vCluster will try to find them and sync them back to the host cluster as well. E.g. a [cert-manager](https://cert-manager.io/) certificate creates a secret which will be synced back automatically into the virtual cluster.
19+
If those custom resources create other resources inside the host cluster, vCluster tries to find them and syncs them back to the host cluster as well. E.g. a [cert-manager](https://cert-manager.io/) certificate creates a secret which syncs back automatically into the virtual cluster.
2020

21-
vCluster will automatically add the required cluster and namespace RBAC permissions for retrieving the custom resource definition and syncing the resources from the virtual cluster to the host cluster.
21+
vCluster automatically adds the required cluster and namespace RBAC permissions for retrieving the custom resource definition and syncing the resources from the virtual cluster to the host cluster.
2222
<br />
2323

2424
:::info Only Namespace-Scoped Resource
@@ -29,7 +29,7 @@ This feature currently only works for namespace-scoped resources only.
2929
If you want to sync many custom resources, consider using [multi-namespace-mode](../../../experimental/multi-namespace-mode).
3030
:::
3131

32-
## Enable Custom Resource Syncing
32+
## Enable custom resource syncing {#enable-custom-resource-syncing}
3333

3434
To enable custom resource syncing from the virtual cluster to the host cluster, figure out what CRDs you want to sync via `kubectl get crds`. Add the name into the `customResources` section in the sync section. Even though vCluster syncs custom resources from the virtual cluster to the host cluster, the CRDs are also copied from the host cluster to the virtual cluster.
3535

@@ -45,7 +45,7 @@ sync:
4545
4646
## Patches
4747
48-
You can modify the sync behaviour with patches that target specific paths. Currently there is 2 different kinds of patches supported.
48+
You can modify the sync behavior with patches that target specific paths. Currently there are 2 different kinds of patches supported.
4949
5050
:::info Wildcard patches
5151
You can use `*` in paths to select all entries of an array or object, e.g. `spec.containers[*].name` or `spec.containers[*].volumeMounts[*]`. vCluster calls the patch multiple times.
@@ -75,9 +75,12 @@ vCluster translates the path `spec.secretName` as it points to a secret. If the
7575
With multi-namespace-mode you only need to rewrite references that include a namespace. You can use the `namespacePath` option to specify the path of the namespace of the reference.
7676
:::
7777

78-
### JavaScript Expression Patches
78+
<!-- vale off -->
79+
### JavaScript expression patches {#javascript-expression-patches}
80+
<!-- vale on -->
81+
82+
These are JavaScript ES6 compatible expression patches that can be used to change a field while syncing. You define how it changes when syncing from the virtual cluster into the host cluster or when syncing from the host cluster into the virtual cluster. To add a suffix to certificate DNS names you can:
7983

80-
These are powerful JavaScript ES6 compatible expression patches that can be used to change a field while syncing. You define how it changes when syncing from the virtual cluster into the host cluster or when syncing from the host cluster into the virtual cluster. To add a suffix to certificate DNS names you can do:
8184
```yaml
8285
sync:
8386
toHost:
@@ -93,14 +96,15 @@ sync:
9396
```
9497

9598
There is also a variable called `context` besides `value` that can be used to access vCluster specific data:
96-
* `context.vcluster.name`: Name of the virtual cluster
97-
* `context.vcluster.namespace`: Namespace of the virtual cluster
98-
* `context.vcluster.config`: Config of the virtual cluster, basically `vcluster.yaml` merged with the defaults
99-
* `context.hostObject`: Host object (can be null if not available)
100-
* `context.virtualObject`: Virtual object (can be null if not available)
101-
* `context.path`: The matched path on the object, useful when using wildcard path selectors (*)
102-
103-
For example, let's assume you want to add `www.` to every DNS name specified in a cert-manager certificate in the path `spec.dnsNames`, you could use the following patch:
99+
- `context.vcluster.name`: Name of the virtual cluster
100+
- `context.vcluster.namespace`: Namespace of the virtual cluster
101+
- `context.vcluster.config`: Config of the virtual cluster, basically `vcluster.yaml` merged with the defaults
102+
- `context.hostObject`: Host object (can be null if not available)
103+
- `context.virtualObject`: Virtual object (can be null if not available)
104+
- `context.path`: The matched path on the object, useful when using wildcard path selectors (*)
105+
106+
For example, to add `www.` to every DNS name specified in a cert-manager certificate in the path `spec.dnsNames`, you can use the following patch:
107+
104108
```yaml
105109
sync:
106110
toHost:
@@ -115,7 +119,8 @@ sync:
115119
reverseExpression: "value.startsWith('www.') ? value.slice(4) : value"
116120
```
117121
118-
With that patch, creating a new certificate within the vCluster like this:
122+
The patch creates a new certificate within the vCluster:
123+
119124
```yaml
120125
apiVersion: cert-manager.io/v1
121126
kind: Certificate
@@ -126,7 +131,8 @@ spec:
126131
- example.com
127132
```
128133
129-
Would create the following certificate in the host cluster:
134+
vCluster syncs the host cluster and applies your patch, creating this modified certificate:
135+
130136
```yaml
131137
apiVersion: cert-manager.io/v1
132138
kind: Certificate
@@ -137,7 +143,8 @@ spec:
137143
- www.example.com # the patch added www. to this field
138144
```
139145
140-
When you change now the certificate in the host cluster like this:
146+
If you directly edit the certificate in the host cluster and change the domain:
147+
141148
```yaml
142149
apiVersion: cert-manager.io/v1
143150
kind: Certificate
@@ -148,7 +155,8 @@ spec:
148155
- www.other-domain.com # changed from www.example.com
149156
```
150157
151-
vCluster would sync back the certificate like this:
158+
vCluster detects the change, applies the reverse patch, and updates the certificate in your virtual cluster:
159+
152160
```yaml
153161
apiVersion: cert-manager.io/v1
154162
kind: Certificate
@@ -159,13 +167,43 @@ spec:
159167
- other-domain.com # the patch removed the www. from www.other-domain.com
160168
```
161169
162-
## Full Example: Using cert-manager custom resource in Single-Namespace-Mode (default)
170+
## Configure Kubernetes Gateway API sync
171+
172+
To use the Kubernetes Gateway API with custom resources, follow these steps:
173+
174+
### Install Gateway CRD in the host
175+
176+
```bash title="Install Gateway CRD"
177+
kubectl --context="${HOST_CTX}" get crd gateways.gateway.networking.k8s.io &> /dev/null || \
178+
kubectl --context="${HOST_CTX}" apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml
179+
```
180+
181+
### Create waypoint gateway {#create-waypoint-gateway}
163182

164-
<CertManagerExample singleNamespace />
183+
Create a waypoint gateway configuration:
165184

166-
## Full Example: Using cert-manager custom resource in Multi-Namespace-Mode
185+
```yaml title="waypoint-gateway.yaml"
186+
apiVersion: gateway.networking.k8s.io/v1
187+
kind: Gateway
188+
metadata:
189+
name: waypoint
190+
labels:
191+
istio.io/waypoint-for: service
192+
spec:
193+
gatewayClassName: istio-waypoint
194+
listeners:
195+
- name: mesh
196+
port: 15008
197+
protocol: HBONE
198+
```
199+
200+
Apply it to your host cluster:
201+
202+
```bash title="Create Waypoint Gateway"
203+
kubectl --context="${HOST_CTX}" create -f waypoint-gateway.yaml --namespace="${VCLUSTER_HOST_NAMESPACE}"
204+
```
167205

168-
<CertManagerExample />
206+
Once configured, you can configure your custom resources to sync Gateway API resources between the virtual and host clusters.
169207

170208
## Config reference
171209

0 commit comments

Comments
 (0)