Skip to content

Commit

Permalink
Merge pull request #69 from codefresh-io/vp_upgrade
Browse files Browse the repository at this point in the history
support upgrade for volume provisioner
  • Loading branch information
oren-codefresh authored Nov 5, 2019
2 parents 92ce18b + 719fb15 commit 823e77e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "venona",
"version": "0.28.3",
"version": "0.28.4",
"description": "Codefresh agent to run on Codefresh's runtime environment and execute pipeline",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions venonactl/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ func parseNodeSelector(s string) (nodeSelector, error) {

func validateInstallOptions(opts* plugins.InstallOptions) (error) {
if len(opts.ClusterName) > clusterNameMaxLength {
return errors.New(fmt.Sprintf("cluster name lenght is limited to %d", clusterNameMaxLength))
return errors.New(fmt.Sprintf("cluster name length is limited to %d", clusterNameMaxLength))
}
if len(opts.ClusterNamespace) > namespaceMaxLength {
return errors.New(fmt.Sprintf("cluster namespace is limited to %d", namespaceMaxLength))
return errors.New(fmt.Sprintf("cluster namespace length is limited to %d", namespaceMaxLength))
}
return nil
}
Expand Down
21 changes: 20 additions & 1 deletion venonactl/pkg/plugins/volume-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"

"github.com/codefresh-io/venona/venonactl/pkg/logger"
"github.com/codefresh-io/venona/venonactl/pkg/obj/kubeobj"
templates "github.com/codefresh-io/venona/venonactl/pkg/templates/kubernetes"
)

Expand Down Expand Up @@ -86,6 +87,24 @@ func (u *volumeProvisionerPlugin) Delete(deleteOpt *DeleteOptions, v Values) err
return delete(opt)
}

func (u *volumeProvisionerPlugin) Upgrade(_ *UpgradeOptions, v Values) (Values, error) {
func (u *volumeProvisionerPlugin) Upgrade(opt *UpgradeOptions, v Values) (Values, error) {
var err error
kubeClientset, err := opt.KubeBuilder.BuildClient()
if err != nil {
u.logger.Error(fmt.Sprintf("Cannot create kubernetes clientset: %v ", err))
return nil, err
}
kubeObjects, err := getKubeObjectsFromTempalte(v, volumeProvisionerFilesPattern, u.logger)
if err != nil {
return nil, err
}
for _, local := range kubeObjects {

_, _, err := kubeobj.ReplaceObject(kubeClientset, local, opt.ClusterNamespace)
if err != nil {
return nil, err
}
}
return v, nil

}
2 changes: 1 addition & 1 deletion venonactl/pkg/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s *Values) BuildValues() map[string]interface{} {
},
"VolumeProvisionerImage": map[string]string{
"Name": "codefresh/dind-volume-provisioner",
"Tag": "v13",
"Tag": "v17",
},
"Namespace": s.KubernetesAPI.Namespace,
"NodeSelector": s.KubernetesAPI.NodeSelector,
Expand Down

0 comments on commit 823e77e

Please sign in to comment.