Skip to content

Commit 48c6c01

Browse files
committed
Fixes needed for the new API version.
1 parent 0b19cff commit 48c6c01

File tree

3 files changed

+14
-23
lines changed
  • extended/src/main/java/io/kubernetes/client/extended/event/v1
  • util/src

3 files changed

+14
-23
lines changed

extended/src/main/java/io/kubernetes/client/extended/event/v1beta1/EventSink.java renamed to extended/src/main/java/io/kubernetes/client/extended/event/v1/EventSink.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
13-
package io.kubernetes.client.extended.event.v1beta1;
13+
package io.kubernetes.client.extended.event.v1;
1414

1515
import io.kubernetes.client.custom.V1Patch;
1616
import io.kubernetes.client.openapi.ApiException;
1717
import io.kubernetes.client.openapi.models.CoreV1Event;
18-
import io.kubernetes.client.openapi.models.V1beta1Event;
18+
import io.kubernetes.client.openapi.models.EventsV1Event;
1919

20-
// placeholder interface for event v1beta1 api
20+
// placeholder interface for event v1 api
2121
public interface EventSink {
2222

23-
CoreV1Event create(V1beta1Event event) throws ApiException;
23+
CoreV1Event create(EventsV1Event event) throws ApiException;
2424

25-
CoreV1Event update(V1beta1Event event) throws ApiException;
25+
CoreV1Event update(EventsV1Event event) throws ApiException;
2626

27-
CoreV1Event patch(V1beta1Event event, V1Patch patch) throws ApiException;
27+
CoreV1Event patch(EventsV1Event event, V1Patch patch) throws ApiException;
2828
}

util/src/main/java/io/kubernetes/client/util/conversion/Jobs.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import io.kubernetes.client.openapi.models.V1JobSpec;
1717
import io.kubernetes.client.openapi.models.V1ObjectMeta;
1818
import io.kubernetes.client.openapi.models.V1OwnerReference;
19-
import io.kubernetes.client.openapi.models.V1beta1CronJob;
20-
import io.kubernetes.client.openapi.models.V1beta1CronJobSpec;
19+
import io.kubernetes.client.openapi.models.V1CronJob;
20+
import io.kubernetes.client.openapi.models.V1CronJobSpec;
2121
import java.util.Arrays;
2222
import java.util.HashMap;
2323
import java.util.Map;
@@ -32,13 +32,13 @@ public class Jobs {
3232
* @param jobName cronJob name
3333
* @return V1Job object
3434
*/
35-
public static V1Job cronJobToJob(V1beta1CronJob cronJob, String jobName) {
35+
public static V1Job cronJobToJob(V1CronJob cronJob, String jobName) {
3636

3737
Map<String, String> annotations = new HashMap<>();
3838
Map<String, String> labels = new HashMap<>();
3939
V1JobSpec jobSpec = null;
4040

41-
V1beta1CronJobSpec cronJobSpec = cronJob.getSpec();
41+
V1CronJobSpec cronJobSpec = cronJob.getSpec();
4242

4343
if (cronJobSpec != null && cronJobSpec.getJobTemplate() != null) {
4444
V1ObjectMeta metadata = cronJobSpec.getJobTemplate().getMetadata();

util/src/test/java/io/kubernetes/client/informer/cache/CacheTest.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,17 @@ public void testCacheStore() {
121121
V1Pod pod = ((V1Pod) this.obj);
122122
List indexedObjectList = cache.byIndex(mockIndexName, this.index);
123123
assertEquals(0, indexedObjectList.size());
124-
assertEquals(null, pod.getMetadata().getClusterName());
124+
assertEquals(null, pod.getMetadata().getResourceVersion());
125125

126126
cache.add(this.obj);
127127

128128
// replace cached object w/ null value
129129
String newClusterName = "test_cluster";
130-
pod.getMetadata().setClusterName(newClusterName);
130+
pod.getMetadata().setResourceVersion(newClusterName);
131131
cache.update(this.obj);
132132

133133
assertEquals(1, cache.list().size());
134-
assertEquals(newClusterName, pod.getMetadata().getClusterName());
134+
assertEquals(newClusterName, pod.getMetadata().getResourceVersion());
135135
}
136136

137137
@Test
@@ -162,7 +162,6 @@ public void testAddIndexers() {
162162
Cache<V1Pod> podCache = new Cache<>();
163163

164164
String nodeIndex = "node-index";
165-
String clusterIndex = "cluster-index";
166165

167166
Map<String, Function<V1Pod, List<String>>> indexers = new HashMap<>();
168167

@@ -172,17 +171,11 @@ public void testAddIndexers() {
172171
return Arrays.asList(pod.getSpec().getNodeName());
173172
});
174173

175-
indexers.put(
176-
clusterIndex,
177-
(V1Pod pod) -> {
178-
return Arrays.asList(pod.getMetadata().getClusterName());
179-
});
180-
181174
podCache.addIndexers(indexers);
182175

183176
V1Pod testPod =
184177
new V1Pod()
185-
.metadata(new V1ObjectMeta().namespace("ns").name("n").clusterName("cluster1"))
178+
.metadata(new V1ObjectMeta().namespace("ns").name("n"))
186179
.spec(new V1PodSpec().nodeName("node1"));
187180

188181
podCache.add(testPod);
@@ -193,7 +186,5 @@ public void testAddIndexers() {
193186
List<V1Pod> nodeNameIndexedPods = podCache.byIndex(nodeIndex, "node1");
194187
assertEquals(1, nodeNameIndexedPods.size());
195188

196-
List<V1Pod> clusterNameIndexedPods = podCache.byIndex(clusterIndex, "cluster1");
197-
assertEquals(1, clusterNameIndexedPods.size());
198189
}
199190
}

0 commit comments

Comments
 (0)