Skip to content

Commit 98f5919

Browse files
authored
Saas 8385 (#181)
* added --values, --set-value, --set-file to all * added debugging from codefresh-cli * values -tst1 * rewrite cmd-template-values * --values for uninstall and upgrade * debug with cli-1 * README --values * added skip rbac * added main_windows.go * RuntimeInCluster
1 parent 9d2ef10 commit 98f5919

25 files changed

+117
-94
lines changed

venona/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.20
1+
1.4.21

venonactl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.20
1+
1.4.21

venonactl/cmd/attach.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ var attachRuntimeCmd = &cobra.Command{
107107
}
108108

109109
// runtime
110-
builderInstallOpt.KubeBuilder = getKubeClientBuilder(attachRuntimeCmdOptions.kube.context, attachRuntimeCmdOptions.kube.namespace, attachRuntimeCmdOptions.kube.kubePath, false)
110+
var runtimeInCluster bool
111+
mergeValueBool(templateValuesMap, "RuntimeInCluster", &runtimeInCluster)
112+
builderInstallOpt.KubeBuilder = getKubeClientBuilder(attachRuntimeCmdOptions.kube.context, attachRuntimeCmdOptions.kube.namespace, attachRuntimeCmdOptions.kube.kubePath, runtimeInCluster)
111113

112114
// agent
113115
builderInstallOpt.AgentKubeBuilder = getKubeClientBuilder(attachRuntimeCmdOptions.kubeVenona.context,

venonactl/cmd/cmdutils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,5 @@ func mergeValueBool(valuesMap map[string]interface{}, key string, param *bool) {
294294
}
295295
val := mapX.Get(key).Bool()
296296
*param = val
297-
}
297+
}
298+

venonactl/pkg/plugins/runtime-attach.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,18 @@ func buildRuntimeConfig(opt *InstallOptions, v Values) (RuntimeConfiguration, er
5757
return RuntimeConfiguration{}, fmt.Errorf("Failed to read service account runtime cluster: %v", err)
5858
}
5959

60-
secretRef := sa.Secrets[0]
61-
secret, err := cs.CoreV1().Secrets(opt.RuntimeClusterName).Get(secretRef.Name, getOpt)
60+
var saSecretName string
61+
saSecretPattern := fmt.Sprintf("%s-token-", opt.RuntimeServiceAccount)
62+
for _, secretRef := range(sa.Secrets) {
63+
if strings.Contains(secretRef.Name, saSecretPattern) {
64+
saSecretName = secretRef.Name
65+
break
66+
}
67+
}
68+
if saSecretName == "" {
69+
return RuntimeConfiguration{}, fmt.Errorf("Failed to get secret %s from service account %s", saSecretPattern, opt.RuntimeServiceAccount)
70+
}
71+
secret, err := cs.CoreV1().Secrets(opt.RuntimeClusterName).Get(saSecretName, getOpt)
6272
if err != nil {
6373
return RuntimeConfiguration{}, fmt.Errorf("Failed to get secret from service account on runtime cluster: %v", err)
6474
}

venonactl/pkg/store/store.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ func (s *Values) BuildValues() map[string]interface{} {
123123
"Key": "",
124124
"Ca": "",
125125
},
126+
"CreateRbac": true,
126127
"Storage": map[string]interface{}{
127128
"Backend": "local",
129+
"CreateStorageClass": true,
128130
"StorageClassName": fmt.Sprintf("dind-local-volumes-%s-%s", ApplicationName, s.KubernetesAPI.Namespace),
129131
"LocalVolumeParentDir": "/var/lib/codefresh/dind-volumes",
130132
"AvailabilityZone": "",
@@ -138,6 +140,7 @@ func (s *Values) BuildValues() map[string]interface{} {
138140
},
139141
},
140142
"Monitor": map[string]interface{}{
143+
"Enabled": true,
141144
"UseNamespaceWithRole": s.UseNamespaceWithRole,
142145
//TODO: need verify it on cluster level
143146
"RbacEnabled": true,

venonactl/pkg/templates/kubernetes/cluster-role-binding.dind-volume-provisioner.vp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .CreateRbac }}
12
---
23
kind: ClusterRoleBinding
34
apiVersion: rbac.authorization.k8s.io/v1beta1
@@ -13,3 +14,4 @@ roleRef:
1314
kind: ClusterRole
1415
name: volume-provisioner-{{ .AppName }}-{{ .Namespace }}
1516
apiGroup: rbac.authorization.k8s.io
17+
{{- end }}

venonactl/pkg/templates/kubernetes/cluster-role-binding.engine.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

venonactl/pkg/templates/kubernetes/cluster-role-binding.venona.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .CreateRbac }}
12
kind: ClusterRoleBinding
23
apiVersion: rbac.authorization.k8s.io/v1beta1
34
metadata:
@@ -9,4 +10,5 @@ subjects:
910
roleRef:
1011
kind: ClusterRole
1112
name: system:discovery
12-
apiGroup: rbac.authorization.k8s.io
13+
apiGroup: rbac.authorization.k8s.io
14+
{{- end }}

venonactl/pkg/templates/kubernetes/cluster-role.dind-volume-provisioner.vp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .CreateRbac }}
12
kind: ClusterRole
23
apiVersion: rbac.authorization.k8s.io/v1beta1
34
metadata:
@@ -29,3 +30,4 @@ rules:
2930
- apiGroups: [""]
3031
resources: ["endpoints"]
3132
verbs: ["get", "list", "watch", "create", "update", "delete"]
33+
{{- end }}

0 commit comments

Comments
 (0)