openshift_client 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openshift_client/version.rb +1 -1
- data/lib/openshift_client.rb +1 -1
- data/test/json/build.json +58 -0
- data/test/json/buildconfig.json +70 -0
- data/test/json/buildconfigs_list.json +78 -0
- data/test/json/builds_list.json +66 -0
- data/test/json/cluster_role_binding.json +24 -0
- data/test/json/cluster_role_bindings_list.json +409 -0
- data/test/test_build.rb +43 -0
- data/test/test_build_config.rb +43 -0
- data/test/test_cluster_role_binding.rb +36 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9c7507f0fb525edf686bf9ccfbb47187caef46
|
4
|
+
data.tar.gz: b31b421d18bd59d7517884186c9d615419226bf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d34c70c7582c91d91432d1d8b2090095ef60763cb114476503e5a771431f35797a6c629eb7ba9d2db24c53fb865891b1bd494297441ce990b4a450a1ba2abc
|
7
|
+
data.tar.gz: f92309966c8c07dbac2b92e72275abe31915f1c3458ee379307b327215b3ae3bbb1e627ebee8764d0bb9d4bd4cd2a52c741b2e261e73164585d73a1e3da5323a
|
data/lib/openshift_client.rb
CHANGED
@@ -16,7 +16,7 @@ module OpenshiftClient
|
|
16
16
|
# This cancels the need to define the classes
|
17
17
|
# manually on every new entity addition,
|
18
18
|
# and especially since currently the class body is empty
|
19
|
-
ENTITY_TYPES = %w(Project Route).map do |et|
|
19
|
+
ENTITY_TYPES = %w(Project Route ClusterRoleBinding Build BuildConfig).map do |et|
|
20
20
|
[OpenshiftClient.const_set(et, Class.new(RecursiveOpenStruct)), et]
|
21
21
|
end
|
22
22
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"kind": "Build",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {
|
5
|
+
"name": "ruby-sample-build-1",
|
6
|
+
"namespace": "default",
|
7
|
+
"selfLink": "/oapi/v1/namespaces/default/builds/ruby-sample-build-1",
|
8
|
+
"uid": "f031db83-98e2-11e5-af5f-5254000631f3",
|
9
|
+
"resourceVersion": "33000",
|
10
|
+
"creationTimestamp": "2015-12-02T10:53:36Z",
|
11
|
+
"labels": {
|
12
|
+
"app": "ruby-sample-build",
|
13
|
+
"buildconfig": "ruby-sample-build",
|
14
|
+
"name": "ruby-sample-build",
|
15
|
+
"openshift.io/build-config.name": "ruby-sample-build",
|
16
|
+
"template": "application-template-stibuild"
|
17
|
+
},
|
18
|
+
"annotations": {
|
19
|
+
"openshift.io/build.number": "1"
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"spec": {
|
23
|
+
"serviceAccount": "builder",
|
24
|
+
"source": {
|
25
|
+
"type": "Git",
|
26
|
+
"git": {
|
27
|
+
"uri": "https://github.com/openshift/ruby-hello-world.git"
|
28
|
+
}
|
29
|
+
},
|
30
|
+
"strategy": {
|
31
|
+
"type": "Source",
|
32
|
+
"sourceStrategy": {
|
33
|
+
"from": {
|
34
|
+
"kind": "DockerImage",
|
35
|
+
"name": "centos/ruby-22-centos7@sha256:2579b328dd84b30a374b44dcf666e29d0f3240c528ddc81971c97072d4c1dc92"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
},
|
39
|
+
"output": {
|
40
|
+
"to": {
|
41
|
+
"kind": "ImageStreamTag",
|
42
|
+
"name": "origin-ruby-sample:latest"
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"resources": {}
|
46
|
+
},
|
47
|
+
"status": {
|
48
|
+
"phase": "Failed",
|
49
|
+
"reason": "ExceededRetryTimeout",
|
50
|
+
"message": "The image stream default/origin-ruby-sample:latest cannot be used as the output for build default/ruby-sample-build-1 because the integrated Docker registry is not configured and no external registry was defined.",
|
51
|
+
"completionTimestamp": "2015-12-02T11:23:37Z",
|
52
|
+
"config": {
|
53
|
+
"kind": "BuildConfig",
|
54
|
+
"namespace": "default",
|
55
|
+
"name": "ruby-sample-build"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
{
|
2
|
+
"kind": "BuildConfig",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {
|
5
|
+
"name": "ruby-sample-build",
|
6
|
+
"namespace": "default",
|
7
|
+
"selfLink": "/oapi/v1/namespaces/default/buildconfigs/ruby-sample-build",
|
8
|
+
"uid": "ee1657ed-98e2-11e5-af5f-5254000631f3",
|
9
|
+
"resourceVersion": "30613",
|
10
|
+
"creationTimestamp": "2015-12-02T10:53:32Z",
|
11
|
+
"labels": {
|
12
|
+
"app": "ruby-sample-build",
|
13
|
+
"name": "ruby-sample-build",
|
14
|
+
"template": "application-template-stibuild"
|
15
|
+
},
|
16
|
+
"annotations": {
|
17
|
+
"openshift.io/generated-by": "OpenShiftNewApp"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"spec": {
|
21
|
+
"triggers": [
|
22
|
+
{
|
23
|
+
"type": "GitHub",
|
24
|
+
"github": {
|
25
|
+
"secret": "secret101"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"type": "Generic",
|
30
|
+
"generic": {
|
31
|
+
"secret": "secret101"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"type": "ImageChange",
|
36
|
+
"imageChange": {
|
37
|
+
"lastTriggeredImageID": "centos/ruby-22-centos7@sha256:2579b328dd84b30a374b44dcf666e29d0f3240c528ddc81971c97072d4c1dc92"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"type": "ConfigChange"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"source": {
|
45
|
+
"type": "Git",
|
46
|
+
"git": {
|
47
|
+
"uri": "https://github.com/openshift/ruby-hello-world.git"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"strategy": {
|
51
|
+
"type": "Source",
|
52
|
+
"sourceStrategy": {
|
53
|
+
"from": {
|
54
|
+
"kind": "ImageStreamTag",
|
55
|
+
"name": "ruby-22-centos7:latest"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"output": {
|
60
|
+
"to": {
|
61
|
+
"kind": "ImageStreamTag",
|
62
|
+
"name": "origin-ruby-sample:latest"
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"resources": {}
|
66
|
+
},
|
67
|
+
"status": {
|
68
|
+
"lastVersion": 1
|
69
|
+
}
|
70
|
+
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"kind": "BuildConfigList",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {
|
5
|
+
"selfLink": "/oapi/v1/buildconfigs",
|
6
|
+
"resourceVersion": "38662"
|
7
|
+
},
|
8
|
+
"items": [
|
9
|
+
{
|
10
|
+
"metadata": {
|
11
|
+
"name": "ruby-sample-build",
|
12
|
+
"namespace": "default",
|
13
|
+
"selfLink": "/oapi/v1/namespaces/default/buildconfigs/ruby-sample-build",
|
14
|
+
"uid": "ee1657ed-98e2-11e5-af5f-5254000631f3",
|
15
|
+
"resourceVersion": "30613",
|
16
|
+
"creationTimestamp": "2015-12-02T10:53:32Z",
|
17
|
+
"labels": {
|
18
|
+
"app": "ruby-sample-build",
|
19
|
+
"name": "ruby-sample-build",
|
20
|
+
"template": "application-template-stibuild"
|
21
|
+
},
|
22
|
+
"annotations": {
|
23
|
+
"openshift.io/generated-by": "OpenShiftNewApp"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"spec": {
|
27
|
+
"triggers": [
|
28
|
+
{
|
29
|
+
"type": "GitHub",
|
30
|
+
"github": {
|
31
|
+
"secret": "secret101"
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"type": "Generic",
|
36
|
+
"generic": {
|
37
|
+
"secret": "secret101"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"type": "ImageChange",
|
42
|
+
"imageChange": {
|
43
|
+
"lastTriggeredImageID": "centos/ruby-22-centos7@sha256:2579b328dd84b30a374b44dcf666e29d0f3240c528ddc81971c97072d4c1dc92"
|
44
|
+
}
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"type": "ConfigChange"
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"source": {
|
51
|
+
"type": "Git",
|
52
|
+
"git": {
|
53
|
+
"uri": "https://github.com/openshift/ruby-hello-world.git"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
"strategy": {
|
57
|
+
"type": "Source",
|
58
|
+
"sourceStrategy": {
|
59
|
+
"from": {
|
60
|
+
"kind": "ImageStreamTag",
|
61
|
+
"name": "ruby-22-centos7:latest"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"output": {
|
66
|
+
"to": {
|
67
|
+
"kind": "ImageStreamTag",
|
68
|
+
"name": "origin-ruby-sample:latest"
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"resources": {}
|
72
|
+
},
|
73
|
+
"status": {
|
74
|
+
"lastVersion": 1
|
75
|
+
}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
{
|
2
|
+
"kind": "BuildList",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {
|
5
|
+
"selfLink": "/oapi/v1/builds",
|
6
|
+
"resourceVersion": "36442"
|
7
|
+
},
|
8
|
+
"items": [
|
9
|
+
{
|
10
|
+
"metadata": {
|
11
|
+
"name": "ruby-sample-build-1",
|
12
|
+
"namespace": "default",
|
13
|
+
"selfLink": "/oapi/v1/namespaces/default/builds/ruby-sample-build-1",
|
14
|
+
"uid": "f031db83-98e2-11e5-af5f-5254000631f3",
|
15
|
+
"resourceVersion": "33000",
|
16
|
+
"creationTimestamp": "2015-12-02T10:53:36Z",
|
17
|
+
"labels": {
|
18
|
+
"app": "ruby-sample-build",
|
19
|
+
"buildconfig": "ruby-sample-build",
|
20
|
+
"name": "ruby-sample-build",
|
21
|
+
"openshift.io/build-config.name": "ruby-sample-build",
|
22
|
+
"template": "application-template-stibuild"
|
23
|
+
},
|
24
|
+
"annotations": {
|
25
|
+
"openshift.io/build.number": "1"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"spec": {
|
29
|
+
"serviceAccount": "builder",
|
30
|
+
"source": {
|
31
|
+
"type": "Git",
|
32
|
+
"git": {
|
33
|
+
"uri": "https://github.com/openshift/ruby-hello-world.git"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"strategy": {
|
37
|
+
"type": "Source",
|
38
|
+
"sourceStrategy": {
|
39
|
+
"from": {
|
40
|
+
"kind": "DockerImage",
|
41
|
+
"name": "centos/ruby-22-centos7@sha256:2579b328dd84b30a374b44dcf666e29d0f3240c528ddc81971c97072d4c1dc92"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"output": {
|
46
|
+
"to": {
|
47
|
+
"kind": "ImageStreamTag",
|
48
|
+
"name": "origin-ruby-sample:latest"
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"resources": {}
|
52
|
+
},
|
53
|
+
"status": {
|
54
|
+
"phase": "Failed",
|
55
|
+
"reason": "ExceededRetryTimeout",
|
56
|
+
"message": "The image stream default/origin-ruby-sample:latest cannot be used as the output for build default/ruby-sample-build-1 because the integrated Docker registry is not configured and no external registry was defined.",
|
57
|
+
"completionTimestamp": "2015-12-02T11:23:37Z",
|
58
|
+
"config": {
|
59
|
+
"kind": "BuildConfig",
|
60
|
+
"namespace": "default",
|
61
|
+
"name": "ruby-sample-build"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"kind": "ClusterRoleBinding",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {
|
5
|
+
"name": "cluster-admins",
|
6
|
+
"selfLink": "/oapi/v1/clusterrolebindings/cluster-admins",
|
7
|
+
"uid": "54938c11-773a-11e5-86f8-525400f8b93e",
|
8
|
+
"resourceVersion": "40",
|
9
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
10
|
+
},
|
11
|
+
"userNames": [],
|
12
|
+
"groupNames": [
|
13
|
+
"system:cluster-admins"
|
14
|
+
],
|
15
|
+
"subjects": [
|
16
|
+
{
|
17
|
+
"kind": "SystemGroup",
|
18
|
+
"name": "system:cluster-admins"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"roleRef": {
|
22
|
+
"name": "cluster-admin"
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,409 @@
|
|
1
|
+
{
|
2
|
+
"kind": "List",
|
3
|
+
"apiVersion": "v1",
|
4
|
+
"metadata": {},
|
5
|
+
"items": [
|
6
|
+
{
|
7
|
+
"kind": "ClusterRoleBinding",
|
8
|
+
"apiVersion": "v1",
|
9
|
+
"metadata": {
|
10
|
+
"name": "system:replication-controller",
|
11
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:replication-controller",
|
12
|
+
"uid": "54f55874-773a-11e5-86f8-525400f8b93e",
|
13
|
+
"resourceVersion": "69",
|
14
|
+
"creationTimestamp": "2015-10-20T14:53:32Z"
|
15
|
+
},
|
16
|
+
"userNames": [
|
17
|
+
"system:serviceaccount:openshift-infra:replication-controller"
|
18
|
+
],
|
19
|
+
"groupNames": [],
|
20
|
+
"subjects": [
|
21
|
+
{
|
22
|
+
"kind": "ServiceAccount",
|
23
|
+
"namespace": "openshift-infra",
|
24
|
+
"name": "replication-controller"
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"roleRef": {
|
28
|
+
"name": "system:replication-controller"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"kind": "ClusterRoleBinding",
|
33
|
+
"apiVersion": "v1",
|
34
|
+
"metadata": {
|
35
|
+
"name": "system:node-proxiers",
|
36
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:node-proxiers",
|
37
|
+
"uid": "54a8e7d7-773a-11e5-86f8-525400f8b93e",
|
38
|
+
"resourceVersion": "49",
|
39
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
40
|
+
},
|
41
|
+
"userNames": [],
|
42
|
+
"groupNames": [
|
43
|
+
"system:nodes"
|
44
|
+
],
|
45
|
+
"subjects": [
|
46
|
+
{
|
47
|
+
"kind": "SystemGroup",
|
48
|
+
"name": "system:nodes"
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"roleRef": {
|
52
|
+
"name": "system:node-proxier"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"kind": "ClusterRoleBinding",
|
57
|
+
"apiVersion": "v1",
|
58
|
+
"metadata": {
|
59
|
+
"name": "system:registrys",
|
60
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:registrys",
|
61
|
+
"uid": "54a64627-773a-11e5-86f8-525400f8b93e",
|
62
|
+
"resourceVersion": "47",
|
63
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
64
|
+
},
|
65
|
+
"userNames": [],
|
66
|
+
"groupNames": [
|
67
|
+
"system:registries"
|
68
|
+
],
|
69
|
+
"subjects": [
|
70
|
+
{
|
71
|
+
"kind": "SystemGroup",
|
72
|
+
"name": "system:registries"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"roleRef": {
|
76
|
+
"name": "system:registry"
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"kind": "ClusterRoleBinding",
|
81
|
+
"apiVersion": "v1",
|
82
|
+
"metadata": {
|
83
|
+
"name": "system:nodes",
|
84
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:nodes",
|
85
|
+
"uid": "54a78a15-773a-11e5-86f8-525400f8b93e",
|
86
|
+
"resourceVersion": "48",
|
87
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
88
|
+
},
|
89
|
+
"userNames": [],
|
90
|
+
"groupNames": [
|
91
|
+
"system:nodes"
|
92
|
+
],
|
93
|
+
"subjects": [
|
94
|
+
{
|
95
|
+
"kind": "SystemGroup",
|
96
|
+
"name": "system:nodes"
|
97
|
+
}
|
98
|
+
],
|
99
|
+
"roleRef": {
|
100
|
+
"name": "system:node"
|
101
|
+
}
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"kind": "ClusterRoleBinding",
|
105
|
+
"apiVersion": "v1",
|
106
|
+
"metadata": {
|
107
|
+
"name": "system:masters",
|
108
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:masters",
|
109
|
+
"uid": "548d1fe2-773a-11e5-86f8-525400f8b93e",
|
110
|
+
"resourceVersion": "39",
|
111
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
112
|
+
},
|
113
|
+
"userNames": [],
|
114
|
+
"groupNames": [
|
115
|
+
"system:masters"
|
116
|
+
],
|
117
|
+
"subjects": [
|
118
|
+
{
|
119
|
+
"kind": "SystemGroup",
|
120
|
+
"name": "system:masters"
|
121
|
+
}
|
122
|
+
],
|
123
|
+
"roleRef": {
|
124
|
+
"name": "system:master"
|
125
|
+
}
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"kind": "ClusterRoleBinding",
|
129
|
+
"apiVersion": "v1",
|
130
|
+
"metadata": {
|
131
|
+
"name": "self-provisioners",
|
132
|
+
"selfLink": "/oapi/v1/clusterrolebindings/self-provisioners",
|
133
|
+
"uid": "5499ca84-773a-11e5-86f8-525400f8b93e",
|
134
|
+
"resourceVersion": "43",
|
135
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
136
|
+
},
|
137
|
+
"userNames": [],
|
138
|
+
"groupNames": [
|
139
|
+
"system:authenticated"
|
140
|
+
],
|
141
|
+
"subjects": [
|
142
|
+
{
|
143
|
+
"kind": "SystemGroup",
|
144
|
+
"name": "system:authenticated"
|
145
|
+
}
|
146
|
+
],
|
147
|
+
"roleRef": {
|
148
|
+
"name": "self-provisioner"
|
149
|
+
}
|
150
|
+
},
|
151
|
+
{
|
152
|
+
"kind": "ClusterRoleBinding",
|
153
|
+
"apiVersion": "v1",
|
154
|
+
"metadata": {
|
155
|
+
"name": "system:deployment-controller",
|
156
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:deployment-controller",
|
157
|
+
"uid": "54d14d7e-773a-11e5-86f8-525400f8b93e",
|
158
|
+
"resourceVersion": "68",
|
159
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
160
|
+
},
|
161
|
+
"userNames": [
|
162
|
+
"system:serviceaccount:openshift-infra:deployment-controller"
|
163
|
+
],
|
164
|
+
"groupNames": [],
|
165
|
+
"subjects": [
|
166
|
+
{
|
167
|
+
"kind": "ServiceAccount",
|
168
|
+
"namespace": "openshift-infra",
|
169
|
+
"name": "deployment-controller"
|
170
|
+
}
|
171
|
+
],
|
172
|
+
"roleRef": {
|
173
|
+
"name": "system:deployment-controller"
|
174
|
+
}
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"kind": "ClusterRoleBinding",
|
178
|
+
"apiVersion": "v1",
|
179
|
+
"metadata": {
|
180
|
+
"name": "cluster-readers",
|
181
|
+
"selfLink": "/oapi/v1/clusterrolebindings/cluster-readers",
|
182
|
+
"uid": "549728b6-773a-11e5-86f8-525400f8b93e",
|
183
|
+
"resourceVersion": "41",
|
184
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
185
|
+
},
|
186
|
+
"userNames": [],
|
187
|
+
"groupNames": [
|
188
|
+
"system:cluster-readers"
|
189
|
+
],
|
190
|
+
"subjects": [
|
191
|
+
{
|
192
|
+
"kind": "SystemGroup",
|
193
|
+
"name": "system:cluster-readers"
|
194
|
+
}
|
195
|
+
],
|
196
|
+
"roleRef": {
|
197
|
+
"name": "cluster-reader"
|
198
|
+
}
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"kind": "ClusterRoleBinding",
|
202
|
+
"apiVersion": "v1",
|
203
|
+
"metadata": {
|
204
|
+
"name": "cluster-status-binding",
|
205
|
+
"selfLink": "/oapi/v1/clusterrolebindings/cluster-status-binding",
|
206
|
+
"uid": "54a068a9-773a-11e5-86f8-525400f8b93e",
|
207
|
+
"resourceVersion": "45",
|
208
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
209
|
+
},
|
210
|
+
"userNames": [],
|
211
|
+
"groupNames": [
|
212
|
+
"system:authenticated",
|
213
|
+
"system:unauthenticated"
|
214
|
+
],
|
215
|
+
"subjects": [
|
216
|
+
{
|
217
|
+
"kind": "SystemGroup",
|
218
|
+
"name": "system:authenticated"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"kind": "SystemGroup",
|
222
|
+
"name": "system:unauthenticated"
|
223
|
+
}
|
224
|
+
],
|
225
|
+
"roleRef": {
|
226
|
+
"name": "cluster-status"
|
227
|
+
}
|
228
|
+
},
|
229
|
+
{
|
230
|
+
"kind": "ClusterRoleBinding",
|
231
|
+
"apiVersion": "v1",
|
232
|
+
"metadata": {
|
233
|
+
"name": "system:oauth-token-deleters",
|
234
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:oauth-token-deleters",
|
235
|
+
"uid": "549e6fed-773a-11e5-86f8-525400f8b93e",
|
236
|
+
"resourceVersion": "44",
|
237
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
238
|
+
},
|
239
|
+
"userNames": [],
|
240
|
+
"groupNames": [
|
241
|
+
"system:authenticated",
|
242
|
+
"system:unauthenticated"
|
243
|
+
],
|
244
|
+
"subjects": [
|
245
|
+
{
|
246
|
+
"kind": "SystemGroup",
|
247
|
+
"name": "system:authenticated"
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"kind": "SystemGroup",
|
251
|
+
"name": "system:unauthenticated"
|
252
|
+
}
|
253
|
+
],
|
254
|
+
"roleRef": {
|
255
|
+
"name": "system:oauth-token-deleter"
|
256
|
+
}
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"kind": "ClusterRoleBinding",
|
260
|
+
"apiVersion": "v1",
|
261
|
+
"metadata": {
|
262
|
+
"name": "system:webhooks",
|
263
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:webhooks",
|
264
|
+
"uid": "54ae8f0b-773a-11e5-86f8-525400f8b93e",
|
265
|
+
"resourceVersion": "51",
|
266
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
267
|
+
},
|
268
|
+
"userNames": [],
|
269
|
+
"groupNames": [
|
270
|
+
"system:authenticated",
|
271
|
+
"system:unauthenticated"
|
272
|
+
],
|
273
|
+
"subjects": [
|
274
|
+
{
|
275
|
+
"kind": "SystemGroup",
|
276
|
+
"name": "system:authenticated"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"kind": "SystemGroup",
|
280
|
+
"name": "system:unauthenticated"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
"roleRef": {
|
284
|
+
"name": "system:webhook"
|
285
|
+
}
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"kind": "ClusterRoleBinding",
|
289
|
+
"apiVersion": "v1",
|
290
|
+
"metadata": {
|
291
|
+
"name": "basic-users",
|
292
|
+
"selfLink": "/oapi/v1/clusterrolebindings/basic-users",
|
293
|
+
"uid": "5498e847-773a-11e5-86f8-525400f8b93e",
|
294
|
+
"resourceVersion": "42",
|
295
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
296
|
+
},
|
297
|
+
"userNames": [],
|
298
|
+
"groupNames": [
|
299
|
+
"system:authenticated"
|
300
|
+
],
|
301
|
+
"subjects": [
|
302
|
+
{
|
303
|
+
"kind": "SystemGroup",
|
304
|
+
"name": "system:authenticated"
|
305
|
+
}
|
306
|
+
],
|
307
|
+
"roleRef": {
|
308
|
+
"name": "basic-user"
|
309
|
+
}
|
310
|
+
},
|
311
|
+
{
|
312
|
+
"kind": "ClusterRoleBinding",
|
313
|
+
"apiVersion": "v1",
|
314
|
+
"metadata": {
|
315
|
+
"name": "system:routers",
|
316
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:routers",
|
317
|
+
"uid": "54a1b624-773a-11e5-86f8-525400f8b93e",
|
318
|
+
"resourceVersion": "46",
|
319
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
320
|
+
},
|
321
|
+
"userNames": [],
|
322
|
+
"groupNames": [
|
323
|
+
"system:routers"
|
324
|
+
],
|
325
|
+
"subjects": [
|
326
|
+
{
|
327
|
+
"kind": "SystemGroup",
|
328
|
+
"name": "system:routers"
|
329
|
+
}
|
330
|
+
],
|
331
|
+
"roleRef": {
|
332
|
+
"name": "system:router"
|
333
|
+
}
|
334
|
+
},
|
335
|
+
{
|
336
|
+
"kind": "ClusterRoleBinding",
|
337
|
+
"apiVersion": "v1",
|
338
|
+
"metadata": {
|
339
|
+
"name": "system:sdn-readers",
|
340
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:sdn-readers",
|
341
|
+
"uid": "54ac8c26-773a-11e5-86f8-525400f8b93e",
|
342
|
+
"resourceVersion": "50",
|
343
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
344
|
+
},
|
345
|
+
"userNames": [],
|
346
|
+
"groupNames": [
|
347
|
+
"system:nodes"
|
348
|
+
],
|
349
|
+
"subjects": [
|
350
|
+
{
|
351
|
+
"kind": "SystemGroup",
|
352
|
+
"name": "system:nodes"
|
353
|
+
}
|
354
|
+
],
|
355
|
+
"roleRef": {
|
356
|
+
"name": "system:sdn-reader"
|
357
|
+
}
|
358
|
+
},
|
359
|
+
{
|
360
|
+
"kind": "ClusterRoleBinding",
|
361
|
+
"apiVersion": "v1",
|
362
|
+
"metadata": {
|
363
|
+
"name": "system:build-controller",
|
364
|
+
"selfLink": "/oapi/v1/clusterrolebindings/system:build-controller",
|
365
|
+
"uid": "54cb09fe-773a-11e5-86f8-525400f8b93e",
|
366
|
+
"resourceVersion": "52",
|
367
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
368
|
+
},
|
369
|
+
"userNames": [
|
370
|
+
"system:serviceaccount:openshift-infra:build-controller"
|
371
|
+
],
|
372
|
+
"groupNames": [],
|
373
|
+
"subjects": [
|
374
|
+
{
|
375
|
+
"kind": "ServiceAccount",
|
376
|
+
"namespace": "openshift-infra",
|
377
|
+
"name": "build-controller"
|
378
|
+
}
|
379
|
+
],
|
380
|
+
"roleRef": {
|
381
|
+
"name": "system:build-controller"
|
382
|
+
}
|
383
|
+
},
|
384
|
+
{
|
385
|
+
"kind": "ClusterRoleBinding",
|
386
|
+
"apiVersion": "v1",
|
387
|
+
"metadata": {
|
388
|
+
"name": "cluster-admins",
|
389
|
+
"selfLink": "/oapi/v1/clusterrolebindings/cluster-admins",
|
390
|
+
"uid": "54938c11-773a-11e5-86f8-525400f8b93e",
|
391
|
+
"resourceVersion": "40",
|
392
|
+
"creationTimestamp": "2015-10-20T14:53:31Z"
|
393
|
+
},
|
394
|
+
"userNames": [],
|
395
|
+
"groupNames": [
|
396
|
+
"system:cluster-admins"
|
397
|
+
],
|
398
|
+
"subjects": [
|
399
|
+
{
|
400
|
+
"kind": "SystemGroup",
|
401
|
+
"name": "system:cluster-admins"
|
402
|
+
}
|
403
|
+
],
|
404
|
+
"roleRef": {
|
405
|
+
"name": "cluster-admin"
|
406
|
+
}
|
407
|
+
}
|
408
|
+
]
|
409
|
+
}
|
data/test/test_build.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
def open_test_json_file(name)
|
4
|
+
File.new(File.join(File.dirname(__FILE__), 'json', name))
|
5
|
+
end
|
6
|
+
|
7
|
+
# Build entity tests
|
8
|
+
class TestBuild < MiniTest::Test
|
9
|
+
def test_get_builds
|
10
|
+
stub_request(:get, %r{/builds})
|
11
|
+
.to_return(body: open_test_json_file('builds_list.json'),
|
12
|
+
status: 200)
|
13
|
+
|
14
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080'
|
15
|
+
builds = client.get_builds
|
16
|
+
|
17
|
+
assert_instance_of(Kubeclient::Common::EntityList, builds)
|
18
|
+
|
19
|
+
assert_equal(1, builds.size)
|
20
|
+
assert_instance_of(OpenshiftClient::Build, builds[0])
|
21
|
+
assert_requested(:get,
|
22
|
+
'https://localhost:8080/oapi/v1/builds',
|
23
|
+
times: 1)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_get_build
|
27
|
+
stub_request(:get, %r{/builds})
|
28
|
+
.to_return(body: open_test_json_file('build.json'),
|
29
|
+
status: 200)
|
30
|
+
|
31
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080'
|
32
|
+
build = client.get_build 'ruby-sample-build-1', 'default'
|
33
|
+
|
34
|
+
assert_instance_of(OpenshiftClient::Build, build)
|
35
|
+
assert_equal('ruby-sample-build-1', build.metadata.name)
|
36
|
+
assert_equal('v1', build.apiVersion)
|
37
|
+
assert_equal('builder', build.spec.serviceAccount)
|
38
|
+
|
39
|
+
assert_requested(:get,
|
40
|
+
'https://localhost:8080/oapi/v1/namespaces/default/builds/ruby-sample-build-1',
|
41
|
+
times: 1)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
def open_test_json_file(name)
|
4
|
+
File.new(File.join(File.dirname(__FILE__), 'json', name))
|
5
|
+
end
|
6
|
+
|
7
|
+
# Buildconfig entity tests
|
8
|
+
class TestBuildconfig < MiniTest::Test
|
9
|
+
def test_get_buildconfigs
|
10
|
+
stub_request(:get, %r{/buildconfigs})
|
11
|
+
.to_return(body: open_test_json_file('buildconfigs_list.json'),
|
12
|
+
status: 200)
|
13
|
+
|
14
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080'
|
15
|
+
buildconfigs = client.get_build_configs
|
16
|
+
|
17
|
+
assert_instance_of(Kubeclient::Common::EntityList, buildconfigs)
|
18
|
+
|
19
|
+
assert_equal(1, buildconfigs.size)
|
20
|
+
assert_instance_of(OpenshiftClient::BuildConfig, buildconfigs[0])
|
21
|
+
assert_requested(:get,
|
22
|
+
'https://localhost:8080/oapi/v1/buildconfigs',
|
23
|
+
times: 1)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_get_buildconfig
|
27
|
+
stub_request(:get, %r{/buildconfigs})
|
28
|
+
.to_return(body: open_test_json_file('buildconfig.json'),
|
29
|
+
status: 200)
|
30
|
+
|
31
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080'
|
32
|
+
buildconfig = client.get_build_config 'ruby-sample-build', 'default'
|
33
|
+
|
34
|
+
assert_instance_of(OpenshiftClient::BuildConfig, buildconfig)
|
35
|
+
assert_equal('ruby-sample-build', buildconfig.metadata.name)
|
36
|
+
assert_equal('v1', buildconfig.apiVersion)
|
37
|
+
assert_equal('Git', buildconfig.spec.source.type)
|
38
|
+
|
39
|
+
assert_requested(:get,
|
40
|
+
'https://localhost:8080/oapi/v1/namespaces/default/buildconfigs/ruby-sample-build',
|
41
|
+
times: 1)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
def open_test_json_file(name)
|
4
|
+
File.new(File.join(File.dirname(__FILE__), 'json', name))
|
5
|
+
end
|
6
|
+
|
7
|
+
# ClusterRoleBinding entity tests
|
8
|
+
class TestClusterRoleBinding < MiniTest::Test
|
9
|
+
def test_get_cluster_role_binding
|
10
|
+
stub_request(:get, %r{/clusterrolebindings/cluster-admins})
|
11
|
+
.to_return(body: open_test_json_file('cluster_role_binding.json'),
|
12
|
+
status: 200)
|
13
|
+
|
14
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080/oapi'
|
15
|
+
binding = client.get_cluster_role_binding('cluster-admins')
|
16
|
+
|
17
|
+
assert_instance_of(OpenshiftClient::ClusterRoleBinding, binding)
|
18
|
+
assert_equal('cluster-admins', binding.metadata.name)
|
19
|
+
assert_equal([], binding.userNames)
|
20
|
+
assert_equal(['system:cluster-admins'], binding.groupNames)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_get_cluster_role_bindings
|
24
|
+
stub_request(:get, %r{/clusterrolebindings})
|
25
|
+
.to_return(body: open_test_json_file('cluster_role_bindings_list.json'),
|
26
|
+
status: 200)
|
27
|
+
|
28
|
+
client = OpenshiftClient::Client.new 'https://localhost:8080/oapi'
|
29
|
+
cluster_role_bindings = client.get_cluster_role_bindings
|
30
|
+
|
31
|
+
assert_instance_of(Kubeclient::Common::EntityList, cluster_role_bindings)
|
32
|
+
|
33
|
+
assert_equal(16, cluster_role_bindings.size)
|
34
|
+
assert_instance_of(OpenshiftClient::ClusterRoleBinding, cluster_role_bindings[1])
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openshift_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alissa Bonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,10 +139,19 @@ files:
|
|
139
139
|
- lib/openshift_client.rb
|
140
140
|
- lib/openshift_client/version.rb
|
141
141
|
- openshift_client.gemspec
|
142
|
+
- test/json/build.json
|
143
|
+
- test/json/buildconfig.json
|
144
|
+
- test/json/buildconfigs_list.json
|
145
|
+
- test/json/builds_list.json
|
146
|
+
- test/json/cluster_role_binding.json
|
147
|
+
- test/json/cluster_role_bindings_list.json
|
142
148
|
- test/json/project_b1.json
|
143
149
|
- test/json/project_list_b1.json
|
144
150
|
- test/json/route_b1.json
|
151
|
+
- test/test_build.rb
|
152
|
+
- test/test_build_config.rb
|
145
153
|
- test/test_client.rb
|
154
|
+
- test/test_cluster_role_binding.rb
|
146
155
|
- test/test_helper.rb
|
147
156
|
- test/test_project.rb
|
148
157
|
- test/test_route.rb
|
@@ -171,10 +180,19 @@ signing_key:
|
|
171
180
|
specification_version: 4
|
172
181
|
summary: A client for Openshift REST api
|
173
182
|
test_files:
|
183
|
+
- test/json/build.json
|
184
|
+
- test/json/buildconfig.json
|
185
|
+
- test/json/buildconfigs_list.json
|
186
|
+
- test/json/builds_list.json
|
187
|
+
- test/json/cluster_role_binding.json
|
188
|
+
- test/json/cluster_role_bindings_list.json
|
174
189
|
- test/json/project_b1.json
|
175
190
|
- test/json/project_list_b1.json
|
176
191
|
- test/json/route_b1.json
|
192
|
+
- test/test_build.rb
|
193
|
+
- test/test_build_config.rb
|
177
194
|
- test/test_client.rb
|
195
|
+
- test/test_cluster_role_binding.rb
|
178
196
|
- test/test_helper.rb
|
179
197
|
- test/test_project.rb
|
180
198
|
- test/test_route.rb
|