|
| 1 | +# Core Concepts |
| 2 | + |
| 3 | +This page explains what ORC does and how its main features work. For the |
| 4 | +reasoning behind these choices, see [Design Principles](design-principles.md). For |
| 5 | +the full field-level API documentation, see the |
| 6 | +[CRD Reference](../crd-reference.md). |
| 7 | + |
| 8 | +## Management Policies |
| 9 | + |
| 10 | +Every ORC resource has a `managementPolicy` that determines how ORC treats the |
| 11 | +underlying OpenStack resource: |
| 12 | + |
| 13 | +| Policy | Description | |
| 14 | +|--------|-------------| |
| 15 | +| `managed` | ORC creates, updates, and deletes the OpenStack resource. This is the default. | |
| 16 | +| `unmanaged` | ORC imports an existing OpenStack resource but will not modify or delete it. | |
| 17 | + |
| 18 | +### When to use `managed` |
| 19 | + |
| 20 | +- The resource should be created and owned by ORC |
| 21 | +- You want ORC to update the OpenStack resource when you change the spec |
| 22 | +- You want ORC to delete the OpenStack resource when you remove it from |
| 23 | + Kubernetes |
| 24 | + |
| 25 | +### When to use `unmanaged` |
| 26 | + |
| 27 | +- The resource is owned by another system (e.g. created by an admin or |
| 28 | + another tool) |
| 29 | +- You need to reference shared infrastructure that multiple projects use |
| 30 | + (external networks, public flavors) |
| 31 | + |
| 32 | +The distinction matters most at deletion time. By default, when you delete a |
| 33 | +`managed` ORC object, ORC deletes the corresponding OpenStack resource. When you |
| 34 | +delete an `unmanaged` ORC object, the OpenStack resource is always left |
| 35 | +untouched. See [Deletion Behavior](#deletion-behavior) for how to change the |
| 36 | +default for managed resources. |
| 37 | + |
| 38 | +### Create vs Import |
| 39 | + |
| 40 | +A **managed** resource uses `spec.resource` to describe what should be created: |
| 41 | + |
| 42 | +```yaml |
| 43 | +spec: |
| 44 | + managementPolicy: managed |
| 45 | + resource: |
| 46 | + description: My application network |
| 47 | +``` |
| 48 | +
|
| 49 | +An **unmanaged** resource uses `spec.import` to find an existing OpenStack |
| 50 | +resource by UUID or by a filter query: |
| 51 | + |
| 52 | +```yaml |
| 53 | +spec: |
| 54 | + managementPolicy: unmanaged |
| 55 | + import: |
| 56 | + filter: |
| 57 | + name: public |
| 58 | + external: true |
| 59 | +``` |
| 60 | + |
| 61 | +When importing by filter, the filter must match exactly **one** resource: |
| 62 | + |
| 63 | +- **No matches**: ORC keeps retrying (the resource stays `Progressing: True`). |
| 64 | + This is useful when you expect another system to create the resource soon. |
| 65 | +- **Multiple matches**: ORC reports a terminal error. Make the filter more |
| 66 | + specific. |
| 67 | + |
| 68 | +See [Troubleshooting](../troubleshooting.md#common-issues) for debugging |
| 69 | +import filter issues. The [Tutorial](../getting-started.md) walks through |
| 70 | +importing resources step by step. |
| 71 | + |
| 72 | +## Resource References and Dependencies |
| 73 | + |
| 74 | +ORC resources reference each other using `*Ref` fields (e.g. `networkRef`, |
| 75 | +`flavorRef`, `portRef`). These references serve three purposes: |
| 76 | + |
| 77 | +1. **Name resolution**: References are resolved by Kubernetes object name |
| 78 | + within the same namespace. References to other OpenStack resources always |
| 79 | + go through an ORC object, never by raw OpenStack UUID. (A few spec fields |
| 80 | + do accept raw IDs for values that aren't references to other resources, |
| 81 | + such as setting a resource's own ID or a port's host ID.) |
| 82 | + |
| 83 | +2. **Automatic ordering**: ORC waits for a referenced resource to exist and |
| 84 | + be `Available` before proceeding. You can apply all your resources at once |
| 85 | + in any order and ORC will sort out the sequencing. |
| 86 | + |
| 87 | +3. **Deletion protection**: ORC prevents deletion of a resource while other |
| 88 | + resources still reference it. If you delete everything at once, ORC |
| 89 | + automatically deletes them in the correct reverse order. |
| 90 | + |
| 91 | +See [Design Principles](design-principles.md#orc-objects-only-reference-orc-objects) |
| 92 | +for why ORC requires all references to go through ORC objects. |
| 93 | + |
| 94 | +### Cross-namespace references |
| 95 | + |
| 96 | +ORC does not allow cross-namespace references. All `*Ref` fields resolve within |
| 97 | +the same namespace. This applies to ORC objects, credential secrets, and any |
| 98 | +other referenced objects. See |
| 99 | +[Design Principles](design-principles.md#no-cross-namespace-references) for the |
| 100 | +rationale behind this choice. |
| 101 | + |
| 102 | +## Deletion Behavior |
| 103 | + |
| 104 | +For managed resources, the `managedOptions.onDelete` field controls what happens |
| 105 | +when the Kubernetes object is deleted: |
| 106 | + |
| 107 | +| Value | Description | |
| 108 | +|-------|-------------| |
| 109 | +| `delete` | Delete the OpenStack resource. This is the default. | |
| 110 | +| `detach` | Keep the OpenStack resource; only remove the ORC object. | |
| 111 | + |
| 112 | +```yaml |
| 113 | +spec: |
| 114 | + managementPolicy: managed |
| 115 | + managedOptions: |
| 116 | + onDelete: detach # Keep the OpenStack resource on deletion |
| 117 | + resource: |
| 118 | + # ... |
| 119 | +``` |
| 120 | + |
| 121 | +Use `detach` when you want to stop managing a resource through ORC without |
| 122 | +destroying the underlying infrastructure, for example during a migration. |
| 123 | + |
| 124 | +## Name Reuse |
| 125 | + |
| 126 | +Deleting an ORC object and creating a new one with the same name is safe. ORC's |
| 127 | +dependency management ensures that the old resource is fully cleaned up before |
| 128 | +the new one takes its place. |
| 129 | + |
| 130 | +## Status and Conditions |
| 131 | + |
| 132 | +Every ORC resource reports its state through two conditions: **Available** (is |
| 133 | +the resource ready?) and **Progressing** (is ORC still working on it?). A |
| 134 | +resource is healthy when `Available=True` and `Progressing=False`. |
| 135 | + |
| 136 | +When something goes wrong, the condition's `reason` and `message` fields explain |
| 137 | +what happened. See [Status Conditions Reference](../reference/conditions.md) |
| 138 | +for the full list of condition states, reasons, and recommended actions. |
| 139 | + |
| 140 | +ORC surfaces error messages, including potentially sensitive details from |
| 141 | +OpenStack, directly in status conditions. |
| 142 | + |
| 143 | +The `.status.resource` field contains the observed state from OpenStack, |
| 144 | +including fields that OpenStack assigns (like `projectID`, `createdAt`, etc.). |
| 145 | + |
| 146 | +## Cloud Credentials |
| 147 | + |
| 148 | +Every ORC resource has its own `cloudCredentialsRef` that points to a Kubernetes |
| 149 | +Secret containing OpenStack credentials. The secret holds a standard OpenStack |
| 150 | +`clouds.yaml`, and each ORC resource specifies which cloud entry to use. |
| 151 | +Because credentials are per-resource, you can manage OpenStack resources across |
| 152 | +multiple clouds or projects from the same namespace. |
| 153 | + |
| 154 | +ORC prevents deletion of credential secrets while they are still referenced by |
| 155 | +ORC resources, ensuring credentials aren't accidentally removed from under |
| 156 | +running infrastructure. |
| 157 | + |
| 158 | +See [Set Up Cloud Credentials](../howto/cloud-credentials.md) for step-by-step |
| 159 | +instructions on creating the secret, adding custom CA certificates, and |
| 160 | +referencing credentials from ORC resources. |
| 161 | + |
| 162 | +## Resource Naming |
| 163 | + |
| 164 | +By default, ORC creates OpenStack resources with the same name as the Kubernetes |
| 165 | +object. You can override this using `spec.resource.name`. See |
| 166 | +[Design Principles](design-principles.md#resource-naming) for how ORC handles |
| 167 | +duplicate names safely. |
| 168 | + |
| 169 | +## Deterministic Behavior |
| 170 | + |
| 171 | +When OpenStack would create resources behind the scenes or make arbitrary |
| 172 | +choices, ORC requires the user to be explicit instead. See |
| 173 | +[Design Principles](design-principles.md#deterministic-behavior) for examples. |
0 commit comments