Skip to content

Commit 946a4fb

Browse files
committed
address comments
1 parent 8293379 commit 946a4fb

8 files changed

Lines changed: 48 additions & 50 deletions

File tree

docs/cmd/tkn_clustertask_start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ For passing the workspaces via flags:
4040
requests:
4141
storage: 1Gi
4242
- In case of binding a CSI workspace, you can pass it like -w name=my-csi,csiFile=csi.yaml
43-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
43+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
4444

4545
driver: secrets-store.csi.k8s.io
4646
readOnly: true

docs/cmd/tkn_task_start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ For passing the workspaces via flags:
3939
requests:
4040
storage: 1Gi
4141
- In case of binding a CSI workspace, you can pass it like -w name=my-csi,csiFile=csi.yaml
42-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
42+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
4343

4444
driver: secrets-store.csi.k8s.io
4545
readOnly: true

docs/man/man1/tkn-clustertask-start.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ storage: 1Gi
159159
.RE
160160
.IP \(bu 2
161161
In case of binding a CSI workspace, you can pass it like \-w name=my\-csi,csiFile=csi.yaml
162-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
162+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
163163

164164
.br
165165

docs/man/man1/tkn-task-start.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ storage: 1Gi
159159
.RE
160160
.IP \(bu 2
161161
In case of binding a CSI workspace, you can pass it like \-w name=my\-csi,csiFile=csi.yaml
162-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
162+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
163163

164164
.br
165165

pkg/cmd/clustertask/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ For passing the workspaces via flags:
141141
requests:
142142
storage: 1Gi
143143
- In case of binding a CSI workspace, you can pass it like -w name=my-csi,csiFile=csi.yaml
144-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
144+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
145145
146146
driver: secrets-store.csi.k8s.io
147147
readOnly: true

pkg/cmd/pipeline/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ For passing the workspaces via flags:
136136
requests:
137137
storage: 1Gi
138138
- In case of binding a CSI workspace, you can pass it like -w name=my-csi,csiFile=csi.yaml
139-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
139+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
140140
141141
driver: secrets-store.csi.k8s.io
142142
readOnly: true

pkg/cmd/task/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ For passing the workspaces via flags:
149149
requests:
150150
storage: 1Gi
151151
- In case of binding a CSI workspace, you can pass it like -w name=my-csi,csiFile=csi.yaml
152-
but before you need to create a csi.yaml file. Sample contents of the file are as follows:
152+
but you need to create a csi.yaml file before hand. Sample contents of the file are as follows:
153153
154154
driver: secrets-store.csi.k8s.io
155155
readOnly: true

pkg/workspaces/workspaces.go

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -89,56 +89,54 @@ func parseWorkspace(w []string, httpClient http.Client) (map[string]v1beta1.Work
8989
return nil, err
9090
}
9191

92-
// check for volumeClaimTemplate
93-
vctFile, err := getPar(r, volumeClaimTemplateFile)
94-
if err != nil {
95-
csiFile, err := getPar(r, csiFile)
92+
if vctFile, err := getPar(r, volumeClaimTemplateFile); err == nil {
93+
err = setWorkspaceVCTemplate(r, &wB, vctFile, httpClient)
9694
if err != nil {
97-
err = setWorkspaceConfig(r, &wB)
98-
if err == nil {
99-
ws[name] = wB
100-
nWB++
101-
} else if err != errNotFoundParam {
102-
return nil, err
103-
}
104-
105-
err = setWorkspaceSecret(r, &wB)
106-
if err == nil {
107-
ws[name] = wB
108-
nWB++
109-
} else if err != errNotFoundParam {
110-
return nil, err
111-
}
112-
113-
err = setWorkspaceEmptyDir(r, &wB)
114-
if err == nil {
115-
ws[name] = wB
116-
nWB++
117-
}
118-
119-
err = setWorkspacePVC(r, &wB)
120-
if err == nil {
121-
ws[name] = wB
122-
nWB++
123-
}
124-
125-
if nWB != 1 {
126-
return nil, errors.New(invalidWorkspace + v)
127-
}
128-
} else {
129-
err = setWorkspaceCSITemplate(r, &wB, csiFile, httpClient)
130-
if err != nil {
131-
return nil, err
132-
}
133-
ws[name] = wB
95+
return nil, err
13496
}
135-
} else {
136-
err = setWorkspaceVCTemplate(r, &wB, vctFile, httpClient)
97+
ws[name] = wB
98+
continue
99+
}
100+
101+
if csiFile, err := getPar(r, csiFile); err == nil {
102+
err = setWorkspaceCSITemplate(r, &wB, csiFile, httpClient)
137103
if err != nil {
138104
return nil, err
139105
}
140106
ws[name] = wB
107+
continue
108+
}
109+
110+
err = setWorkspaceConfig(r, &wB)
111+
if err == nil {
112+
ws[name] = wB
113+
nWB++
114+
} else if err != errNotFoundParam {
115+
return nil, err
116+
}
117+
118+
err = setWorkspaceSecret(r, &wB)
119+
if err == nil {
120+
ws[name] = wB
121+
nWB++
122+
} else if err != errNotFoundParam {
123+
return nil, err
141124
}
125+
126+
if err = setWorkspaceEmptyDir(r, &wB); err == nil {
127+
ws[name] = wB
128+
nWB++
129+
}
130+
131+
if err = setWorkspacePVC(r, &wB); err == nil {
132+
ws[name] = wB
133+
nWB++
134+
}
135+
136+
if nWB != 1 {
137+
return nil, errors.New(invalidWorkspace + v)
138+
}
139+
142140
}
143141

144142
return ws, nil

0 commit comments

Comments
 (0)