Skip to content

Commit

Permalink
config: updates default image to cn-core image
Browse files Browse the repository at this point in the history
This commit
-updates the default image to cn-core image.
-updates images list to include cn-core images in the quay registry.
-adds an image alias for nautilus version.

Signed-off-by: Deepika Joshi <djoshi@redhat.com>
  • Loading branch information
Deepika Joshi committed Apr 18, 2019
1 parent e677d52 commit 07fa32e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
11 changes: 6 additions & 5 deletions cmd/config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const FLAVORS = "flavors"
const IMAGES = "images"

// DEFAULTIMAGE is the default image name to be used
const DEFAULTIMAGE = "ceph/daemon"
const DEFAULTIMAGE = "quay.io/ceph/cn-core"

// LATESTIMAGE is the prefix for the latest ceph images
const LATESTIMAGE = DEFAULTIMAGE + ":latest-"
// CEPH_DAEMON_LATESTIMAGE is the prefix for the latest ceph images built by ceph/daemon
const CEPH_DAEMON_LATESTIMAGE = "ceph/daemon:latest-"

// DEFAULTWORKDIRECTORY is the default work directory
const DEFAULTWORKDIRECTORY = "/usr/share/ceph-nano"
Expand Down Expand Up @@ -114,8 +114,9 @@ func setDefaultConfig() {
viper.SetDefault(IMAGES+".default.use_default", true) // All containers inherit from default
viper.SetDefault(IMAGES+".default.image_name", DEFAULTIMAGE)
// Setting up the aliases to be reported in 'image show-aliases' command
viper.SetDefault(IMAGES+".mimic.image_name", LATESTIMAGE+"mimic")
viper.SetDefault(IMAGES+".luminous.image_name", LATESTIMAGE+"luminous")
viper.SetDefault(IMAGES+".mimic.image_name", CEPH_DAEMON_LATESTIMAGE+"mimic")
viper.SetDefault(IMAGES+".luminous.image_name", CEPH_DAEMON_LATESTIMAGE+"luminous")
viper.SetDefault(IMAGES+".nautilus.image_name", DEFAULTIMAGE+":latest")
viper.SetDefault(IMAGES+".redhat.image_name", "registry.access.redhat.com/rhceph/rhceph-3-rhel7")

// Setting up the default update notification configuration
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestDefaultConfig(t *testing.T) {

// The default builtin should be kept too
imageName = "mimic"
assert.Equal(t, LATESTIMAGE+"mimic", getImageName())
assert.Equal(t, CEPH_DAEMON_LATESTIMAGE+"mimic", getImageName())

imageName = defaultImageName
assert.Equal(t, "", getUnderlyingStorage("default"))
Expand Down
1 change: 1 addition & 0 deletions cmd/image_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ func listImageTags(cmd *cobra.Command, args []string) {
} else {
listDockerRegistryImageTags()
}
listQuayRegistryImageTags()
}
22 changes: 22 additions & 0 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,3 +968,25 @@ func getCephNanoPath() string {
}
return cephNanoPath
}

func listQuayRegistryImageTags() {
url := "https://quay.io/api/v1/repository/ceph/cn-core/tag/"
output := curlURL(url)

parser, err := gojq.NewStringQuery(string(output))
if err != nil {
log.Fatal(err)
}

tags, err := parser.Query("tags")
if err != nil {
log.Fatal(err)
}

tagsList := tags.([]interface{})

// leave out the last tag as it does not correspond to an available build
tagsList = tagsList[:len(tagsList)-1]
parseArray(tagsList, "name", "quay.io/ceph/cn-core:")

}

0 comments on commit 07fa32e

Please sign in to comment.