Skip to content

Commit 0b0e367

Browse files
author
Nir Magnezi
authored
Bug 1977444: KubeAPI getting started guide (#2133)
This change will also include: 1. An API Diagram - to make the custom resource relationships better understood. 2. An API Diagram with Controllers architecture - to allow a better understanding of which controller is interacting with each resource and how backend notifications are communicated. 3. Update existing CRD examples not to use assisted-installer namespace.
1 parent dd9644c commit 0b0e367

13 files changed

+581
-23
lines changed

docs/hive-integration/README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ For this integration, the Assisted Installer APIs are available via [CRDs](https
88

99
## CRD Types
1010

11+
![kubeAPI4.9](kubeAPI4.9_controllers.jpg)
12+
1113
### [ClusterDeployment](https://github.com/openshift/hive/blob/master/apis/hive/v1/clusterdeployment_types.go)
1214
The ClusterDeployment CRD is an API provided by Hive.
1315

@@ -33,7 +35,7 @@ Deletion of AgentClusterInstall will trigger the `agentclusterinstall
3335
Here an example how to print AgentClusterInstall conditions:
3436

3537
```sh
36-
$ kubectl get agentclusterinstalls.extensions.hive.openshift.io -n assisted-installer -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'
38+
$ kubectl get agentclusterinstalls.extensions.hive.openshift.io -n mynamespace -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'
3739
```
3840
```sh
3941
test-infra-agent-cluster-install
@@ -92,7 +94,7 @@ Note that if the Agent is not Approved, it will not be part of the installation.
9294
Here how to approve an Agent:
9395
9496
```sh
95-
$ kubectl -n assisted-installer patch agents.agent-install.openshift.io 120af504-d88e-46bd-bec2-b8b261db3b01 -p '{"spec":{"approved":true}}' --type merge
97+
$ kubectl -n mynamespace patch agents.agent-install.openshift.io 120af504-d88e-46bd-bec2-b8b261db3b01 -p '{"spec":{"approved":true}}' --type merge
9698
```
9799
98100
The Agent reflects the Host status through Conditions.
@@ -102,7 +104,7 @@ More details on conditions is available [here](kube-api-conditions.md)
102104
Here an example how to print Agent conditions:
103105
104106
```sh
105-
$ kubectl get agents.agent-install.openshift.io -n assisted-installer -o=jsonpath='{range .items[*]}{"\n"}{.spec.clusterDeploymentName.name}{"\n"}{.status.inventory.hostname}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'
107+
$ kubectl get agents.agent-install.openshift.io -n mynamespace -o=jsonpath='{range .items[*]}{"\n"}{.spec.clusterDeploymentName.name}{"\n"}{.status.inventory.hostname}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'
106108
```
107109
108110
```sh
@@ -176,12 +178,12 @@ In case of failure to apply the overrides the agentclusterinstall conditions wil
176178
Add an annotation with the desired options, the clusterdeployment controller will update the install config yaml with the annotation value.
177179
Note that this configuration must be applied prior to starting the installation
178180
```sh
179-
$ kubectl annotate agentclusterinstalls.extensions.hive.openshift.io test-cluster -n assisted-installer agent-install.openshift.io/install-config-overrides="{\"networking\":{\"networkType\": \"OVNKubernetes\"},\"fips\":true}"
181+
$ kubectl annotate agentclusterinstalls.extensions.hive.openshift.io test-cluster -n mynamespace agent-install.openshift.io/install-config-overrides="{\"networking\":{\"networkType\": \"OVNKubernetes\"},\"fips\":true}"
180182
agentclusterinstalls.extensions.hive.openshift.io/test-cluster annotated
181183
```
182184

183185
```sh
184-
$ kubectl get agentclusterinstalls.extensions.hive.openshift.io test-cluster -n assisted-installer -o yaml
186+
$ kubectl get agentclusterinstalls.extensions.hive.openshift.io test-cluster -n mynamespace -o yaml
185187
```
186188
```yaml
187189
apiVersion: extensions.hive.openshift.io/v1beta1
@@ -192,7 +194,7 @@ metadata:
192194
creationTimestamp: "2021-04-01T07:04:49Z"
193195
generation: 1
194196
name: test-cluster
195-
namespace: assisted-installer
197+
namespace: mynamespace
196198
resourceVersion: "183201"
197199
...
198200
```
@@ -207,12 +209,12 @@ Add an annotation with the desired options, the bmac controller will update the
207209
Then agent controller will forward it to host configuration.
208210
Note that this configuration must be applied prior to starting the installation
209211
```sh
210-
$ kubectl annotate bmh openshift-worker-0 -n assisted-installer bmac.agent-install.openshift.io/installer-args="[\"--append-karg\", \"ip=192.0.2.2::192.0.2.254:255.255.255.0:core0.example.com:enp1s0:none\", \"--save-partindex\", \"1\", \"-n\"]"
212+
$ kubectl annotate bmh openshift-worker-0 -n mynamespace bmac.agent-install.openshift.io/installer-args="[\"--append-karg\", \"ip=192.0.2.2::192.0.2.254:255.255.255.0:core0.example.com:enp1s0:none\", \"--save-partindex\", \"1\", \"-n\"]"
211213
baremetalhost.metal3.io/openshift-worker-0 annotated
212214
```
213215

214216
```sh
215-
$ oc get bmh openshift-worker-0 -n assisted-installer -o yaml
217+
$ oc get bmh openshift-worker-0 -n mynamespace -o yaml
216218
```
217219
```yaml
218220
apiVersion: metal3.io/v1alpha1
@@ -223,7 +225,7 @@ metadata:
223225
creationTimestamp: "2021-04-13T10:46:57Z"
224226
generation: 1
225227
name: openshift-worker-0
226-
namespace: assisted-installer
228+
namespace: mynamespace
227229
spec:
228230
```
229231

@@ -235,12 +237,12 @@ Add an annotation with the desired options, the bmac controller will update the
235237
Then agent controller will forward it to host configuration.
236238
Note that this configuration must be applied prior to starting the installation
237239
```sh
238-
$ kubectl annotate bmh openshift-worker-0 -n assisted-installer bmac.agent-install.openshift.io/ignition-config-overrides="{\"ignition\": {\"version\": \"3.1.0\"}, \"storage\": {\"files\": [{\"path\": \"/tmp/example\", \"contents\": {\"source\": \"data:text/plain;base64,aGVscGltdHJhcHBlZGluYXN3YWdnZXJzcGVj\"}}]}}"
240+
$ kubectl annotate bmh openshift-worker-0 -n mynamespace bmac.agent-install.openshift.io/ignition-config-overrides="{\"ignition\": {\"version\": \"3.1.0\"}, \"storage\": {\"files\": [{\"path\": \"/tmp/example\", \"contents\": {\"source\": \"data:text/plain;base64,aGVscGltdHJhcHBlZGluYXN3YWdnZXJzcGVj\"}}]}}"
239241
baremetalhost.metal3.io/openshift-worker-0 annotated
240242
```
241243

242244
```sh
243-
$ oc get bmh openshift-worker-0 -n assisted-installer -o yaml
245+
$ oc get bmh openshift-worker-0 -n mynamespace -o yaml
244246
```
245247
```yaml
246248
apiVersion: metal3.io/v1alpha1
@@ -251,7 +253,7 @@ metadata:
251253
creationTimestamp: "2021-04-14T10:46:57Z"
252254
generation: 1
253255
name: openshift-worker-0
254-
namespace: assisted-installer
256+
namespace: mynamespace
255257
spec:
256258
```
257259

@@ -307,5 +309,5 @@ In case that the assisted-service is not available, the deletion of ClusterDeplo
307309
Here an example on how to remove finalizers on a resource:
308310
309311
```bash
310-
kubectl -n assisted-installer patch agentclusterinstalls.extensions.hive.openshift.io my-aci -p '{"metadata":{"finalizers":null}}' --type=merge
312+
kubectl -n mynamespace patch agentclusterinstalls.extensions.hive.openshift.io my-aci -p '{"metadata":{"finalizers":null}}' --type=merge
311313
```

docs/hive-integration/crds/agentClusterInstall-SNO.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: extensions.hive.openshift.io/v1beta1
22
kind: AgentClusterInstall
33
metadata:
44
name: test-agent-cluster-install
5-
namespace: assisted-installer
5+
namespace: spoke-cluster
66
spec:
77
clusterDeploymentRef:
88
name: single-node

docs/hive-integration/crds/agentClusterInstall.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: extensions.hive.openshift.io/v1beta1
22
kind: AgentClusterInstall
33
metadata:
44
name: test-agent-cluster-install
5-
namespace: assisted-installer
5+
namespace: spoke-cluster
66
spec:
77
apiVIP: 1.2.3.8
88
clusterDeploymentRef:

docs/hive-integration/crds/clusterDeployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: hive.openshift.io/v1
22
kind: ClusterDeployment
33
metadata:
44
name: single-node
5-
namespace: assisted-installer
5+
namespace: spoke-cluster
66
spec:
77
baseDomain: hive.example.com
88
clusterInstallRef:

docs/hive-integration/crds/clusterImageSet.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kind: ClusterImageSet
33
metadata:
44
name: openshift-v4.8.0
55
spec:
6-
releaseImage: quay.io/openshift-release-dev/ocp-release:4.8.0-fc.3-x86_64
6+
releaseImage: quay.io/openshift-release-dev/ocp-release:4.8.0-rc.0-x86_64

docs/hive-integration/crds/infraEnv.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ apiVersion: agent-install.openshift.io/v1beta1
22
kind: InfraEnv
33
metadata:
44
name: myinfraenv
5-
namespace: assisted-installer
5+
namespace: spoke-cluster
66
spec:
77
clusterRef:
88
name: single-node
9-
namespace: assisted-installer
9+
namespace: spoke-cluster
1010
pullSecretRef:
1111
name: pull-secret
1212
proxy:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: spoke-cluster

docs/hive-integration/crds/nmstate.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: agent-install.openshift.io/v1beta1
22
kind: NMStateConfig
33
metadata:
44
name: mynmstateconfig
5+
namespace: spoke-cluster
56
labels:
67
some-user-defined-label-name: some-user-defined-label-value
78
spec:

docs/hive-integration/crds/pullsecret.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ kind: Secret
33
type: kubernetes.io/dockerconfigjson
44
metadata:
55
name: pull-secret
6-
namespace: assisted-installer
6+
namespace: spoke-cluster
77
stringData:
88
.dockerconfigjson: '{"auths":{"cloud.openshift.com":{"auth":"dXNlcjpwYXNzd29yZAo=","email":"[email protected]"}}}'

0 commit comments

Comments
 (0)