Skip to content

Commit

Permalink
support upgrade for volume provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-codefresh committed Nov 5, 2019
1 parent 92ce18b commit 574fa52
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
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 574fa52

Please sign in to comment.