Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add region field to Scope resource #80

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apis/core/v1alpha1/scope_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
type ScopeSpec struct {
// Description is a human-readable description of what the scope is used for.
Description string `json:"description,omitempty"`
// Region describes the region scope
Region string `json:"region,omitempty"`
}

// ScopeStatus defines the observed state of Scope
Expand All @@ -37,7 +39,7 @@ type ScopeStatus struct {
ParentScope string `json:"parentScope"`
// ParentNamespace represents the namespace of the parent scope
ParentNamespace string `json:"parentNamespace"`
// Account descibes the account this scope belongs to
// Account describes the account this scope belongs to
Account string `json:"account"`
}

Expand Down
5 changes: 4 additions & 1 deletion config/crd/bases/core.onmetal.de_scopes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ spec:
description: Description is a human-readable description of what the
scope is used for.
type: string
region:
description: Region describes the region scope
type: string
type: object
status:
description: ScopeStatus defines the observed state of Scope
properties:
account:
description: Account descibes the account this scope belongs to
description: Account describes the account this scope belongs to
type: string
message:
description: Message contains a message for the corresponding state
Expand Down
1 change: 1 addition & 0 deletions config/samples/core_v1alpha1_scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ kind: Scope
metadata:
name: scope-sample
spec:
#region: frankfurt1
description: yolo
26 changes: 26 additions & 0 deletions docs/design/reasoning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Why certain design decisions have been made

## Namespace replication

Namespaces should be replicated from the user facing (global API) to the
corresponding region specific API machinery based on the regional notion of the
namespace. This is determined by the `region` field in the scope definition

```yaml
apiVersion: core.onmetal.de/v1alpha1
kind: Scope
metadata:
name: scope-sample
spec:
region: frankfurt1
description: "my scope"
```

In case the `region` field is empty, as it is an optional field, the namespace will
be synced down to all infrastructure clusters.

The idea of keeping track of how many regional objects are in a particular namespace
has been dismissed, as it is hard to track how many of those objects are inside a namespace,
especially since this has to be done in the `parant` hierarchy as well.

As a result of this descission the `region` field on all given objects must be immutable.