Skip to content

Commit 124800c

Browse files
committed
add audit and console questions when installing UI
1 parent cc0f2df commit 124800c

2 files changed

Lines changed: 114 additions & 12 deletions

File tree

cmd/kuberoCli/install.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ func installKuberoUi() {
562562
installer := resty.New()
563563

564564
installer.SetBaseURL("https://raw.githubusercontent.com")
565-
kf, _ := installer.R().Get("kubero-dev/kubero-operator/main/config/samples/application_v1alpha1_kubero.yaml")
565+
//kf, _ := installer.R().Get("kubero-dev/kubero-operator/main/config/samples/application_v1alpha1_kubero.yaml")
566+
kf, _ := installer.R().Get("kubero-dev/kubero-operator/feature/add-console-config/config/samples/application_v1alpha1_kubero.yaml")
566567

567568
var kuberoUIConfig KuberoUIConfig
568569
yaml.Unmarshal(kf.Body(), &kuberoUIConfig)
@@ -623,6 +624,25 @@ func installKuberoUi() {
623624
kuberoUIConfig.Spec.Registry.StorageClassName = kuberoUIRegistryStorageClassName
624625
}
625626

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

637657
kuberiUIYaml, _ := yaml.Marshal(kuberoUIConfig)
638658
kuberiUIErr := os.WriteFile("kuberoUI.yaml", kuberiUIYaml, 0644)
659+
660+
//os.Exit(0)
639661
if kuberiUIErr != nil {
640662
fmt.Println(kuberiUIErr)
641663
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)