Skip to content

Commit 8d7a0da

Browse files
committed
Merge commit '871c10de7' into release-1.7
2 parents d951b13 + 871c10d commit 8d7a0da

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

protokube/cmd/protokube/main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func run() error {
101101
// Trick to avoid 'logging before flag.Parse' warning
102102
flag.CommandLine.Parse([]string{})
103103

104+
// optional flag to override the location of etcd. Utilized with cluster asset container registry.
105+
var etcdImageSource string
106+
flags.StringVar(&etcdImageSource, "etcd-image-source", etcdImageSource, "Etcd Source Container Registry")
107+
104108
flag.Set("logtostderr", "true")
105109

106110
flags.AddGoFlagSet(flag.CommandLine)
@@ -322,7 +326,8 @@ func run() error {
322326

323327
Channels: channels,
324328

325-
Kubernetes: protokube.NewKubernetesContext(),
329+
Kubernetes: protokube.NewKubernetesContext(),
330+
EtcdImageSource: etcdImageSource,
326331
}
327332
k.Init(volumes)
328333

protokube/pkg/protokube/etcd_cluster.go

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type EtcdCluster struct {
5454
Spec *EtcdClusterSpec
5555

5656
VolumeMountPath string
57+
ImageSource string
5758
}
5859

5960
func (e *EtcdCluster) String() string {
@@ -92,6 +93,7 @@ func newEtcdController(kubeBoot *KubeBoot, v *Volume, spec *EtcdClusterSpec) (*E
9293
cluster.CPURequest = resource.MustParse("100m")
9394
cluster.ClientPort = 4001
9495
cluster.PeerPort = 2380
96+
cluster.ImageSource = kubeBoot.EtcdImageSource
9597

9698
// We used to build this through text files ... it turns out to just be more complicated than code!
9799
switch spec.ClusterKey {

protokube/pkg/protokube/etcd_manifest.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,24 @@ func BuildEtcdManifest(c *EtcdCluster) *v1.Pod {
3535
"k8s-app": c.PodName,
3636
}
3737

38+
// TODO another hardcoded version
39+
image := "/etcd:2.2.1"
40+
imageRegistry := "gcr.io/google_containers"
41+
42+
// Test to determine if the container registry has been passed in as a flag.
43+
// If so use the provider registry location.
44+
if c.ImageSource == "" {
45+
image = imageRegistry + image
46+
} else {
47+
image = strings.TrimSuffix(c.ImageSource, "/") + image
48+
}
49+
3850
pod.Spec.HostNetwork = true
3951

4052
{
4153
container := v1.Container{
4254
Name: "etcd-container",
43-
Image: "gcr.io/google_containers/etcd:2.2.1",
55+
Image: image,
4456
Resources: v1.ResourceRequirements{
4557
Requests: v1.ResourceList{
4658
v1.ResourceCPU: c.CPURequest,

protokube/pkg/protokube/kube_boot.go

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ type KubeBoot struct {
5050
Channels []string
5151

5252
Kubernetes *KubernetesContext
53+
54+
// Etcd container registry location.
55+
EtcdImageSource string
5356
}
5457

5558
func (k *KubeBoot) Init(volumesProvider Volumes) {

0 commit comments

Comments
 (0)