Skip to content

Commit

Permalink
#38 - add descriptions to crd
Browse files Browse the repository at this point in the history
  • Loading branch information
meiserloh committed Feb 28, 2024
2 parents 21ecfa1 + 6577c14 commit 56d3166
Show file tree
Hide file tree
Showing 30 changed files with 2,760 additions and 101 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ Config-specific:
- [#48] Save config diff in cluster
- [#39] Encrypt sensitive data
- [#36] Set registry configuration for dogu and global config.
- [#38] Censor all sensitive configuration data after applying the blueprint
- [#38] Censor all sensitive configuration data after applying the blueprint
- [#45] Set registry configuration for encrypted values.
42 changes: 40 additions & 2 deletions k8s/helm-crd/templates/k8s.cloudogu.com_blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,50 @@ spec:
description: Config is used for ecosystem configuration to be applied. Optional.
properties:
dogus:
description: Dogu config is the configuration specific to each dogu. Dogus can have normal and sensitive (encrypted) configuration values.
additionalProperties:
properties:
config:
description: Normal configuration that will not be encrypted on save.
properties:
absent:
description: Configuration keys that shall be deleted with this blueprint.
items:
description: The key of the configuration to be deleted.
type: string
type: array
present:
description: Configuration that shall be applied with this blueprint. Key is the configuration key with the complete path, value the corresponding configuration value.
additionalProperties:
type: string
type: object
type: object
sensitiveConfig:
description: Sensitive configuration that will be encrypted on save.
properties:
absent:
description: Configuration keys that shall be deleted with this blueprint.
items:
type: string
type: array
present:
description: Configuration that shall be applied with this blueprint. Key is the configuration key with the complete path, value the corresponding configuration value.
additionalProperties:
type: string
type: object
type: object
type: object
type: object
global:
description: Global configuration values that are necessary for multiple dogus or the whole system.
properties:
absent:
description: Configuration keys that shall be deleted with this blueprint.
items:
type: string
type: array
present:
description: Configuration that shall be applied with this blueprint. Key is the configuration key with the complete path, value the corresponding configuration value.
additionalProperties:
type: string
type: object
Expand Down Expand Up @@ -153,6 +164,7 @@ spec:
description: StateDiff is the result of comparing the EffectiveBlueprint to the current cluster state. It describes what operations need to be done to achieve the desired state of the blueprint.
properties:
componentDiffs:
description: ComponentDiffs maps simple component names to the determined diff.
additionalProperties:
description: ComponentDiff is the comparison of a Component's desired state vs. its cluster state. It contains the operation that needs to be done to achieve this desired state.
properties:
Expand Down Expand Up @@ -194,35 +206,45 @@ spec:
- expected
- neededAction
type: object
description: ComponentDiffs maps simple component names to the determined diff.
type: object
doguConfigDiffs:
description: DoguConfigDiffs maps simple dogu names to the determined configuration diff.
additionalProperties:
description: Each Dogu config diff is the comparison of a Dogu's desired configuration state vs. its cluster state. It contains the operation that needs to be done to achieve this desired state.
properties:
doguConfigDiff:
description: Describes the differences in normal configuration values between the blueprint and the cluster.
items:
properties:
actual:
description: Actual contains the dogu's configuration state in the current system.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
expected:
description: Expected contains the desired dogu's configuration target state.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
key:
description: Key describes the configuration key with its complete path.
type: string
neededAction:
description: NeededAction contains the refined action as decided by the application's state determination automaton.
type: string
required:
- actual
Expand All @@ -232,31 +254,40 @@ spec:
type: object
type: array
sensitiveDoguConfigDiff:
description: Describes the differences in sensitive configuration values between the blueprint and the cluster.
items:
properties:
actual:
description: Actual contains the dogu's configuration state in the current system.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
doguNotInstalled:
type: boolean
expected:
description: Expected contains the desired dogu's configuration target state.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
key:
description: Key describes the configuration key with its complete path.
type: string
neededAction:
description: NeededAction contains the refined action as decided by the application's state determination automaton.
type: string
required:
- actual
Expand All @@ -269,7 +300,6 @@ spec:
- doguConfigDiff
- sensitiveDoguConfigDiff
type: object
description: DoguConfigDiffs maps simple dogu names to the determined config diff.
type: object
doguDiffs:
additionalProperties:
Expand Down Expand Up @@ -314,26 +344,34 @@ spec:
items:
properties:
actual:
description: Actual contains the global configuration state in the current system.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
expected:
description: Expected contains the desired dogu's configuration target state.
properties:
exists:
description: Exists describes whether the configuration already exists or not.
type: boolean
value:
description: Value describes the configuration value.
type: string
required:
- exists
type: object
key:
description: Key describes the configuration key with its complete path.
type: string
neededAction:
description: NeededAction contains the refined action as decided by the application's state determination automaton.
type: string
required:
- actual
Expand Down
4 changes: 3 additions & 1 deletion k8s/helm/templates/manager-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ rules:
resources:
- secrets
verbs:
- get
- create
- update
- get
18 changes: 18 additions & 0 deletions pkg/adapter/combinedSecretEtcdSensitiveDoguConfigRepository.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package adapter

import (
"github.com/cloudogu/k8s-blueprint-operator/pkg/adapter/config/etcd"
"github.com/cloudogu/k8s-blueprint-operator/pkg/adapter/kubernetes/config"
)

type SecretEtcdSensitiveDoguConfigRepository struct {
*etcd.EtcdSensitiveDoguConfigRepository
*config.SecretSensitiveDoguConfigRepository
}

func NewCombinedSecretEtcdSensitiveDoguConfigRepository(etcdRepo *etcd.EtcdSensitiveDoguConfigRepository, secretRepo *config.SecretSensitiveDoguConfigRepository) *SecretEtcdSensitiveDoguConfigRepository {
return &SecretEtcdSensitiveDoguConfigRepository{
EtcdSensitiveDoguConfigRepository: etcdRepo,
SecretSensitiveDoguConfigRepository: secretRepo,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package adapter

import (
"github.com/cloudogu/k8s-blueprint-operator/pkg/adapter/config/etcd"
"github.com/cloudogu/k8s-blueprint-operator/pkg/adapter/kubernetes/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)

func TestNewCombinedSecretEtcdSensitiveDoguConfigRepository(t *testing.T) {
t.Run("success", func(t *testing.T) {
// given
secretRepo := &config.SecretSensitiveDoguConfigRepository{}
etcdRepo := &etcd.EtcdSensitiveDoguConfigRepository{}

// when
combinedRepo := NewCombinedSecretEtcdSensitiveDoguConfigRepository(etcdRepo, secretRepo)

// then
require.NotNil(t, combinedRepo)
assert.Equal(t, secretRepo, combinedRepo.SecretSensitiveDoguConfigRepository)
assert.Equal(t, etcdRepo, combinedRepo.EtcdSensitiveDoguConfigRepository)
})
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package etcd

import (
"github.com/cloudogu/k8s-blueprint-operator/pkg/domain/common"
Expand Down
16 changes: 16 additions & 0 deletions pkg/adapter/config/etcd/interfaces.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package etcd

import (
"github.com/cloudogu/cesapp-lib/registry"
)

type etcdStore interface {
registry.Registry
}
type globalConfigStore interface {
registry.ConfigurationContext
}

type configurationContext interface {
registry.ConfigurationContext
}
Loading

0 comments on commit 56d3166

Please sign in to comment.