Skip to content

Commit c475d9a

Browse files
authored
Merge pull request #31 from kubero-dev/release/v2.0.0
add audit and console questions when installing UI
2 parents cc0f2df + 84a2dd4 commit c475d9a

2 files changed

Lines changed: 111 additions & 11 deletions

File tree

cmd/kuberoCli/install.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,25 @@ func installKuberoUi() {
623623
kuberoUIConfig.Spec.Registry.StorageClassName = kuberoUIRegistryStorageClassName
624624
}
625625

626+
kuberoUIAudit := promptLine("Enable Audit Logging", "[y/n]", "n")
627+
if kuberoUIAudit == "y" {
628+
kuberoUIConfig.Spec.Kubero.AuditLogs.Enabled = true
629+
630+
storageClassList := getAvailableStorageClasses()
631+
632+
kuberoUIRegistryStorageClassName := selectFromList("Registry storage class", storageClassList, "")
633+
kuberoUIConfig.Spec.Kubero.AuditLogs.StorageClassName = kuberoUIRegistryStorageClassName
634+
635+
}
636+
637+
kuberoUIconsole := promptLine("Enable Console Access to running contianers", "[y/n]", "n")
638+
639+
if kuberoUIconsole == "y" {
640+
kuberoUIConfig.Spec.Kubero.Config.Kubero.Console.Enabled = true
641+
}
642+
643+
//kuberoUIConfig.Spec.Image.Tag = "v2.0.0-rc.8"
644+
626645
if clusterType == "" {
627646
clusterType = selectFromList("Which cluster type have you insalled?", clusterTypeList, "")
628647
}
@@ -636,6 +655,7 @@ func installKuberoUi() {
636655

637656
kuberiUIYaml, _ := yaml.Marshal(kuberoUIConfig)
638657
kuberiUIErr := os.WriteFile("kuberoUI.yaml", kuberiUIYaml, 0644)
658+
639659
if kuberiUIErr != nil {
640660
fmt.Println(kuberiUIErr)
641661
return

cmd/kuberoCli/install.types.go

Lines changed: 91 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,25 +190,105 @@ type KuberoUIConfig struct {
190190
Auth struct {
191191
Github struct {
192192
Enabled bool `yaml:"enabled"`
193-
ID string `yaml:"id"`
194-
Secret string `yaml:"secret"`
195-
CallbackURL string `yaml:"callbackUrl"`
196-
Org string `yaml:"org"`
193+
ID string `yaml:"id,omitempty`
194+
Secret string `yaml:"secret,omitempty"`
195+
CallbackURL string `yaml:"callbackUrl,omitempty"`
196+
Org string `yaml:"org,omitempty"`
197197
} `yaml:"github"`
198198
Oauth2 struct {
199199
Enabled bool `yaml:"enabled"`
200-
Name string `yaml:"name"`
201-
ID string `yaml:"id"`
202-
AuthURL string `yaml:"authUrl"`
203-
TokenURL string `yaml:"tokenUrl"`
204-
Secret string `yaml:"secret"`
205-
CallbackURL string `yaml:"callbackUrl"`
200+
Name string `yaml:"name,omitempty"`
201+
ID string `yaml:"id,omitempty"`
202+
AuthURL string `yaml:"authUrl,omitempty"`
203+
TokenURL string `yaml:"tokenUrl,omitempty"`
204+
Secret string `yaml:"secret,omitempty"`
205+
CallbackURL string `yaml:"callbackUrl,omitempty"`
206206
} `yaml:"oauth2"`
207207
} `yaml:"auth"`
208-
Config string `yaml:"config"`
208+
AuditLogs struct {
209+
Enabled bool `yaml:"enabled"`
210+
StorageClassName string `yaml:"storageClassName"`
211+
Size string `yaml:"size"`
212+
AccessModes []string `yaml:"accessModes"`
213+
Limit string `yaml:"limit"`
214+
} `yaml:"auditLogs"`
215+
Config KuberoConfigfile `yaml:"config,omitempty"`
209216
} `yaml:"kubero"`
210217
} `yaml:"spec"`
211218
}
219+
220+
type KuberoConfigfile struct {
221+
Kubero struct {
222+
Readonly bool `yaml:"readonly"`
223+
Console struct {
224+
Enabled bool `yaml:"enabled"`
225+
} `yaml:"console"`
226+
Banner struct {
227+
Show bool `yaml:"show"`
228+
Message string `yaml:"message"`
229+
Bgcolor string `yaml:"bgcolor"`
230+
Fontcolor string `yaml:"fontcolor"`
231+
} `yaml:"banner"`
232+
} `yaml:"kubero"`
233+
Clusterissuer string `yaml:"clusterissuer"`
234+
Templates struct {
235+
Enabled bool `yaml:"enabled"`
236+
Catalogs []struct {
237+
Name string `yaml:"name"`
238+
Description string `yaml:"description"`
239+
TemplateBasePath string `yaml:"templateBasePath"`
240+
Index struct {
241+
URL string `yaml:"url"`
242+
Format string `yaml:"format"`
243+
} `yaml:"index"`
244+
} `yaml:"catalogs"`
245+
} `yaml:"templates"`
246+
Buildpacks []struct {
247+
Name string `yaml:"name"`
248+
Language string `yaml:"language"`
249+
Fetch struct {
250+
Repository string `yaml:"repository"`
251+
Tag string `yaml:"tag"`
252+
SecurityContext struct {
253+
RunAsUser int `yaml:"runAsUser"`
254+
} `yaml:"securityContext"`
255+
} `yaml:"fetch"`
256+
Build struct {
257+
Repository string `yaml:"repository"`
258+
Tag string `yaml:"tag"`
259+
Command string `yaml:"command"`
260+
SecurityContext struct {
261+
RunAsUser int `yaml:"runAsUser"`
262+
} `yaml:"securityContext"`
263+
} `yaml:"build,omitempty"`
264+
Run struct {
265+
Repository string `yaml:"repository"`
266+
Tag string `yaml:"tag"`
267+
ReadOnlyAppStorage bool `yaml:"readOnlyAppStorage"`
268+
SecurityContext struct {
269+
AllowPrivilegeEscalation bool `yaml:"allowPrivilegeEscalation"`
270+
ReadOnlyRootFilesystem bool `yaml:"readOnlyRootFilesystem"`
271+
} `yaml:"securityContext"`
272+
Command string `yaml:"command"`
273+
} `yaml:"run,omitempty"`
274+
} `yaml:"buildpacks"`
275+
PodSizeList []struct {
276+
Active bool `yaml:"active,omitempty"`
277+
Name string `yaml:"name"`
278+
Description string `yaml:"description"`
279+
Default bool `yaml:"default,omitempty"`
280+
Resources struct {
281+
Requests struct {
282+
Memory string `yaml:"memory"`
283+
CPU string `yaml:"cpu"`
284+
} `yaml:"requests"`
285+
Limits struct {
286+
Memory string `yaml:"memory"`
287+
CPU string `yaml:"cpu"`
288+
} `yaml:"limits"`
289+
} `yaml:"resources,omitempty"`
290+
} `yaml:"podSizeList"`
291+
}
212292
type KuberoUItls struct {
213293
SecretName string `yaml:"secretName"`
214294
Hosts []string `yaml:"hosts"`

0 commit comments

Comments
 (0)