Skip to content

Commit 1d1245a

Browse files
authored
feat: update install config generation (#210)
* Generate managed services config by default * Do not marshal empty issuer type * Minor update: help output of --skip-steps --------- Signed-off-by: NautiluX <2600004+NautiluX@users.noreply.github.com> Co-authored-by: NautiluX <2600004+NautiluX@users.noreply.github.com>
1 parent f64314b commit 1d1245a

File tree

9 files changed

+35
-28
lines changed

9 files changed

+35
-28
lines changed

NOTICE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ License URL: https://github.com/googleapis/google-cloud-go/blob/auth/oauth2adapt
2323

2424
----------
2525
Module: cloud.google.com/go/compute
26-
Version: v1.54.0
26+
Version: v1.55.0
2727
License: Apache-2.0
28-
License URL: https://github.com/googleapis/google-cloud-go/blob/compute/v1.54.0/compute/LICENSE
28+
License URL: https://github.com/googleapis/google-cloud-go/blob/compute/v1.55.0/compute/LICENSE
2929

3030
----------
3131
Module: cloud.google.com/go/compute/metadata
@@ -95,9 +95,9 @@ License URL: https://github.com/clipperhouse/uax29/blob/v2.4.0/LICENSE
9595

9696
----------
9797
Module: github.com/codesphere-cloud/cs-go
98-
Version: v0.17.2
98+
Version: v0.19.1
9999
License: Apache-2.0
100-
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.17.2/LICENSE
100+
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.19.1/LICENSE
101101

102102
----------
103103
Module: github.com/codesphere-cloud/oms/internal/tmpl

cli/cmd/install_codesphere.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func AddInstallCodesphereCmd(install *cobra.Command, opts *GlobalOptions) {
6868
codesphere.cmd.Flags().BoolVarP(&codesphere.Opts.Force, "force", "f", false, "Enforce package extraction")
6969
codesphere.cmd.Flags().StringVarP(&codesphere.Opts.Config, "config", "c", "", "Path to the Codesphere Private Cloud configuration file (yaml)")
7070
codesphere.cmd.Flags().StringVarP(&codesphere.Opts.PrivKey, "priv-key", "k", "", "Path to the private key to encrypt/decrypt secrets")
71-
codesphere.cmd.Flags().StringSliceVarP(&codesphere.Opts.SkipSteps, "skip-steps", "s", []string{}, "Steps to be skipped. Must be one of: copy-dependencies, extract-dependencies, load-container-images, ceph, kubernetes")
71+
codesphere.cmd.Flags().StringSliceVarP(&codesphere.Opts.SkipSteps, "skip-steps", "s", []string{}, "Steps to be skipped. E.g. copy-dependencies, extract-dependencies, load-container-images, ceph, kubernetes")
7272

7373
util.MarkFlagRequired(codesphere.cmd, "package")
7474
util.MarkFlagRequired(codesphere.cmd, "config")

docs/oms-cli_install_codesphere.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ oms-cli install codesphere [flags]
1919
-h, --help help for codesphere
2020
-p, --package string Package file (e.g. codesphere-v1.2.3-installer.tar.gz) to load binaries, installer etc. from
2121
-k, --priv-key string Path to the private key to encrypt/decrypt secrets
22-
-s, --skip-steps strings Steps to be skipped. Must be one of: copy-dependencies, extract-dependencies, load-container-images, ceph, kubernetes
22+
-s, --skip-steps strings Steps to be skipped. E.g. copy-dependencies, extract-dependencies, load-container-images, ceph, kubernetes
2323
```
2424

2525
### SEE ALSO

internal/bootstrap/gcp/gcp.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,6 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
12791279
}
12801280
b.Env.InstallConfig.Codesphere.Experiments = b.Env.Experiments
12811281
b.Env.InstallConfig.Codesphere.Features = b.Env.FeatureFlags
1282-
b.Env.InstallConfig.Codesphere.ManagedServices = []files.ManagedServiceConfig{}
12831282

12841283
if !b.Env.ExistingConfigUsed {
12851284
err := b.icg.GenerateSecrets()
@@ -1308,21 +1307,6 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
13081307
}
13091308
}
13101309

1311-
b.Env.InstallConfig.Codesphere.ManagedServices = []files.ManagedServiceConfig{
1312-
{
1313-
Name: "postgres",
1314-
Version: "v1",
1315-
},
1316-
{
1317-
Name: "babelfish",
1318-
Version: "v1",
1319-
},
1320-
{
1321-
Name: "s3",
1322-
Version: "v1",
1323-
},
1324-
}
1325-
13261310
if b.Env.OpenBaoURI != "" {
13271311
b.Env.InstallConfig.Codesphere.OpenBao = &files.OpenBaoConfig{
13281312
Engine: b.Env.OpenBaoEngine,

internal/bootstrap/gcp/gcp_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ var _ = Describe("GCP Bootstrapper", func() {
256256
Expect(cpNode.GetExternalIP()).To(Equal("1.2.3.4"))
257257
Expect(cpNode.GetInternalIP()).To(Equal("10.0.0.1"))
258258
}
259+
260+
Expect(len(bs.Env.InstallConfig.Codesphere.ManagedServices)).To(Equal(4))
259261
})
260262
})
261263

@@ -1188,7 +1190,6 @@ var _ = Describe("GCP Bootstrapper", func() {
11881190
Expect(cloudDns["project"]).To(Equal(bs.Env.DNSProjectID))
11891191

11901192
Expect(bs.Env.InstallConfig.Codesphere.OpenBao).To(BeNil())
1191-
Expect(len(bs.Env.InstallConfig.Codesphere.ManagedServices)).To(Equal(3))
11921193
})
11931194
Context("When Experiments are set in CodesphereEnvironment", func() {
11941195
BeforeEach(func() {

internal/installer/config_manager_profile.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
103103
g.Config.ManagedServiceBackends = &files.ManagedServiceBackendsConfig{
104104
Postgres: make(map[string]interface{}),
105105
}
106+
g.Config.Codesphere.ManagedServices = []files.ManagedServiceConfig{
107+
{
108+
Name: "postgres",
109+
Version: "v1",
110+
},
111+
{
112+
Name: "babelfish",
113+
Version: "v1",
114+
},
115+
{
116+
Name: "s3",
117+
Version: "v1",
118+
},
119+
{
120+
Name: "virtual-k8s",
121+
Version: "v1",
122+
},
123+
}
106124
g.Config.Secrets.BaseDir = "/root/secrets"
107125

108126
switch profile {

internal/installer/config_manager_profile_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ var _ = Describe("ConfigManagerProfile", func() {
223223
Expect(config.ManagedServiceBackends).ToNot(BeNil())
224224
Expect(config.ManagedServiceBackends.Postgres).ToNot(BeNil())
225225

226+
// Managed service config
227+
Expect(config.Codesphere.ManagedServices).ToNot(BeNil())
228+
Expect(len(config.Codesphere.ManagedServices)).To(Equal(4))
229+
226230
// Secrets
227231
Expect(config.Secrets.BaseDir).To(Equal("/root/secrets"))
228232
})

internal/installer/files/config_yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ const (
285285
)
286286

287287
type CertIssuerConfig struct {
288-
Type CertIssuerType `yaml:"type"`
288+
Type CertIssuerType `yaml:"type,omitempty"`
289289
Acme *ACMEConfig `yaml:"acme,omitempty"`
290290
}
291291

internal/tmpl/NOTICE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ License URL: https://github.com/googleapis/google-cloud-go/blob/auth/oauth2adapt
2323

2424
----------
2525
Module: cloud.google.com/go/compute
26-
Version: v1.54.0
26+
Version: v1.55.0
2727
License: Apache-2.0
28-
License URL: https://github.com/googleapis/google-cloud-go/blob/compute/v1.54.0/compute/LICENSE
28+
License URL: https://github.com/googleapis/google-cloud-go/blob/compute/v1.55.0/compute/LICENSE
2929

3030
----------
3131
Module: cloud.google.com/go/compute/metadata
@@ -95,9 +95,9 @@ License URL: https://github.com/clipperhouse/uax29/blob/v2.4.0/LICENSE
9595

9696
----------
9797
Module: github.com/codesphere-cloud/cs-go
98-
Version: v0.17.2
98+
Version: v0.19.1
9999
License: Apache-2.0
100-
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.17.2/LICENSE
100+
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.19.1/LICENSE
101101

102102
----------
103103
Module: github.com/codesphere-cloud/oms/internal/tmpl

0 commit comments

Comments
 (0)