diff --git a/update-demo/README.md b/update-demo/README.md index a07c341c..1b2e2ac8 100644 --- a/update-demo/README.md +++ b/update-demo/README.md @@ -42,7 +42,7 @@ Now visit the the [demo website](http://localhost:8001/static). You won't see a Now we will turn up two replicas of an image. They all serve on internal port 80. ```bash -$ ./cluster/kubectl.sh create -f examples/update-demo/v1beta1/nautilus-rc.yaml +$ ./cluster/kubectl.sh create -f examples/update-demo/nautilus-rc.yaml ``` After pulling the image from the Docker Hub to your worker nodes (which may take a minute or so) you'll see a couple of squares in the UI detailing the pods that are running along with the image that they are serving up. A cute little nautilus. @@ -61,7 +61,7 @@ If you go back to the [demo website](http://localhost:8001/static/index.html) yo We will now update the docker image to serve a different image by doing a rolling update to a new Docker image. ```bash -$ ./cluster/kubectl.sh rolling-update update-demo-nautilus --update-period=10s -f examples/update-demo/v1beta1/kitten-rc.yaml +$ ./cluster/kubectl.sh rolling-update update-demo-nautilus --update-period=10s -f examples/update-demo/kitten-rc.yaml ``` The rolling-update command in kubectl will do 2 things: @@ -106,7 +106,7 @@ $ export DOCKER_HUB_USER=my-docker-id $ ./examples/update-demo/build-images.sh ``` -To use your custom docker image in the above examples, you will need to change the image name in `examples/update-demo/v1beta1/nautilus-rc.yaml` and `examples/update-demo/v1beta1/kitten-rc.yaml`. +To use your custom docker image in the above examples, you will need to change the image name in `examples/update-demo/nautilus-rc.yaml` and `examples/update-demo/kitten-rc.yaml`. ### Image Copyright diff --git a/update-demo/v1beta3/kitten-rc.yaml b/update-demo/kitten-rc.yaml similarity index 100% rename from update-demo/v1beta3/kitten-rc.yaml rename to update-demo/kitten-rc.yaml diff --git a/update-demo/local/index.html b/update-demo/local/index.html index f3a69e79..22a48591 100644 --- a/update-demo/local/index.html +++ b/update-demo/local/index.html @@ -22,9 +22,9 @@ limitations under the License.
- - ID: {{server.podId}}
- Host: {{server.host}}
+ + ID: {{server.podName}}
+ Host: {{server.host}}
Status: {{server.status}}
Image: {{server.dockerImage}}
Labels: diff --git a/update-demo/local/script.js b/update-demo/local/script.js index 23b7a06f..cf0fb3dd 100644 --- a/update-demo/local/script.js +++ b/update-demo/local/script.js @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -var base = "http://localhost:8001/api/v1beta1/"; +var base = "http://localhost:8001/api/v1beta3/"; var updateImage = function($http, server) { - $http.get(base + "proxy/pods/" + server.podId + "/data.json") + $http.get(base + "proxy/namespaces/default/pods/" + server.podName + "/data.json") .success(function(data) { console.log(data); server.image = data.image; @@ -29,13 +29,13 @@ var updateImage = function($http, server) { }; var updateServer = function($http, server) { - $http.get(base + "pods/" + server.podId) + $http.get(base + "namespaces/default/pods/" + server.podName) .success(function(data) { console.log(data); - server.labels = data.labels; - server.host = data.currentState.host.split('.')[0]; - server.status = data.currentState.status; - server.dockerImage = data.currentState.info["update-demo"].image; + server.labels = data.metadata.labels; + server.host = data.spec.host.split('.')[0]; + server.status = data.status.phase; + server.dockerImage = data.status.containerStatuses[0].image; updateImage($http, server); }) .error(function(data) { @@ -57,10 +57,10 @@ var ButtonsCtrl = function ($scope, $http, $interval) { $interval(angular.bind({}, update, $scope, $http), 2000); }; -var getServer = function($scope, id) { +var getServer = function($scope, name) { var servers = $scope.servers; for (var i = 0; i < servers.length; ++i) { - if (servers[i].podId == id) { + if (servers[i].podName == name) { return servers[i]; } } @@ -68,7 +68,7 @@ var getServer = function($scope, id) { }; var isUpdateDemoPod = function(pod) { - return pod.labels && pod.labels.name == "update-demo"; + return pod.metadata && pod.metadata.labels && pod.metadata.labels.name == "update-demo"; }; var update = function($scope, $http) { @@ -76,7 +76,7 @@ var update = function($scope, $http) { console.log("No HTTP!"); return; } - $http.get(base + "pods") + $http.get(base + "namespaces/default/pods") .success(function(data) { console.log(data); var newServers = []; @@ -85,9 +85,9 @@ var update = function($scope, $http) { if (!isUpdateDemoPod(pod)) { continue; } - var server = getServer($scope, pod.id); + var server = getServer($scope, pod.metadata.name); if (server == null) { - server = { "podId": pod.id }; + server = { "podName": pod.metadata.name }; } newServers.push(server); } diff --git a/update-demo/v1beta3/nautilus-rc.yaml b/update-demo/nautilus-rc.yaml similarity index 100% rename from update-demo/v1beta3/nautilus-rc.yaml rename to update-demo/nautilus-rc.yaml diff --git a/update-demo/v1beta1/kitten-rc.yaml b/update-demo/v1beta1/kitten-rc.yaml deleted file mode 100644 index fe692652..00000000 --- a/update-demo/v1beta1/kitten-rc.yaml +++ /dev/null @@ -1,19 +0,0 @@ -kind: ReplicationController -id: update-demo-kitten -apiVersion: v1beta1 -desiredState: - replicaSelector: - name: update-demo - version: kitten - podTemplate: - desiredState: - manifest: - containers: - - name: update-demo - image: gcr.io/google_containers/update-demo:kitten - ports: - - containerPort: 80 - protocol: TCP - labels: - name: update-demo - version: kitten diff --git a/update-demo/v1beta1/nautilus-rc.yaml b/update-demo/v1beta1/nautilus-rc.yaml deleted file mode 100644 index 5218f62b..00000000 --- a/update-demo/v1beta1/nautilus-rc.yaml +++ /dev/null @@ -1,20 +0,0 @@ -kind: ReplicationController -id: update-demo-nautilus -apiVersion: v1beta1 -desiredState: - replicas: 2 - replicaSelector: - name: update-demo - version: nautilus - podTemplate: - desiredState: - manifest: - containers: - - name: update-demo - image: gcr.io/google_containers/update-demo:nautilus - ports: - - containerPort: 80 - protocol: TCP - labels: - name: update-demo - version: nautilus