Skip to content

Commit 9b1607f

Browse files
author
kosta709
committed
dind-volumes pr
1 parent be4a5c9 commit 9b1607f

File tree

5 files changed

+78
-6
lines changed

5 files changed

+78
-6
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,31 @@ rules:
7373
* Bind your user with cluster-admin kubernetes clusterrole
7474
> `kubectl create clusterrolebinding NAME --clusterrole cluster-admin --user YOUR_USER`
7575

76+
#### Pipeline Storage with docker cache support
77+
78+
###### GKE LocalSSD
79+
**Prerequisite:** [GKE custer with local SSD](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/local-ssd)
80+
```
81+
venonactl install [options] --set-value=Storage.LocalVolumeParentDir=/mnt/disks/ssd0/codefresh-volumes \
82+
--build-node-selector=cloud.google.com/gke-local-ssd=true
83+
```
84+
85+
###### Using GKE Disks
86+
**Prerequisite:** dind-volume-provisioner should have permissions to create/delete/get of google disks
87+
There are 3 options:
88+
* run venona dind-volume-provisioniner on node with iam role which is allowed to create/delete/get of google disks
89+
* create Google Service Account with ComputeEngine.StorageAdmin, download its key and pass it to venona installed with `--set-file=Storage.GooogleServiceAccount=/path/to/google-service-account.json`
90+
* use [Google Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) to assign iam role to `volume-provisioner-venona` service account
91+
92+
**Note**: Builds will be running in single availability zone, so you must to specify AvailabilityZone params
93+
94+
```
95+
venonactl install [options] --set-value=Storage.Backend=gcedisk \
96+
--set-value=Storage.AvailabilityZone=us-central1-a \
97+
--build-node-selector=failure-domain.beta.kubernetes.io/zone=us-central1-a \
98+
[--set-file=Storage.GoogleServiceAccount=/path/to/google-service-account.json"]
99+
```
100+
76101
#### Kubernetes RBAC
77102
Installation of Venona on Kubernetes cluster installing 2 groups of objects,
78103
Each one has own RBAC needs and therefore, created roles(and cluster-roles)

venonactl/cmd/install.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ var installCmdOptions struct {
6262
buildAnnotations []string
6363
tolerations string
6464
templateValues []string
65+
templateFileValues []string
6566
}
6667

6768
// installCmd represents the install command
@@ -208,6 +209,16 @@ var installCmd = &cobra.Command{
208209
}
209210
}
210211

212+
for _, value := range installCmdOptions.templateFileValues {
213+
reader := func(rs []rune) (interface{}, error) {
214+
bytes, err := ioutil.ReadFile(string(rs))
215+
return string(bytes), err
216+
}
217+
if err := strvals.ParseIntoFile(value, base, reader); err != nil {
218+
dieOnError(fmt.Errorf("Cannot parse option --set-file %s", value))
219+
}
220+
}
221+
211222
values = mergeMaps(values, base)
212223

213224
for _, p := range builder.Get() {
@@ -264,6 +275,7 @@ func init() {
264275
installCmd.Flags().BoolVar(&installCmdOptions.kubernetesRunnerType, "kubernetes-runner-type", false, "Set the runner type to kubernetes (alpha feature)")
265276

266277
installCmd.Flags().StringArrayVar(&installCmdOptions.templateValues, "set-value", []string{}, "Set values for templates, example: --set-value LocalVolumesDir=/mnt/disks/ssd0/codefresh-volumes")
278+
installCmd.Flags().StringArrayVar(&installCmdOptions.templateFileValues, "set-file", []string{}, "Set values for templates from file, example: --set-value Storage.GoogleServiceAccount=/path/to/service-account.json")
267279

268280
}
269281

venonactl/pkg/store/store.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ func (s *Values) BuildValues() map[string]interface{} {
9595
"Name": "codefresh/venona",
9696
"Tag": s.Version.Latest.Version,
9797
},
98-
"VolumeProvisionerImage": map[string]string{
99-
"Name": "codefresh/dind-volume-provisioner",
100-
"Tag": "v20",
101-
},
10298
"Namespace": s.KubernetesAPI.Namespace,
10399
"NodeSelector": s.KubernetesAPI.NodeSelector,
104100
"Tolerations": s.KubernetesAPI.Tolerations,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,15 @@ spec:
4747
env:
4848
- name: PROVISIONER_NAME
4949
value: codefresh.io/dind-volume-provisioner-{{ .AppName }}-{{ .Namespace }}
50+
{{- if .Storage.GoogleServiceAccount }}
51+
- name: GOOGLE_APPLICATION_CREDENTIALS
52+
value: /etc/dind-volume-provisioner/credentials/google-service-account.json
53+
volumeMounts:
54+
- name: credentials
55+
readOnly: true
56+
mountPath: "/etc/dind-volume-provisioner/credentials"
57+
volumes:
58+
- name: credentials
59+
secret:
60+
secretName: dind-volume-provisioner-{{ .AppName }}
61+
{{- end }}

venonactl/pkg/templates/kubernetes/templates.go

Lines changed: 29 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)