Skip to content

Commit a43bd33

Browse files
Merge pull request #65 from codefresh-io/issue_38
issue 38
2 parents dffebc1 + 3c1fef7 commit a43bd33

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "venona",
3-
"version": "0.28.1",
3+
"version": "0.28.2",
44
"description": "Codefresh agent to run on Codefresh's runtime environment and execute pipeline",
55
"main": "index.js",
66
"scripts": {

venonactl/cmd/install.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ import (
3030
"github.com/spf13/viper"
3131
)
3232

33+
const (
34+
clusterNameMaxLength = 20
35+
namespaceMaxLength = 20
36+
)
37+
3338
var installCmdOptions struct {
3439
dryRun bool
3540
clusterNameInCodefresh string
@@ -164,6 +169,11 @@ var installCmd = &cobra.Command{
164169
s.CodefreshAPI.BuildNodeSelector = bns
165170
builderInstallOpt.BuildNodeSelector = bns
166171

172+
err = validateInstallOptions(builderInstallOpt)
173+
if err != nil {
174+
dieOnError(err)
175+
}
176+
167177
values := s.BuildValues()
168178
for _, p := range builder.Get() {
169179
values, err = p.Install(builderInstallOpt, values)
@@ -213,6 +223,16 @@ func parseNodeSelector(s string) (nodeSelector, error) {
213223
return nodeSelector{v[0]: v[1]}, nil
214224
}
215225

226+
func validateInstallOptions(opts* plugins.InstallOptions) (error) {
227+
if len(opts.ClusterName) > clusterNameMaxLength {
228+
return errors.New(fmt.Sprintf("cluster name lenght is limited to %d", clusterNameMaxLength))
229+
}
230+
if len(opts.ClusterNamespace) > namespaceMaxLength {
231+
return errors.New(fmt.Sprintf("cluster namespace is limited to %d", namespaceMaxLength))
232+
}
233+
return nil
234+
}
235+
216236
// String returns a k8s compliant string representation of the nodeSelector. Only a single value is supported.
217237
func (ns nodeSelector) String() string {
218238
var s string

0 commit comments

Comments
 (0)