Skip to content

Commit

Permalink
Merge pull request #80 from onmetal/scope_region
Browse files Browse the repository at this point in the history
Add region field to `Scope` resource
  • Loading branch information
afritzler authored Jul 26, 2021
2 parents c1750f0 + d73f2b5 commit 760cb02
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
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.

0 comments on commit 760cb02

Please sign in to comment.