| `managedClusters` | List of managed clusters that should exist on the OCM hub. The chart creates missing entries and removes entries that are no longer configured. |
kubectl get secret ocm-hub-kubeconfig -n ocm-managed
```
The generated identity JSON is stored in the Kubernetes Secret under the key:
The chart mounts the Secret inside the join Job as:
```text
persisted-identity
/hub/kubeconfig
```
The `ziti-edge-tunnel` subchart mounts this Secret and starts the tunneler using the enrolled hub identity.
The chart does not create or delete this Secret. It is considered externally managed.
## OCM Hub Initialization
## Kubeconfig Usage
After the OpenZiti tunneler is ready, the chart initializes the OCM hub using:
Two kubeconfigs are used during the registration process.
```bash
clusteradm init --wait
```
```text
/hub/kubeconfig
|
+--> pre-existing external Secret
|
+--> communicates with OCM hub
|
+--> clusteradm get token
This installs the OCM hub control plane.
The chart then creates the configured `ManagedCluster` resources.
/tmp/managed-kubeconfig
|
+--> generated temporarily by join Job
|
+--> communicates with local managed cluster
|
+--> clusteradm join
```
For example:
`/hub/kubeconfig` is mounted from the Secret configured by:
```yaml
apiVersion:cluster.open-cluster-management.io/v1
kind:ManagedCluster
metadata:
name:cluster1
spec:
hubAcceptsClient:true
leaseDurationSeconds:60
hubKubeconfigSecretName:"ocm-hub-kubeconfig"
```
The hub-side acceptance CronJob automatically approves registration requests for the clusters configured in `managedClusters`.
`/tmp/managed-kubeconfig` is generated temporarily using the installer ServiceAccount and is used by `clusteradm join` to configure the local Kubernetes cluster.
## OpenZiti Bootstrap
Conceptually:
During the initial Helm installation, the chart automatically creates the OpenZiti identity required by the managed cluster.
```text
Managed cluster
Authenticate to OpenZiti Controller
|
v
Registration CSR
Create cluster1-ziti identity
|
v
accept-clusters CronJob
Retrieve enrollment JWT
|
v
clusteradm accept
Enroll identity
|
v
CSR approved
Generate identity.json
|
v
Create Kubernetes Secret
ziti-cluster1-identity
|
v
ManagedCluster connected
Start ziti-edge-tunnel
```
## OCM Hub API through OpenZiti
The hub chart creates the OpenZiti objects required to expose the Kubernetes API through the OpenZiti overlay.
Conceptually:
The generated identity JSON is stored in the Kubernetes Secret under:
```text
hub-ziti
|
| Bind
v
ocm-hub-api
|
+--> intercept.v1
|
+--> host.v1
|
v
HUB_IP:6443
persisted-identity
```
The `host.v1` configuration points to the actual Kubernetes API endpoint on the hub.
The `ziti-edge-tunnel` subchart mounts this Secret and starts the OpenZiti tunneler using the enrolled managed-cluster identity.
For example:
## Direct Connectivity and OpenZiti Fallback
Before retrieving the OCM registration token, the join Job extracts the hub API endpoint from:
```text
192.168.5.185:6443
/hub/kubeconfig
```
The `intercept.v1` configuration uses the same hub API address and port.
If direct connectivity works:
The managed chart can later create a cluster-specific Dial policy when direct communication with this endpoint is unavailable.
```text
Managed Cluster
|
+-------- direct --------> Hub API
```
No OpenZiti Dial policy is created.
The resulting OpenZiti path is:
If direct connectivity is unavailable:
```text
Managed Cluster
cluster1-ziti
|
| Dial
@@ -290,53 +293,57 @@ hub-ziti
|
v
Hub Kubernetes API
HUB_IP:6443
```
The hub chart owns the following OpenZiti objects:
The managed chart creates only the cluster-specific Dial policy.
For example:
```text
ocm-hub-api-cluster1-dial
```
The following OpenZiti objects are created and owned by the `ocm-hub` chart:
```text
hub-ziti
ocm-hub-api
ocm-hub-api-intercept
ocm-hub-api-host
ocm-hub-api-bind
```
The managed charts only create their own cluster-specific Dial policies when required.
The managed chart only creates the Dial permission required for its own OpenZiti identity to consume the hub API service.
## Managed Cluster Configuration
## OCM Join Process
Managed clusters are declared in `values.yaml`:
The join Job retrieves the OCM registration information using:
```yaml
managedClusters:
-cluster1
-cluster2
```
The list represents the desired OCM managed-cluster state.
To add a cluster:
```yaml
managedClusters:
-cluster1
-cluster2
-cluster3
```bash
clusteradm \
--kubeconfig /hub/kubeconfig \
get token
```
Apply the change with:
It then executes:
```bash
helm upgrade ocm-hub .-n ocm-hub
clusteradm join\
--hub-token <token> \
--hub-apiserver <hub-api> \
--wait\
--cluster-name <cluster-name> \
--kubeconfig /tmp/managed-kubeconfig \
--context managed-context
```
The chart creates the missing `ManagedCluster` resources.
`clusteradm join` installs and configures the OCM Klusterlet on the local managed cluster.
To remove a cluster, remove it from the list and run the same Helm upgrade.
The Klusterlet includes:
The chart reconciles the current OCM `ManagedCluster` resources with the configured list.
*`registration-agent`
*`work-agent`
The registration agent creates the registration CSR on the hub. The hub-side acceptance CronJob subsequently approves the registration.