Skip to content

Commit b7a9d39

Browse files
authored
KO-345 more generically retag images for pushing, rename dse tags to cass (datastax#228)
* more generically retag images for pushing, so support the new init container; rename dse tags/binary to cass * rename operator image to datastax/cass-operator * rename init container image to cass-operator-init
1 parent 3bf820f commit b7a9d39

File tree

9 files changed

+88
-71
lines changed

9 files changed

+88
-71
lines changed

go.sum

+19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
2+
github.com/PuerkitoBio/purell v1.0.0 h1:0GoNN3taZV6QI81IXgCbxMyEaJDXMSIjArYBCYzVVvs=
23
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
4+
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2 h1:JCHLVE3B+kJde7bIEo5N4J+ZbLhp0J1Fs+ulyRws4gE=
35
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
46
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
68
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
79
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
810
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
911
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
12+
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
1013
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
1114
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1215
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
1316
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
1417
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
18+
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1 h1:wSt/4CYxs70xbATrGXhokKF1i0tZjENLOo1ioIO13zk=
1519
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
20+
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9 h1:tF+augKRWlWx0J0B7ZyyKSiTyV6E1zZe+7b3qQlcEf8=
1621
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
22+
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501 h1:C1JKChikHGpXwT5UQDFaryIpDtyyGL/CR6C2kB7F1oc=
1723
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
24+
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 h1:zP3nY8Tk2E6RTkqGYrarZXuzh+ffyLDljLxCy1iJw80=
1825
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
26+
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
1927
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
2028
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
2129
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -24,13 +32,15 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
2432
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
2533
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
2634
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
35+
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
2736
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
2837
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
2938
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
3039
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
3140
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
3241
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
3342
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
43+
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
3444
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
3545
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
3646
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@@ -41,11 +51,14 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
4151
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
4252
github.com/magefile/mage v1.9.0 h1:t3AU2wNwehMCW97vuqQLtw6puppWXHO+O2MHo5a50XE=
4353
github.com/magefile/mage v1.9.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
54+
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY=
4455
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
4556
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
57+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
4658
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
4759
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
4860
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
61+
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
4962
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
5063
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
5164
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
@@ -101,6 +114,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33
101114
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
102115
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
103116
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
117+
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
104118
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
105119
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
106120
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
@@ -111,12 +125,17 @@ gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
111125
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
112126
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
113127
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
128+
k8s.io/api v0.0.0-20191121015604-11707872ac1c h1:Z87my3sF4WhG0OMxzARkWY/IKBtOr+MhXZAb4ts6qFc=
114129
k8s.io/api v0.0.0-20191121015604-11707872ac1c/go.mod h1:R/s4gKT0V/cWEnbQa9taNRJNbWUK57/Dx6cPj6MD3A0=
115130
k8s.io/apimachinery v0.0.0-20191121015412-41065c7a8c2a/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
131+
k8s.io/apimachinery v0.0.0-20191123233150-4c4803ed55e3 h1:FErmbNIJruD5GT2oVEjtPn5Ar5+rcWJsC8/PPUkR0s4=
116132
k8s.io/apimachinery v0.0.0-20191123233150-4c4803ed55e3/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
117133
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
118134
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
135+
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
119136
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
137+
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU=
120138
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
121139
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
140+
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
122141
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

mage/kind/lib.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
)
1818

1919
const (
20-
operatorImage = "datastax/dse-operator:latest"
21-
operatorInitContainerImage = "datastax/cass-operator-initcontainer:latest"
20+
operatorImage = "datastax/cass-operator:latest"
21+
operatorInitContainerImage = "datastax/cass-operator-init:latest"
2222
envLoadDevImages = "M_LOAD_DEV_IMAGES"
2323
)
2424

