Skip to content

Commit

Permalink
Updating scripts to use v1 instead of v1beta3
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiljindal committed Jul 1, 2015
1 parent 09df440 commit 2e9e46d
Show file tree
Hide file tree
Showing 26 changed files with 53 additions and 79 deletions.
2 changes: 1 addition & 1 deletion cluster/juju/charms/trusty/kubernetes/hooks/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def register_machine(apiserver, retry=False):

response, result = registration_request.register(parsed.hostname,
parsed.port,
'/api/v1beta3/nodes')
'/api/v1/nodes')

print(response)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ def test_data_type(self):
@patch('json.loads')
@patch('httplib.HTTPConnection')
def test_register(self, httplibmock, jsonmock):
result = self.r.register('foo', 80, '/v1beta3/test')
result = self.r.register('foo', 80, '/v1/test')

httplibmock.assert_called_with('foo', 80)
requestmock = httplibmock().request
requestmock.assert_called_with(
"POST", "/v1beta3/test",
"POST", "/v1/test",
json.dumps(self.r.data),
{"Content-type": "application/json",
"Accept": "application/json"})


def test_command_succeeded(self):
response = MagicMock()
result = json.loads('{"status": "Failure", "kind": "Status", "code": 409, "apiVersion": "v1beta2", "reason": "AlreadyExists", "details": {"kind": "minion", "id": "10.200.147.200"}, "message": "minion \\"10.200.147.200\\" already exists", "creationTimestamp": null}')
result = json.loads('{"status": "Failure", "kind": "Status", "code": 409, "apiVersion": "v1", "reason": "AlreadyExists", "details": {"kind": "node", "name": "10.200.147.200"}, "message": "node \\"10.200.147.200\\" already exists", "creationTimestamp": null}')
response.status = 200
self.r.command_succeeded(response, result)
response.status = 500
Expand Down
2 changes: 1 addition & 1 deletion cluster/libvirt-coreos/skydns-rc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1beta3
apiVersion: v1
kind: ReplicationController
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion cluster/libvirt-coreos/skydns-svc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1beta3
apiVersion: v1
kind: Service
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion cluster/libvirt-coreos/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function wait-cluster-readiness {

local timeout=120
while [[ $timeout -ne 0 ]]; do
nb_ready_minions=$("${kubectl}" get nodes -o template -t "{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}" --api-version=v1beta3 2>/dev/null | tr ':' '\n' | grep -c Ready || true)
nb_ready_minions=$("${kubectl}" get nodes -o template -t "{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}" --api-version=v1 2>/dev/null | tr ':' '\n' | grep -c Ready || true)
echo "Nb ready minions: $nb_ready_minions / $NUM_MINIONS"
if [[ "$nb_ready_minions" -eq "$NUM_MINIONS" ]]; then
return 0
Expand Down
6 changes: 3 additions & 3 deletions cluster/vagrant/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ENABLE_CLUSTER_LOGGING=false
ELASTICSEARCH_LOGGING_REPLICAS=1

# Optional: Cluster monitoring to setup as part of the cluster bring up:
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}"

Expand All @@ -81,4 +81,4 @@ DNS_REPLICAS=1

