Skip to content

Commit 7d3ac86

Browse files
Merge branch 'main' of https://github.com/Sheikh-Abubaker/cyclops into log-pr
2 parents becd137 + cfb9346 commit 7d3ac86

File tree

6 files changed

+286
-73
lines changed

6 files changed

+286
-73
lines changed

cyctl/internal/create/template_auth_rules.go

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package create
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
67
"log"
78
"strings"
89

910
"github.com/cyclops-ui/cyclops/cyclops-ctrl/api/v1alpha1"
1011
"github.com/cyclops-ui/cyclops/cyclops-ctrl/api/v1alpha1/client"
1112
"github.com/cyclops-ui/cycops-cyctl/internal/kubeconfig"
13+
"github.com/manifoldco/promptui"
1214
"github.com/spf13/cobra"
1315
v1Spec "k8s.io/api/core/v1"
1416
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -28,6 +30,74 @@ var (
2830
password string
2931
)
3032

33+
func getTemplateAuthRulesFromPrompt() (string, string, string, string, string, error) {
34+
RepoPrompt := promptui.Prompt{
35+
Label: "repo",
36+
}
37+
repoValue, err := RepoPrompt.Run()
38+
if err != nil {
39+
return "", "", "", "", "", err
40+
}
41+
42+
usernameNamePrompt := promptui.Prompt{
43+
Label: "Username secret name",
44+
Validate: func(input string) error {
45+
if input == "" {
46+
return errors.New("username secret name cannot be empty")
47+
}
48+
return nil
49+
},
50+
}
51+
usernameName, err := usernameNamePrompt.Run()
52+
if err != nil {
53+
return "", "", "", "", "", err
54+
}
55+
56+
usernameKeyPrompt := promptui.Prompt{
57+
Label: "Username secret key",
58+
Validate: func(input string) error {
59+
if input == "" {
60+
return errors.New("the username secret key cannot be empty")
61+
}
62+
return nil
63+
},
64+
}
65+
usernameKey, err := usernameKeyPrompt.Run()
66+
if err != nil {
67+
return "", "", "", "", "", err
68+
}
69+
70+
passwordNamePrompt := promptui.Prompt{
71+
Label: "Password secret name",
72+
Validate: func(input string) error {
73+
if input == "" {
74+
return errors.New("the password secret name cannot be empty")
75+
}
76+
return nil
77+
},
78+
}
79+
passwordName, err := passwordNamePrompt.Run()
80+
if err != nil {
81+
return "", "", "", "", "", err
82+
}
83+
84+
passwordKeyPrompt := promptui.Prompt{
85+
Label: "Password secret key",
86+
Validate: func(input string) error {
87+
if input == "" {
88+
return errors.New("password secret key cannot be empty")
89+
}
90+
return nil
91+
},
92+
}
93+
passwordKey, err := passwordKeyPrompt.Run()
94+
if err != nil {
95+
return "", "", "", "", "", err
96+
}
97+
98+
return usernameName, usernameKey, passwordName, passwordKey, repoValue, nil
99+
}
100+
31101
func validateSecretKeySelector(username, password string) (string, string, string, string, error) {
32102
usernameName, usernameKey := splitNameKey(username)
33103
passwordName, passwordKey := splitNameKey(password)
@@ -50,10 +120,27 @@ func splitNameKey(input string) (string, string) {
50120

51121
// createTemplateAuthRule allows you to create TemplateAuthRule Custom Resource.
52122
func createTemplateAuthRule(clientset *client.CyclopsV1Alpha1Client, templateAuthRuleName string) {
53-
usernameName, usernameKey, passwordName, passwordKey, err := validateSecretKeySelector(username, password)
54-
if err != nil {
55-
fmt.Println(err)
56-
return
123+
var (
124+
usernameName string
125+
passwordName string
126+
usernameKey string
127+
passwordKey string
128+
)
129+
130+
if username == "" && password == "" && repo == "" {
131+
var err error
132+
usernameName, usernameKey, passwordName, passwordKey, repo, err = getTemplateAuthRulesFromPrompt()
133+
if err != nil {
134+
log.Fatal(err)
135+
return
136+
}
137+
} else {
138+
var err error
139+
usernameName, usernameKey, passwordName, passwordKey, err = validateSecretKeySelector(username, password)
140+
if err != nil {
141+
log.Fatal(err)
142+
return
143+
}
57144
}
58145

59146
var localObjectNameRef, localObjectPasswordRef v1Spec.LocalObjectReference

install/chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: cyclops-chart
33
description: Cyclops Helm chart
44
type: application
5-
version: "0.9.0"
6-
appVersion: "v0.14.3"
5+
version: "0.11.0"
6+
appVersion: "v0.15.2"
77
home: https://cyclops-ui.com/
88
keywords:
99
- Devops

install/chart/values.yaml

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,64 +9,64 @@ ctrl:
99
ui:
1010
replicas: 1
1111

12-
templateStore:
13-
- name: demo
14-
repo: https://github.com/cyclops-ui/templates
15-
path: demo
16-
version: main
17-
iconURL: https://github.com/cyclops-ui/cyclops/blob/main/cyclops-ui/src/static/img/default-template-icon.png?raw=true
18-
sourceType: git
19-
- name: app-template
20-
repo: https://github.com/cyclops-ui/templates
21-
path: app-template
22-
version: main
23-
iconURL: https://github.com/cyclops-ui/cyclops/blob/main/cyclops-ui/src/static/img/default-template-icon.png?raw=true
24-
sourceType: git
25-
- name: jenkins
26-
repo: https://github.com/bitnami/charts
27-
path: bitnami/jenkins
28-
version: main
29-
iconURL: https://bitnami.com/assets/stacks/jenkins/img/jenkins-stack-220x234.png
30-
sourceType: git
31-
- name: mariadb
32-
repo: https://github.com/bitnami/charts
33-
path: bitnami/mariadb
34-
version: main
35-
iconURL: https://bitnami.com/assets/stacks/mariadb/img/mariadb-stack-220x234.png
36-
sourceType: git
37-
- name: metabase
38-
repo: https://github.com/cyclops-ui/templates
39-
path: metabase
40-
version: main
41-
iconURL: https://www.metabase.com/images/logo.svg
42-
sourceType: git
43-
- name: mysql
44-
repo: https://github.com/bitnami/charts
45-
path: bitnami/mysql
46-
version: main
47-
iconURL: https://bitnami.com/assets/stacks/mysql/img/mysql-stack-220x234.png
48-
sourceType: git
49-
- name: postgresql
50-
repo: https://github.com/bitnami/charts
51-
path: bitnami/postgresql
52-
version: main
53-
iconURL: https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-220x234.png
54-
sourceType: git
55-
- name: prometheus
56-
repo: https://github.com/bitnami/charts
57-
path: bitnami/prometheus
58-
version: main
59-
iconURL: https://bitnami.com/assets/stacks/prometheus/img/prometheus-stack-220x234.png
60-
sourceType: git
61-
- name: rabbitmq
62-
repo: https://github.com/bitnami/charts
63-
path: bitnami/rabbitmq
64-
version: main
65-
iconURL: https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png
66-
sourceType: git
67-
- name: redis
68-
repo: https://github.com/bitnami/charts
69-
path: bitnami/redis
70-
version: main
71-
iconURL: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
72-
sourceType: git
12+
#templateStore:
13+
# - name: demo
14+
# repo: https://github.com/cyclops-ui/templates
15+
# path: demo
16+
# version: main
17+
# iconURL: https://github.com/cyclops-ui/cyclops/blob/main/cyclops-ui/src/static/img/default-template-icon.png?raw=true
18+
# sourceType: git
19+
# - name: app-template
20+
# repo: https://github.com/cyclops-ui/templates
21+
# path: app-template
22+
# version: main
23+
# iconURL: https://github.com/cyclops-ui/cyclops/blob/main/cyclops-ui/src/static/img/default-template-icon.png?raw=true
24+
# sourceType: git
25+
# - name: jenkins
26+
# repo: https://github.com/bitnami/charts
27+
# path: bitnami/jenkins
28+
# version: main
29+
# iconURL: https://bitnami.com/assets/stacks/jenkins/img/jenkins-stack-220x234.png
30+
# sourceType: git
31+
# - name: mariadb
32+
# repo: https://github.com/bitnami/charts
33+
# path: bitnami/mariadb
34+
# version: main
35+
# iconURL: https://bitnami.com/assets/stacks/mariadb/img/mariadb-stack-220x234.png
36+
# sourceType: git
37+
# - name: metabase
38+
# repo: https://github.com/cyclops-ui/templates
39+
# path: metabase
40+
# version: main
41+
# iconURL: https://www.metabase.com/images/logo.svg
42+
# sourceType: git
43+
# - name: mysql
44+
# repo: https://github.com/bitnami/charts
45+
# path: bitnami/mysql
46+
# version: main
47+
# iconURL: https://bitnami.com/assets/stacks/mysql/img/mysql-stack-220x234.png
48+
# sourceType: git
49+
# - name: postgresql
50+
# repo: https://github.com/bitnami/charts
51+
# path: bitnami/postgresql
52+
# version: main
53+
# iconURL: https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-220x234.png
54+
# sourceType: git
55+
# - name: prometheus
56+
# repo: https://github.com/bitnami/charts
57+
# path: bitnami/prometheus
58+
# version: main
59+
# iconURL: https://bitnami.com/assets/stacks/prometheus/img/prometheus-stack-220x234.png
60+
# sourceType: git
61+
# - name: rabbitmq
62+
# repo: https://github.com/bitnami/charts
63+
# path: bitnami/rabbitmq
64+
# version: main
65+
# iconURL: https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png
66+
# sourceType: git
67+
# - name: redis
68+
# repo: https://github.com/bitnami/charts
69+
# path: bitnami/redis
70+
# version: main
71+
# iconURL: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
72+
# sourceType: git

web/docs/installation/configuration.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
Following are environment variables you can use to configure your instance of Cyclops. You can set those environment
44
variables directly on the `cyclops-ui` Kubernetes deployment.
55

6+
### Cyclops controller
7+
8+
| Name | Description | Default value |
9+
|:------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------|
10+
| PORT | Specify a port to expose the controller API | 8080 |
11+
| DISABLE_TELEMETRY | By default, Cyclops controller emits usage metrics. If this env variable is set to `true`, the usage metrics are not exposed. You can read more about usage metrics [here](https://cyclops-ui.com/docs/usage_metrics/) | false |
12+
| WATCH_NAMESPACE | Kubernetes namespace used for all Cyclops custom resources like `Modules`, `TemplateStores` and `TemplateAuthRules`. Cyclops is aware only of the custom resources in this namespace. Cyclops controller will not react to changes on Modules on other namespaces | cyclops |
13+
| MODULE_TARGET_NAMESPACE | By default, Cyclops can manage resources created from Modules in the whole cluster. If this environment variable is set, Cyclops can manage Module child resources only in the namespace specified in the variable | - (empty means cluster scope) |
14+
| WATCH_NAMESPACE_HELM | By default, Cyclops can list, get and upgrade Helm releases in the whole cluster. If this environment variable is set, Cyclops can manage releases and their resources only in the namespace specified in the variable | - (empty means cluster scope) |
15+
616
### Cyclops UI
717

8-
| Name | Description | Default value |
9-
| :--------------------------------- | :------------------------------------------------------------------------ | :-------------------- |
10-
| REACT_APP_CYCLOPS_CTRL_HOST | Content | http://localhost:8080 |
11-
| REACT_APP_DEFAULT_TEMPLATE_REPO | Default template repo (E.g. https://github.com/cyclops-ui/templates) | - |
12-
| REACT_APP_DEFAULT_TEMPLATE_PATH | Default template path (E.g. `demo`) | - |
13-
| REACT_APP_DEFAULT_TEMPLATE_VERSION | Default template version<br/>Can be a commit hash, a tag or a branch name | - |
18+
| Name | Description | Default value |
19+
|:----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------|
20+
| REACT_APP_CYCLOPS_CTRL_HOST | Host of your Cyclops controller | http://cyclops-ctrl.cyclops:8080 |
21+
| REACT_APP_ENABLE_STREAMING | Configures whether the Cyclops UI will subscribe to resource status SSE stream from cyclops controller. If `false`, resource status is polled each 15 seconds | true |

0 commit comments

Comments
 (0)