@@ -92,12 +92,12 @@ func ReloadOperator() {
9292
for _, c := range containers {
9393
if strings.HasPrefix(c.Image, "kindest") {
9494
fmt.Printf("Deleting old operator image from Docker container: %s\n", c.Id)
95-
execArgs := []string{"crictl", "rmi", "docker.io/datastax/dse-operator:latest"}
95+
execArgs := []string{"crictl", "rmi", "docker.io/datastax/cass-operator:latest"}
9696
dockerutil.Exec(c.Id, nil, false, "", "", execArgs).ExecVPanic()
9797
}
9898
}
9999
fmt.Println("Loading new operator Docker image into KIND cluster")
100-
shutil.RunVPanic("kind", "load", "docker-image", "datastax/dse-operator:latest")
100+
shutil.RunVPanic("kind", "load", "docker-image", "datastax/cass-operator:latest")
101101
fmt.Println("Finished loading new operator image into Kind.")
102102
}
103103

mage/kubectl/lib.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package kubectl
33
import (
44
"fmt"
55
"os"
6-
"time"
76
"regexp"
7+
"time"
88

99
shutil "github.com/riptano/dse-operator/mage/sh"
1010
)
@@ -162,9 +162,13 @@ func PatchMerge(resource string, data string) KCmd {
162162
return KCmd{Command: "patch", Args: args}
163163
}
164164

165+
func PatchJson(resource string, data string) KCmd {
166+
args := []string{resource, "--patch", data, "--type", "json"}
167+
return KCmd{Command: "patch", Args: args}
168+
}
169+
165170
func waitForOutputPattern(k KCmd, pattern string, expected string, seconds int) error {
166171
re := regexp.MustCompile(pattern)
167-
168172
c := make(chan string)
169173
timer := time.NewTimer(time.Duration(seconds) * time.Second)
170174
cquit := make(chan bool)

mage/operator/deploy.go

+16-22
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"os"
66
"strings"
77

8-
"github.com/riptano/dse-operator/mage/docker"
9-
"github.com/riptano/dse-operator/mage/sh"
10-
"github.com/riptano/dse-operator/mage/util"
8+
dockerutil "github.com/riptano/dse-operator/mage/docker"
9+
shutil "github.com/riptano/dse-operator/mage/sh"
10+
mageutil "github.com/riptano/dse-operator/mage/util"
1111
)
1212

