| ... | ... |
@@ -1,10 +1,7 @@ |
| 1 | 1 |
package test |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "speter.net/go/exp/math/dec/inf" |
|
| 5 |
- |
|
| 6 | 4 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 7 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" |
|
| 8 | 5 |
|
| 9 | 6 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| 10 | 7 |
) |
| ... | ... |
@@ -59,10 +56,8 @@ func OkPodTemplate() *kapi.PodTemplateSpec {
|
| 59 | 59 |
Spec: kapi.PodSpec{
|
| 60 | 60 |
Containers: []kapi.Container{
|
| 61 | 61 |
{
|
| 62 |
- Name: "container1", |
|
| 63 |
- Image: "registry:8080/repo1:ref1", |
|
| 64 |
- CPU: resource.Quantity{Amount: inf.NewDec(0, 3), Format: "DecimalSI"},
|
|
| 65 |
- Memory: resource.Quantity{Amount: inf.NewDec(0, 0), Format: "DecimalSI"},
|
|
| 62 |
+ Name: "container1", |
|
| 63 |
+ Image: "registry:8080/repo1:ref1", |
|
| 66 | 64 |
Env: []kapi.EnvVar{
|
| 67 | 65 |
{
|
| 68 | 66 |
Name: "ENV1", |
| ... | ... |
@@ -71,10 +66,8 @@ func OkPodTemplate() *kapi.PodTemplateSpec {
|
| 71 | 71 |
}, |
| 72 | 72 |
}, |
| 73 | 73 |
{
|
| 74 |
- Name: "container2", |
|
| 75 |
- Image: "registry:8080/repo1:ref2", |
|
| 76 |
- CPU: resource.Quantity{Amount: inf.NewDec(0, 3), Format: "DecimalSI"},
|
|
| 77 |
- Memory: resource.Quantity{Amount: inf.NewDec(0, 0), Format: "DecimalSI"},
|
|
| 74 |
+ Name: "container2", |
|
| 75 |
+ Image: "registry:8080/repo1:ref2", |
|
| 78 | 76 |
}, |
| 79 | 77 |
}, |
| 80 | 78 |
}, |
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
package controller |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 5 |
+ |
|
| 4 | 6 |
"github.com/golang/glog" |
| 5 | 7 |
|
| 6 | 8 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| ... | ... |
@@ -184,6 +186,7 @@ func (dc *DeploymentController) makeDeploymentPod(deployment *kapi.ReplicationCo |
| 184 | 184 |
|
| 185 | 185 |
pod := &kapi.Pod{
|
| 186 | 186 |
ObjectMeta: kapi.ObjectMeta{
|
| 187 |
+ GenerateName: fmt.Sprintf("deploy-%s-", deployment.Name),
|
|
| 187 | 188 |
Annotations: map[string]string{
|
| 188 | 189 |
deployapi.DeploymentAnnotation: deployment.Name, |
| 189 | 190 |
}, |
| ... | ... |
@@ -4,11 +4,8 @@ import ( |
| 4 | 4 |
"strings" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- "speter.net/go/exp/math/dec/inf" |
|
| 8 |
- |
|
| 9 | 7 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 10 | 8 |
kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 11 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" |
|
| 12 | 9 |
|
| 13 | 10 |
api "github.com/openshift/origin/pkg/api/latest" |
| 14 | 11 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -278,16 +275,12 @@ func basicPodTemplate() *kapi.PodTemplateSpec {
|
| 278 | 278 |
Spec: kapi.PodSpec{
|
| 279 | 279 |
Containers: []kapi.Container{
|
| 280 | 280 |
{
|
| 281 |
- Name: "container1", |
|
| 282 |
- Image: "registry:8080/repo1:ref1", |
|
| 283 |
- CPU: resource.Quantity{Amount: inf.NewDec(0, 3), Format: "DecimalSI"},
|
|
| 284 |
- Memory: resource.Quantity{Amount: inf.NewDec(0, 0), Format: "DecimalSI"},
|
|
| 281 |
+ Name: "container1", |
|
| 282 |
+ Image: "registry:8080/repo1:ref1", |
|
| 285 | 283 |
}, |
| 286 | 284 |
{
|
| 287 |
- Name: "container2", |
|
| 288 |
- Image: "registry:8080/repo1:ref2", |
|
| 289 |
- CPU: resource.Quantity{Amount: inf.NewDec(0, 3), Format: "DecimalSI"},
|
|
| 290 |
- Memory: resource.Quantity{Amount: inf.NewDec(0, 0), Format: "DecimalSI"},
|
|
| 285 |
+ Name: "container2", |
|
| 286 |
+ Image: "registry:8080/repo1:ref2", |
|
| 291 | 287 |
}, |
| 292 | 288 |
}, |
| 293 | 289 |
}, |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"github.com/golang/glog" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 12 |
- "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" |
|
| 12 |
+ // "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" |
|
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 14 | 14 |
|
| 15 | 15 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -24,10 +24,10 @@ func LatestDeploymentNameForConfig(config *deployapi.DeploymentConfig) string {
|
| 24 | 24 |
// TODO: Resources are currently ignored due to the formats not surviving encoding/decoding |
| 25 | 25 |
// in a consistent manner (e.g. 0 is represented sometimes as 0.000) |
| 26 | 26 |
func HashPodSpec(t api.PodSpec) uint64 {
|
| 27 |
- for i := range t.Containers {
|
|
| 27 |
+ /*for i := range t.Containers {
|
|
| 28 | 28 |
t.Containers[i].CPU = resource.Quantity{}
|
| 29 | 29 |
t.Containers[i].Memory = resource.Quantity{}
|
| 30 |
- } |
|
| 30 |
+ }*/ |
|
| 31 | 31 |
|
| 32 | 32 |
jsonString, err := json.Marshal(t) |
| 33 | 33 |
if err != nil {
|
| ... | ... |
@@ -129,5 +129,5 @@ func ExampleProcessTemplateParameters() {
|
| 129 | 129 |
} |
| 130 | 130 |
// Output: |
| 131 | 131 |
//<nil> |
| 132 |
- //{"kind":"Config","apiVersion":"v1beta1","metadata":{"creationTimestamp":null},"items":[{"kind":"Route","apiVersion":"v1beta1","metadata":{"creationTimestamp":null},"host":"guestbook.example.com","serviceName":"frontend-service"},{"kind":"Service","id":"frontend-service","creationTimestamp":null,"apiVersion":"v1beta1","port":5432,"selector":{"name":"guestbook"},"containerPort":0},{"kind":"Service","id":"redis-master","creationTimestamp":null,"apiVersion":"v1beta1","port":10000,"selector":{"name":"redis-master"},"containerPort":0},{"kind":"Service","id":"redis-slave","creationTimestamp":null,"apiVersion":"v1beta1","port":10001,"selector":{"name":"redis-slave"},"containerPort":0},{"kind":"Pod","id":"redis-master","creationTimestamp":null,"apiVersion":"v1beta1","labels":{"name":"redis-master"},"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"master","image":"dockerfile/redis","ports":[{"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"currentState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}},{"kind":"ReplicationController","id":"guestbook","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":3,"replicaSelector":{"name":"frontend-service"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"php-redis","image":"brendanburns/php-redis","ports":[{"hostPort":8000,"containerPort":80}],"env":[{"name":"ADMIN_USERNAME","key":"ADMIN_USERNAME","value":"adminQ3H"},{"name":"ADMIN_PASSWORD","key":"ADMIN_PASSWORD","value":"dwNJiJwW"},{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"labels":{"name":"frontend-service"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}}},{"kind":"ReplicationController","id":"redis-slave","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":2,"replicaSelector":{"name":"redis-slave"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"slave","image":"brendanburns/redis-slave","ports":[{"hostPort":6380,"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"labels":{"name":"redis-slave"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}}}]}
|
|
| 132 |
+ //{"kind":"Config","apiVersion":"v1beta1","metadata":{"creationTimestamp":null},"items":[{"kind":"Route","apiVersion":"v1beta1","metadata":{"creationTimestamp":null},"host":"guestbook.example.com","serviceName":"frontend-service"},{"kind":"Service","id":"frontend-service","creationTimestamp":null,"apiVersion":"v1beta1","port":5432,"selector":{"name":"guestbook"},"containerPort":0},{"kind":"Service","id":"redis-master","creationTimestamp":null,"apiVersion":"v1beta1","port":10000,"selector":{"name":"redis-master"},"containerPort":0},{"kind":"Service","id":"redis-slave","creationTimestamp":null,"apiVersion":"v1beta1","port":10001,"selector":{"name":"redis-slave"},"containerPort":0},{"kind":"Pod","id":"redis-master","creationTimestamp":null,"apiVersion":"v1beta1","labels":{"name":"redis-master"},"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"master","image":"dockerfile/redis","ports":[{"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"resources":{},"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"currentState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}},{"kind":"ReplicationController","id":"guestbook","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":3,"replicaSelector":{"name":"frontend-service"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"php-redis","image":"brendanburns/php-redis","ports":[{"hostPort":8000,"containerPort":80}],"env":[{"name":"ADMIN_USERNAME","key":"ADMIN_USERNAME","value":"adminQ3H"},{"name":"ADMIN_PASSWORD","key":"ADMIN_PASSWORD","value":"dwNJiJwW"},{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"resources":{},"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"labels":{"name":"frontend-service"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}}},{"kind":"ReplicationController","id":"redis-slave","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":2,"replicaSelector":{"name":"redis-slave"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta2","id":"","volumes":null,"containers":[{"name":"slave","image":"brendanburns/redis-slave","ports":[{"hostPort":6380,"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"resources":{},"imagePullPolicy":"","capabilities":{}}],"restartPolicy":{}}},"labels":{"name":"redis-slave"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}}}]}
|
|
| 133 | 133 |
} |