Skip to content

Commit

Permalink
Add ADR on rancher namespace strategy
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev committed Nov 16, 2023
1 parent e9778c0 commit ca061d2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/adr/0007-rancher-namespace-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [7. Cluster Import Strategy](#7-cluster-import-strategy)
- [Context](#context)
- [Decision](#decision)
- [Consequences](#consequences)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# 7. Rancher Namespace Strategy

- Status: proposed
- Date: 2023-16-11
- Authors: @Danil-Grigorev
- Deciders: @richardcase @alexander-demicev @furkatgofurov7 @mjura

## Context

The feature of Rancher Manager allows you to **import** an existing cluster, however, the resources created for the rancher-turtles to use are spawned across randomly generated namespaces, preventing rancher-turtles from using the namespace scoped permissions for the namespace scoped resources within the Rancher Manager cluster.

## Decision

The operator will take the responsibility of placing Rancher resources in a specific namespace, defined by the deployment options. This option will be provided in the form of a `--namespace` flag passed to the manager.

The namespace will only dictate the designated location of the Rancher Manager cluster resources, such as **provisioning.cattle/v1.Cluster** and **management.cattle/v3.ClusterRegistrationToken** but not the `CAPI` resources.

## Consequences

To replicate the import steps the operator will need to change the [import strategy][] in steps 1 to 2:

1. Create an instance of the **provisioning.cattle/v1.Cluster** in the Rancher Manager cluster in the selected namespace. Wait for the cluster name to be provided in the status subresource.
1. Create an instance of the **management.cattle/v3.ClusterRegistrationToken** for the cluster name in the selected namespace. Wait for the **ClusterRegistrationToken** status to be populated AND contain an import URL.

The rest of the steps of the [import strategy][] are unchanged.

[import strategy]: ./0006-import-strategy.md#consequences

### Sequence Diagram

![diagram](./images/import-sequence.png)
Binary file added docs/adr/images/import-sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca061d2

Please sign in to comment.