1313
const (
@@ -16,8 +16,8 @@ const (
1616
envEcrId = "MO_ECR_ID"
1717
envEcrSecret = "MO_ECR_SECRET"
1818
envTags = "MO_TAGS"
19-
artifactoryRepo = "datastax-docker.jfrog.io"
20-
ecrRepo = "237073351946.dkr.ecr.us-east-1.amazonaws.com"
19+
envArtRepo = "MO_ART_REPO"
20+
envEcrRepo = "MO_ECR_REPO"
2121
)
2222

2323
func dockerTag(src string, target string) {
@@ -27,26 +27,18 @@ func dockerTag(src string, target string) {
2727
dockerutil.Tag(src, target).ExecVPanic()
2828
}
2929

30-
func retagImage(currentTag string, newRepo string) string {
31-
newPath := fmt.Sprintf("%s/dse-operator/operator", newRepo)
32-
33-
// We just want to grab the version part of the tag and discard
34-
// the old repo path
35-
// For example:
36-
// datastax/dse-operator:someversion
37-
// ^ only keep 'someversion'
38-
// so that we can put a new repo path in front of it
39-
split := strings.Split(currentTag, ":")
40-
versionTag := split[len(split)-1]
41-
42-
newImage := fmt.Sprintf("%s:%s", newPath, versionTag)
43-
dockerTag(currentTag, newImage)
44-
return newImage
30+
// This function is meant to simply retag a
31+
// locally built image by adding a remote url
32+
// to the front of it.
33+
func retagLocalImageForRemotePush(localTag string, remoteUrl string) string {
34+
newTag := fmt.Sprintf("%s/%s", remoteUrl, localTag)
35+
dockerTag(localTag, newTag)
36+
return newTag
4537
}
4638

47-
func retagAndPush(tags []string, newRepo string) {
39+
func retagAndPush(tags []string, remoteUrl string) {
4840
for _, t := range tags {
49-
newTag := retagImage(strings.TrimSpace(t), newRepo)
41+
newTag := retagLocalImageForRemotePush(strings.TrimSpace(t), remoteUrl)
5042
fmt.Printf("- Pushing image %s\n", newTag)
5143
dockerutil.Push(newTag).WithCfg(rootBuildDir).ExecVPanic()
5244
}
@@ -77,6 +69,7 @@ func awsDockerLogin(keyId string, keySecret string) {
7769
// MO_ECR_SECRET - ECR secret access key
7870
// MO_TAGS - pipe-delimited docker tags to retag/push to ECR
7971
func DeployToECR() {
72+
ecrRepo := mageutil.RequireEnv(envEcrRepo)
8073
keyId := mageutil.RequireEnv(envEcrId)
8174
keySecret := mageutil.RequireEnv(envEcrSecret)
8275
awsDockerLogin(keyId, keySecret)
@@ -95,6 +88,7 @@ func DeployToECR() {
9588
// MO_ART_PSW - artifactory password/api key
9689
// MO_TAGS - pipe-delimited docker tags to retag/push to Artifactory
9790
func DeployToArtifactory() {
91+
artifactoryRepo := mageutil.RequireEnv(envArtRepo)
9892
user := mageutil.RequireEnv(envArtifactoryUser)
9993
pw := mageutil.RequireEnv(envArtifactoryPw)
10094
dockerutil.Login(rootBuildDir, user, pw, artifactoryRepo).

mage/operator/lib.go

+20-16
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"strings"
1212

1313
"github.com/magefile/mage/mg"
14-
"github.com/riptano/dse-operator/mage/config"
15-
"github.com/riptano/dse-operator/mage/docker"
16-
"github.com/riptano/dse-operator/mage/git"
17-
"github.com/riptano/dse-operator/mage/sh"
18-
"github.com/riptano/dse-operator/mage/util"
14+
cfgutil "github.com/riptano/dse-operator/mage/config"
15+
dockerutil "github.com/riptano/dse-operator/mage/docker"
16+
gitutil "github.com/riptano/dse-operator/mage/git"
17+
shutil "github.com/riptano/dse-operator/mage/sh"
18+
mageutil "github.com/riptano/dse-operator/mage/util"
1919
"gopkg.in/yaml.v2"
2020
)
2121

@@ -330,25 +330,28 @@ func calcFullVersion(settings cfgutil.BuildSettings, git GitData) FullVersion {
330330
}
331331
}
332332

333-
func runInitContainerDockerBuild(version FullVersion) {
333+
func runInitContainerDockerBuild(version FullVersion) []string {
334334
fmt.Println("- Building operator init container docker image")
335-
versionedTag := fmt.Sprintf("datastax/cass-operator-initcontainer:%v", version)
335+
repoPath := "datastax/cass-operator-init"
336+
versionedTag := fmt.Sprintf("%s:%v", repoPath, version)
336337
tagsToPush := []string{
337338
versionedTag,
338-
fmt.Sprintf("datastax/cass-operator-initcontainer:%s", version.Hash),
339+
fmt.Sprintf("%s:%s", repoPath, version.Hash),
339340
}
340-
tags := append(tagsToPush, "datastax/cass-operator-initcontainer:latest")
341+
tags := append(tagsToPush, fmt.Sprintf("%s:latest", repoPath))
341342
buildArgs := []string{fmt.Sprintf("VERSION_STAMP=%s", versionedTag)}
342343
dockerutil.Build("./tools/initcontainer", "", "", tags, buildArgs).ExecVPanic()
344+
return tagsToPush
343345
}
344346

345347
func runDockerBuild(version FullVersion) []string {
346-
versionedTag := fmt.Sprintf("datastax/dse-operator:%v", version)
348+
repoPath := "datastax/cass-operator"
349+
versionedTag := fmt.Sprintf("%s:%v", repoPath, version)
347350
tagsToPush := []string{
348351
versionedTag,
349-
fmt.Sprintf("datastax/dse-operator:%s", version.Hash),
352+
fmt.Sprintf("%s:%s", repoPath, version.Hash),
350353
}
351-
tags := append(tagsToPush, "datastax/dse-operator:latest")
354+
tags := append(tagsToPush, fmt.Sprintf("%s:latest", repoPath))
352355
buildArgs := []string{fmt.Sprintf("VERSION_STAMP=%s", versionedTag)}
353356
dockerutil.Build(".", "", "./operator/Dockerfile", tags, buildArgs).ExecVPanic()
354357
return tagsToPush
@@ -357,7 +360,7 @@ func runDockerBuild(version FullVersion) []string {
357360
func runGoBuild(version string) {
358361
os.Chdir("./operator")
359362
os.Setenv("CGO_ENABLED", "0")
360-
binaryPath := fmt.Sprintf("../build/bin/dse-operator-%s-%s", runtime.GOOS, runtime.GOARCH)
363+
binaryPath := fmt.Sprintf("../build/bin/cass-operator-%s-%s", runtime.GOOS, runtime.GOARCH)
361364
goArgs := []string{
362365
"build", "-o", binaryPath,
363366
"-ldflags", fmt.Sprintf("-X main.version=%s", version),
@@ -415,13 +418,14 @@ func BuildDocker() {
415418
settings := cfgutil.ReadBuildSettings()
416419
git := getGitData()
417420
version := calcFullVersion(settings, git)
418-
runInitContainerDockerBuild(version)
419-
tags := runDockerBuild(version)
421+
initTags := runInitContainerDockerBuild(version)
422+
operatorTags := runDockerBuild(version)
420423
// Write the versioned image tags to a file in our build
421424
// directory so that other targets in the build process can identify
422425
// what was built. This is particularly important to know
423426
// for targets that retag and deploy to external docker repositories
424-
outputText := strings.Join(tags, "|")
427+
tagsToPush := append(operatorTags, initTags...)
428+
outputText := strings.Join(tagsToPush, "|")
425429
writeBuildFile("tagsToPush.txt", outputText)
426430
}
427431

operator/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ENV GOARCH amd64
1616
ENV GOPATH=/go
1717

1818

19-
WORKDIR /dse-operator
19+
WORKDIR /cass-operator
2020

2121
# Grab mage files
2222
COPY go.mod go.sum ./
@@ -59,6 +59,6 @@ ENV GOPATH=/go
5959
WORKDIR /go
6060

6161
# All we need from the builder image is operator executable
62-
COPY --from=builder /dse-operator/build/bin/dse-operator-linux-amd64 bin/operator
62+
COPY --from=builder /cass-operator/build/bin/cass-operator-linux-amd64 bin/operator
6363

6464
CMD [ "/go/bin/operator" ]

operator/deploy/operator.yaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,16 @@ spec:
1717
- name: cass-operator-certs-volume
1818
emptyDir: {}
1919
# initContainers:
20-
# - name: cass-operator-initcontainer
21-
# image: datastax/cass-operator-initcontainer:latest
20+
# - name: cass-operator-init
21+
# image: datastax/cass-operator-init:latest
2222
# imagePullPolicy: IfNotPresent
2323
# volumeMounts:
2424
# - mountPath: /tmp/k8s-webhook-server/serving-certs
2525
# name: cass-operator-certs-volume
2626
containers:
2727
- name: dse-operator
28-
# Replace this with the built image name
29-
# echo "datastax-docker.jfrog.io/dse-operator/operator:$(git symbolic-ref --short HEAD).$(git rev-parse HEAD)"
30-
image: datastax/dse-operator:latest
28+
image: datastax/cass-operator:latest
3129
imagePullPolicy: IfNotPresent
32-
volumeMounts:
33-
- mountPath: /tmp/k8s-webhook-server/serving-certs
34-
name: cass-operator-certs-volume
3530
livenessProbe:
3631
exec:
3732
command:
@@ -41,6 +36,9 @@ spec:
4136
periodSeconds: 5
4237
timeoutSeconds: 5
4338
failureThreshold: 3
39+
volumeMounts:
40+
- mountPath: /tmp/k8s-webhook-server/serving-certs
41+
name: cass-operator-certs-volume
4442
readinessProbe:
4543
exec:
4644
command:

0 commit comments

Comments
 (0)