# Optional: Enable setting flags for kube-apiserver to turn on behavior in active-dev
#RUNTIME_CONFIG=""
RUNTIME_CONFIG="api/v1beta3"
RUNTIME_CONFIG="api/v1"
2 changes: 1 addition & 1 deletion cluster/vagrant/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function verify-cluster {
local count="0"
until [[ "$count" == "1" ]]; do
local minions
minions=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o template -t '{{range.items}}{{.metadata.name}}:{{end}}' --api-version=v1beta3)
minions=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o template -t '{{range.items}}{{.metadata.name}}:{{end}}' --api-version=v1)
count=$(echo $minions | grep -c "${MINION_IPS[i]}") || {
printf "."
sleep 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function run-until-success() {
# $1 object type
function get-addons-from-server() {
local -r obj_type=$1
"${KUBECTL}" get "${obj_type}" -o template -t "{{range.items}}{{.metadata.name}} {{end}}" --api-version=v1beta3 -l kubernetes.io/cluster-service=true
"${KUBECTL}" get "${obj_type}" -o template -t "{{range.items}}{{.metadata.name}} {{end}}" --api-version=v1 -l kubernetes.io/cluster-service=true
}

# returns the characters after the last separator (including)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ EOF

local -r kubeconfig_base64=$(echo "${kubeconfig}" | base64 -w0)
read -r -d '' secretyaml <<EOF
apiVersion: v1beta3
apiVersion: v1
data:
kubeconfig: ${kubeconfig_base64}
kind: Secret
Expand Down
2 changes: 1 addition & 1 deletion contrib/for-tests/network-tester/rc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"kind": "ReplicationController",
"apiVersion": "v1beta3",
"apiVersion": "v1",
"metadata": {
"name": "nettest-controller",
"labels": {
Expand Down
2 changes: 1 addition & 1 deletion contrib/for-tests/network-tester/service.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"kind": "Service",
"apiVersion": "v1beta3",
"apiVersion": "v1",
"metadata": {
"name": "nettest",
"labels": {
Expand Down
2 changes: 1 addition & 1 deletion contrib/git-sync/demo/config/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1beta3
apiVersion: v1
kind: Pod
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions contrib/git-sync/demo/config/service.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v1beta3
apiVersion: v1
kind: Service
metadata:
name: blog-service
spec:
createExternalLoadBalancer: true
type: "LoadBalancer"
ports:
- port: 80
selector:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1beta3
apiVersion: v1
kind: Pod
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1beta3
apiVersion: v1
kind: Pod
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion contrib/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Now, you can access the service `wget 10.0.1.89:9090`, and build graphs.

## How it works

This is a v1beta3 based, containerized prometheus ReplicationController, which scrapes endpoints which are readable on the KUBERNETES service (the internal kubernetes service running in the default namespace, which is visible to all pods).
This is a v1 api based, containerized prometheus ReplicationController, which scrapes endpoints which are readable on the KUBERNETES service (the internal kubernetes service running in the default namespace, which is visible to all pods).

1. Use kubectl to handle auth & proxy the kubernetes API locally, emulating the old KUBERNETES_RO service.

Expand Down
2 changes: 1 addition & 1 deletion contrib/prometheus/prometheus-all.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apiVersion": "v1beta3",
"apiVersion": "v1",
"kind": "ReplicationController",
"metadata": {
"labels": {
Expand Down
4 changes: 2 additions & 2 deletions contrib/prometheus/prometheus-service.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"apiVersion":"v1",
"metadata":{
"name":"prometheus",
"labels":{
"name":"prometheus"
}
},
"spec":{
"publicIPs":["10.0.1.89"],
"type": "NodePort",
"ports": [
{
"port":9090,
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runTests() {
kube::log::status "Running benchmarks"
KUBE_GOFLAGS="-tags 'benchmark no-docker' -bench . -benchtime 1s -cpu 4" \
KUBE_RACE="-race" \
KUBE_TEST_API_VERSIONS="v1beta3" \
KUBE_TEST_API_VERSIONS="v1" \
KUBE_TIMEOUT="-timeout 10m" \
KUBE_TEST_ETCD_PREFIXES="registry"\
ETCD_CUSTOM_PREFIX="None" \
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/node_example.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"kind": "Node",
"apiVersion": "v1beta3",
"apiVersion": "v1",
"metadata": {
"name": "e2e-test-wojtekt-minion-etd6",
"selfLink": "/api/v1beta3/nodes/e2e-test-wojtekt-minion-etd6",
"selfLink": "/api/v1/nodes/e2e-test-wojtekt-minion-etd6",
"uid": "a7e89222-e8e5-11e4-8fde-42010af09327",
"resourceVersion": "379",
"creationTimestamp": "2015-04-22T11:49:39Z"
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/pod_example.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"kind": "Pod",
"apiVersion": "v1beta3",
"apiVersion": "v1",
"metadata": {
"name": "etcd-server-e2e-test-wojtekt-master",
"namespace": "default",
"selfLink": "/api/v1beta3/namespaces/default/pods/etcd-server-e2e-test-wojtekt-master",
"selfLink": "/api/v1/namespaces/default/pods/etcd-server-e2e-test-wojtekt-master",
"uid": "a671734a-e8e5-11e4-8fde-42010af09327",
"resourceVersion": "22",
"creationTimestamp": "2015-04-22T11:49:36Z",
Expand Down Expand Up @@ -71,12 +71,12 @@
],
"restartPolicy": "Always",
"dnsPolicy": "ClusterFirst",
"host": "e2e-test-wojtekt-master",
"nodeName": "e2e-test-wojtekt-master",
"hostNetwork": true
},
"status": {
"phase": "Running",
"Condition": [
"conditions": [
{
"type": "Ready",
"status": "True"
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/replication_controller_example.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"kind": "ReplicationController",
"apiVersion": "v1beta3",
"apiVersion": "v1",
"metadata": {
"name": "elasticsearch-logging-controller",
"namespace": "default",
"selfLink": "/api/v1beta3/namespaces/default/replicationcontrollers/elasticsearch-logging-controller",
"selfLink": "/api/v1/namespaces/default/replicationcontrollers/elasticsearch-logging-controller",
"uid": "aa76f162-e8e5-11e4-8fde-42010af09327",
"resourceVersion": "98",
"creationTimestamp": "2015-04-22T11:49:43Z",
Expand Down
10 changes: 6 additions & 4 deletions pkg/runtime/unstructured_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ limitations under the License.
package runtime_test

import (
"fmt"
"testing"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)

func TestDecodeUnstructured(t *testing.T) {
version := testapi.Version()
rawJson := fmt.Sprintf(`{"kind":"Pod","apiVersion":"%s","metadata":{"name":"test"}}`, version)
pl := &api.List{
Items: []runtime.Object{
&api.Pod{ObjectMeta: api.ObjectMeta{Name: "1"}},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: "v1beta3"}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`)},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "", APIVersion: "v1beta3"}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"v1beta3","metadata":{"name":"test"}}`)},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: "v1"}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"v1","metadata":{"name":"test"}}`)},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "", APIVersion: "v1"}, RawJSON: []byte(`{"kind":"Pod","apiVersion":"v1","metadata":{"name":"test"}}`)},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "Pod", APIVersion: version}, RawJSON: []byte(rawJson)},
&runtime.Unknown{TypeMeta: runtime.TypeMeta{Kind: "", APIVersion: version}, RawJSON: []byte(rawJson)},
&runtime.Unstructured{TypeMeta: runtime.TypeMeta{Kind: "Foo", APIVersion: "Bar"}, Object: map[string]interface{}{"test": "value"}},
},
}
Expand Down
Loading

0 comments on commit 2e9e46d

Please sign in to comment.