-
Notifications
You must be signed in to change notification settings - Fork 48
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
Typed Config for GOP #241
Typed Config for GOP #241
Conversation
This allows for adding internal properties (can't be set by user via config), preparing for Schema to become the typed configuration object. Reuse @JsonPropertyDescription that already was on almost all properties. A more explicit and more common alternative would have been to use @JsonProperty, but this would basically mean to duplicate all @JsonPropertyDescription annotations adding more than 100 LOC of bloat.
For future usage as config singleton used by all classes.
* More compact output than JSON, * more reuse, * Less complex code, all Config conversions (fromMap, toMap, toYaml) in one place * Get rid of complicated ConfigToConfigFileConverterTest
Allows for a smooth transition from injecting Map via Configuration to injecting Config object directly.
Config and CLI options in one place promise easier maintenance. Not directly related minor refactorings: * Schema now knows the possible values for VaultMode. * Allow for setting config file and map at the same time * this also makes precedence of config options more explicit in code * On top of that, also prepares for adding more config options like secrets or multiple maps or secrets * Hides stack traces when not debug or trace. * Some more classes that are only needed during initialization were converted to static, which make GitopsPlaygroundCliMainScripted a bit simpler. Downsides: Drop params --petclinic-base-domain --nginx-base-domain Because they will soon be refactored anyway and would require separate classes. @immutable needed to be removed, because Picocli can't handle Strings. All options like @immutable or using lombok seem impossible or come with huge downsides themselves. So it would be pragmatic to accept a mutable config :/
46195af
to
a90b27b
Compare
src/main/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCliMainScripted.groovy
Show resolved
Hide resolved
@@ -161,6 +162,6 @@ class ScmmRepoTest { | |||
} | |||
|
|||
private ScmmRepo createRepo(String repoTarget = "dont-care-repo-target") { | |||
return new TestScmmRepoProvider(new Configuration(config), new FileSystemUtils()).getRepo(repoTarget) | |||
return new TestScmmRepoProvider(Config.fromMap(config), new FileSystemUtils()).getRepo(repoTarget) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change map to Config in tests?
@@ -13,7 +14,7 @@ class NetworkingUtilsTest { | |||
] | |||
] | |||
|
|||
K8sClientForTest k8sClient = new K8sClientForTest(config) | |||
K8sClientForTest k8sClient = new K8sClientForTest(Config.fromMap( config)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config ?
@@ -47,6 +48,6 @@ class DeployerTest { | |||
] | |||
] | |||
|
|||
return new Deployer(new Configuration(config), argoCdStrat, helmStrat) | |||
return new Deployer(Config.fromMap(config), argoCdStrat, helmStrat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config?
@@ -85,7 +86,7 @@ spec: | |||
] | |||
|
|||
|
|||
def repoProvider = new TestScmmRepoProvider(new Configuration(config), new FileSystemUtils()) { | |||
def repoProvider = new TestScmmRepoProvider(Config.fromMap(config), new FileSystemUtils()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config?
@@ -13,7 +14,7 @@ class FeatureTest { | |||
namePrefix: "foo-" | |||
] | |||
] | |||
K8sClientForTest k8sClient = new K8sClientForTest(config) | |||
K8sClientForTest k8sClient = new K8sClientForTest(Config.fromMap( config)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Config instead Map ?
config.application['mirrorRepos'] = true | ||
when(airGappedUtils.mirrorHelmRepoToGit(any(Map))).thenReturn('a/b') | ||
config.application.mirrorRepos = true | ||
when(airGappedUtils.mirrorHelmRepoToGit(any())).thenReturn('a/b') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifiy any()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
src/test/groovy/com/cloudogu/gitops/destroy/ScmmDestructionHandlerTest.groovy
Show resolved
Hide resolved
5d87273
to
b38f42d
Compare
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
After they moved there from ApplicationConfigurator in #241
No description provided.