1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/ts-capi-cli-reference-intended-objects.adoc
2025-05-21 18:54:17 +00:00

55 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_management/cluster_api_machine_management/cluster-api-troubleshooting.adoc
:_mod-docs-content-type: PROCEDURE
[id="ts-capi-cli-reference-intended-objects_{context}"]
= Referencing the intended objects when using the CLI
For clusters that use the Cluster API, {oc-first} commands prioritize Cluster API objects over Machine API objects.
This behavior impacts any `oc` command that acts upon any object that is represented in both the Cluster API and the Machine API.
This explanation uses the `oc delete machine` command, which deletes a machine, as an example.
Cause::
When you run an `oc` command, `oc` communicates with the Kube API server to determine which objects to act upon.
The Kube API server uses the first installed custom resource definition (CRD) it encounters alphabetically when an `oc` command is run.
+
CRDs for Cluster API objects are in the `cluster.x-k8s.io` group, while CRDs for Machine API objects are in the `machine.openshift.io` group.
Because the letter `c` precedes the letter `m` alphabetically, the Kube API server matches on the Cluster API object CRD.
As a result, the `oc` command acts upon Cluster API objects.
Consequence::
Due to this behavior, the following unintended outcomes can occur on a cluster that uses the Cluster API:
* For namespaces that contain both types of objects, commands such as `oc get machine` return only Cluster API objects.
* For namespaces that contain only Machine API objects, commands such as `oc get machine` return no results.
Workaround::
You can ensure that `oc` commands act on the type of objects you intend by using the corresponding fully qualified name.
.Prerequisites
* You have access to the cluster using an account with `cluster-admin` permissions.
* You have installed the {oc-first}.
.Procedure
* To delete a Machine API machine, use the fully qualified name `machine.machine.openshift.io` when running the `oc delete machine` command:
+
[source,terminal]
----
$ oc delete machine.machine.openshift.io <machine_name>
----
* To delete a Cluster API machine, use the fully qualified name `machine.cluster.x-k8s.io` when running the `oc delete machine` command:
+
[source,terminal]
----
$ oc delete machine.cluster.x-k8s.io <machine_name>
----