Skip to content

Commit

Permalink
Exclude build number for OCI image tag;
Browse files Browse the repository at this point in the history
  • Loading branch information
ycliuhw committed Jan 9, 2020
1 parent ebec0b0 commit 0761898
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/juju/juju/state/watcher"
"github.com/juju/juju/storage"
"github.com/juju/juju/storage/poolmanager"
"github.com/juju/juju/version"
)

type API struct {
Expand Down Expand Up @@ -114,7 +113,7 @@ func (a *API) OperatorProvisioningInfo() (params.OperatorProvisioningInfo, error
)
}

imagePath := podcfg.GetJujuOCIImagePath(cfg, vers.ToPatch(), version.OfficialBuild)
imagePath := podcfg.GetJujuOCIImagePath(cfg, vers.ToPatch(), 0)
storageClassName, _ := modelConfig.AllAttrs()[provider.OperatorStorageKey].(string)
if storageClassName == "" {
return params.OperatorProvisioningInfo{}, errors.New("no operator storage class defined")
Expand Down
Expand Up @@ -133,7 +133,7 @@ func (s *CAASProvisionerSuite) TestOperatorProvisioningInfoDefault(c *gc.C) {
result, err := s.api.OperatorProvisioningInfo()
c.Assert(err, jc.ErrorIsNil)
c.Assert(result, jc.DeepEquals, params.OperatorProvisioningInfo{
ImagePath: "jujusolutions/jujud-operator:2.6-beta3.666",
ImagePath: "jujusolutions/jujud-operator:2.6-beta3",
Version: version.MustParse("2.6-beta3"),
APIAddresses: []string{"10.0.0.1:1"},
Tags: map[string]string{
Expand All @@ -159,7 +159,7 @@ func (s *CAASProvisionerSuite) TestOperatorProvisioningInfo(c *gc.C) {
result, err := s.api.OperatorProvisioningInfo()
c.Assert(err, jc.ErrorIsNil)
c.Assert(result, jc.DeepEquals, params.OperatorProvisioningInfo{
ImagePath: s.st.operatorRepo + "/jujud-operator:" + "2.6-beta3.666",
ImagePath: s.st.operatorRepo + "/jujud-operator:" + "2.6-beta3",
Version: version.MustParse("2.6-beta3"),
APIAddresses: []string{"10.0.0.1:1"},
Tags: map[string]string{
Expand All @@ -186,7 +186,7 @@ func (s *CAASProvisionerSuite) TestOperatorProvisioningInfoNoStoragePool(c *gc.C
result, err := s.api.OperatorProvisioningInfo()
c.Assert(err, jc.ErrorIsNil)
c.Assert(result, jc.DeepEquals, params.OperatorProvisioningInfo{
ImagePath: s.st.operatorRepo + "/jujud-operator:" + "2.6-beta3.666",
ImagePath: s.st.operatorRepo + "/jujud-operator:" + "2.6-beta3",
Version: version.MustParse("2.6-beta3"),
APIAddresses: []string{"10.0.0.1:1"},
Tags: map[string]string{
Expand Down
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/juju/juju/state/watcher"
"github.com/juju/juju/storage"
"github.com/juju/juju/storage/poolmanager"
"github.com/juju/juju/version"
)

var logger = loggo.GetLogger("juju.apiserver.controller.caasunitprovisioner")
Expand Down Expand Up @@ -277,7 +276,7 @@ func (f *Facade) provisioningInfo(model Model, tagString string) (*params.Kubern
fmt.Sprintf("agent version is missing in model config %q", modelConfig.Name()),
)
}
operatorImagePath := podcfg.GetJujuOCIImagePath(controllerCfg, vers.ToPatch(), version.OfficialBuild)
operatorImagePath := podcfg.GetJujuOCIImagePath(controllerCfg, vers.ToPatch(), 0)

filesystemParams, err := f.applicationFilesystemParams(app, controllerCfg, modelConfig)
if err != nil {
Expand Down
Expand Up @@ -202,7 +202,7 @@ func (s *CAASProvisionerSuite) TestProvisioningInfo(c *gc.C) {
DeploymentType: "stateful",
ServiceType: "loadbalancer",
},
OperatorImagePath: fmt.Sprintf("jujusolutions/jujud-operator:%s", jujuversion.Current.String()+".666"),
OperatorImagePath: fmt.Sprintf("jujusolutions/jujud-operator:%s", jujuversion.Current.String()),
Devices: []params.KubernetesDeviceParams{
{
Type: "nvidia.com/gpu",
Expand Down
2 changes: 1 addition & 1 deletion caas/kubernetes/provider/bootstrap_test.go
Expand Up @@ -560,7 +560,7 @@ func (s *bootstrapSuite) TestBootstrap(c *gc.C) {
{
Name: "api-server",
ImagePullPolicy: core.PullIfNotPresent,
Image: "jujusolutions/jujud-operator:" + jujuversion.Current.String() + ".666",
Image: "jujusolutions/jujud-operator:" + jujuversion.Current.String(),
Command: []string{
"/bin/sh",
},
Expand Down
2 changes: 1 addition & 1 deletion cloudconfig/podcfg/image.go
Expand Up @@ -20,7 +20,7 @@ const (

// GetControllerImagePath returns oci image path of jujud for a controller.
func (cfg *ControllerPodConfig) GetControllerImagePath() string {
return GetJujuOCIImagePath(cfg.Controller.Config, cfg.JujuVersion, cfg.OfficialBuild)
return GetJujuOCIImagePath(cfg.Controller.Config, cfg.JujuVersion, 0)
}

// GetJujuDbOCIImagePath returns the juju-db oci image path.
Expand Down
4 changes: 2 additions & 2 deletions cloudconfig/podcfg/podcfg_test.go
Expand Up @@ -66,7 +66,7 @@ func (*podcfgSuite) TestOperatorImagesDefaultRepo(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
podConfig.JujuVersion = version.MustParse("6.6.6")
podConfig.OfficialBuild = 666
c.Assert(podConfig.GetControllerImagePath(), gc.Equals, "jujusolutions/jujud-operator:6.6.6.666")
c.Assert(podConfig.GetControllerImagePath(), gc.Equals, "jujusolutions/jujud-operator:6.6.6")
c.Assert(podConfig.GetJujuDbOCIImagePath(), gc.Equals, "jujusolutions/juju-db:4.0")
}

Expand All @@ -82,7 +82,7 @@ func (*podcfgSuite) TestOperatorImagesCustomRepo(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
podConfig.JujuVersion = version.MustParse("6.6.6")
podConfig.OfficialBuild = 666
c.Assert(podConfig.GetControllerImagePath(), gc.Equals, "path/to/my/repo/jujud-operator:6.6.6.666")
c.Assert(podConfig.GetControllerImagePath(), gc.Equals, "path/to/my/repo/jujud-operator:6.6.6")
c.Assert(podConfig.GetJujuDbOCIImagePath(), gc.Equals, "path/to/my/repo/juju-db:4.0")
}

Expand Down

0 comments on commit 0761898

Please sign in to comment.