Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (kubernetes-model) : Update Kubernetes Model to v1.24.0 (#4031) #4120

Merged
merged 1 commit into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ And Store.getKey can be used rather than directly referencing static Cache funct
* Fix #3813: Handle exit code status messages with pod uploads
* Fix #3947: Point CamelK Extension model to latest released version v1.8.2
* Update Tekton Pipeline Model to v0.35.0
* Fix #4031: Update Kubernetes Model to v1.24.0


#### New Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,76 @@
*/
package io.fabric8.kubernetes.client.dsl;

import io.fabric8.kubernetes.api.model.storage.StorageClass;
import io.fabric8.kubernetes.api.model.storage.StorageClassList;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachment;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachmentList;
import io.fabric8.kubernetes.api.model.storage.CSIDriver;
import io.fabric8.kubernetes.api.model.storage.CSIDriverList;
import io.fabric8.kubernetes.api.model.storage.CSINode;
import io.fabric8.kubernetes.api.model.storage.CSINodeList;
import io.fabric8.kubernetes.api.model.storage.StorageClass;
import io.fabric8.kubernetes.api.model.storage.StorageClassList;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachment;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachmentList;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacity;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacityList;
import io.fabric8.kubernetes.client.Client;

public interface StorageAPIGroupDSL extends Client{
public interface StorageAPIGroupDSL extends Client {

/**
* DSL entrypoint for storage.k8s.io/v1 StorageClass
*
* @deprecated Use <code>client.storage().v1().storageClasses()</code> instead
* @return {@link NonNamespaceOperation} for StorageClass
*/
@Deprecated
NonNamespaceOperation<StorageClass, StorageClassList, Resource<StorageClass>> storageClasses();

/**
* DSL entrypoint for storage.k8s.io/v1 CSIDriver
*
* @deprecated Use <code>client.storage().v1().csiDrivers()</code> instead
* @return {@link NonNamespaceOperation} for CSIDriver resource
*/
@Deprecated
NonNamespaceOperation<CSIDriver, CSIDriverList, Resource<CSIDriver>> csiDrivers();

/**
* DSL entrypoint for storage.k8s.io/v1 CSINode
*
* @deprecated Use <code>client.storage().v1().csiDrivers()</code> instead
* @return {@link NonNamespaceOperation} for CSINode resource
*/
@Deprecated
NonNamespaceOperation<CSINode, CSINodeList, Resource<CSINode>> csiNodes();

/**
* DSL entrypoint for storage.k8s.io/v1 CSIStorageCapacities
*
* @deprecated Use <code>client.storage().v1beta1().csiStorageCapacities()</code> instead
* @return {@link NonNamespaceOperation} for CSIStorageCapacity
*/
@Deprecated
MixedOperation<CSIStorageCapacity, CSIStorageCapacityList, Resource<CSIStorageCapacity>> csiStorageCapacities();

/**
* DSL entrypoint for storage.k8s.io/v1 VolumeAttachment
*
* @deprecated Use <code>client.storage().v1().volumeAttachments()</code> instead
* @return {@link NonNamespaceOperation} for VolumeAttachment resource
*/
@Deprecated
NonNamespaceOperation<VolumeAttachment, VolumeAttachmentList, Resource<VolumeAttachment>> volumeAttachments();

/**
* DSL entrypoint for resources in storage.k8s.io/v1 apiGroup
*
* @return {@link V1StorageAPIGroupDSL}
*/
V1StorageAPIGroupDSL v1();

/**
* DSL entrypoint for resources in storage.k8s.io/v1beta1 apiGroup
*
* @return {@link V1beta1StorageAPIGroupDSL}
*/
V1beta1StorageAPIGroupDSL v1beta1();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client.dsl;

import io.fabric8.kubernetes.api.model.storage.CSIDriver;
import io.fabric8.kubernetes.api.model.storage.CSIDriverList;
import io.fabric8.kubernetes.api.model.storage.CSINode;
import io.fabric8.kubernetes.api.model.storage.CSINodeList;
import io.fabric8.kubernetes.api.model.storage.CSIStorageCapacity;
import io.fabric8.kubernetes.api.model.storage.CSIStorageCapacityList;
import io.fabric8.kubernetes.api.model.storage.StorageClass;
import io.fabric8.kubernetes.api.model.storage.StorageClassList;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachment;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachmentList;
import io.fabric8.kubernetes.client.Client;

public interface V1StorageAPIGroupDSL extends Client {

/**
* DSL entrypoint for storage.k8s.io/v1 StorageClass
*
* @return {@link NonNamespaceOperation} for StorageClass
*/
NonNamespaceOperation<StorageClass, StorageClassList, Resource<StorageClass>> storageClasses();

/**
* DSL entrypoint for storage.k8s.io/v1 CSIDriver
*
* @return {@link NonNamespaceOperation} for CSIDriver resource
*/
NonNamespaceOperation<CSIDriver, CSIDriverList, Resource<CSIDriver>> csiDrivers();

/**
* DSL entrypoint for storage.k8s.io/v1 CSINode
*
* @return {@link NonNamespaceOperation} for CSINode resource
*/
NonNamespaceOperation<CSINode, CSINodeList, Resource<CSINode>> csiNodes();

/**
* DSL entrypoint for storage.k8s.io/v1 CSIStorageCapacity
*
* @return {@link MixedOperation} for CSIStorageCapacity resource
*/
MixedOperation<CSIStorageCapacity, CSIStorageCapacityList, Resource<CSIStorageCapacity>> csiStorageCapacities();

/**
* DSL entrypoint for storage.k8s.io/v1 VolumeAttachment
*
* @return {@link NonNamespaceOperation} for VolumeAttachment resource
*/
NonNamespaceOperation<VolumeAttachment, VolumeAttachmentList, Resource<VolumeAttachment>> volumeAttachments();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client.dsl;

import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIDriver;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIDriverList;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSINode;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSINodeList;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacity;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacityList;
import io.fabric8.kubernetes.client.Client;

public interface V1beta1StorageAPIGroupDSL extends Client {
/**
* DSL entrypoint for storage.k8s.io/v1beta1 CSIDriver
*
* @return {@link NonNamespaceOperation} for CSIDriver resource
*/
NonNamespaceOperation<CSIDriver, CSIDriverList, Resource<CSIDriver>> csiDrivers();

/**
* DSL entrypoint for storage.k8s.io/v1beta1 CSINode
*
* @return {@link NonNamespaceOperation} for CSINode resource
*/
NonNamespaceOperation<CSINode, CSINodeList, Resource<CSINode>> csiNodes();

/**
* DSL entrypoint for storage.k8s.io/v1beta1 CSIStorageCapacity
*
* @return {@link MixedOperation} for CSIStorageCapacity resource
*/
MixedOperation<CSIStorageCapacity, CSIStorageCapacityList, Resource<CSIStorageCapacity>> csiStorageCapacities();

}
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public DefaultKubernetesClient(HttpClient httpClient, Config config) {
this.getAdapters().registerClient(V1SchedulingAPIGroupDSL.class, new V1SchedulingAPIGroupClient());
this.getAdapters().registerClient(V1beta1SchedulingAPIGroupDSL.class, new V1beta1SchedulingAPIGroupClient());
this.getAdapters().registerClient(StorageAPIGroupDSL.class, new StorageAPIGroupClient());
this.getAdapters().registerClient(V1StorageAPIGroupClient.class, new V1StorageAPIGroupClient());
this.getAdapters().registerClient(V1beta1StorageAPIGroupClient.class, new V1beta1StorageAPIGroupClient());
this.getAdapters().registerClient(V1APIGroupDSL.class, new V1APIGroupClient());
this.getAdapters().registerClient(V1ApiextensionAPIGroupDSL.class, new V1ApiextensionsAPIGroupClient());
this.getAdapters().registerClient(V1beta1ApiextensionAPIGroupDSL.class, new V1beta1ApiextensionsAPIGroupClient());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.StorageAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1StorageAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.V1beta1StorageAPIGroupDSL;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class StorageAPIGroupClient extends ClientAdapter<StorageAPIGroupClient> implements StorageAPIGroupDSL {
Expand Down Expand Up @@ -58,6 +60,16 @@ public NonNamespaceOperation<VolumeAttachment, VolumeAttachmentList, Resource<Vo
return resources(VolumeAttachment.class, VolumeAttachmentList.class);
}

@Override
public V1StorageAPIGroupDSL v1() {
return adapt(V1StorageAPIGroupClient.class);
}

@Override
public V1beta1StorageAPIGroupDSL v1beta1() {
return adapt(V1beta1StorageAPIGroupClient.class);
}

@Override
public StorageAPIGroupClient newInstance() {
return new StorageAPIGroupClient();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.storage.CSIDriver;
import io.fabric8.kubernetes.api.model.storage.CSIDriverList;
import io.fabric8.kubernetes.api.model.storage.CSINode;
import io.fabric8.kubernetes.api.model.storage.CSINodeList;
import io.fabric8.kubernetes.api.model.storage.CSIStorageCapacity;
import io.fabric8.kubernetes.api.model.storage.CSIStorageCapacityList;
import io.fabric8.kubernetes.api.model.storage.StorageClass;
import io.fabric8.kubernetes.api.model.storage.StorageClassList;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachment;
import io.fabric8.kubernetes.api.model.storage.VolumeAttachmentList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1StorageAPIGroupDSL;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1StorageAPIGroupClient extends ClientAdapter<V1StorageAPIGroupClient> implements V1StorageAPIGroupDSL {
@Override
public V1StorageAPIGroupClient newInstance() {
return new V1StorageAPIGroupClient();
}

@Override
public NonNamespaceOperation<StorageClass, StorageClassList, Resource<StorageClass>> storageClasses() {
return resources(StorageClass.class, StorageClassList.class);
}

@Override
public NonNamespaceOperation<CSIDriver, CSIDriverList, Resource<CSIDriver>> csiDrivers() {
return resources(CSIDriver.class, CSIDriverList.class);
}

@Override
public NonNamespaceOperation<CSINode, CSINodeList, Resource<CSINode>> csiNodes() {
return resources(CSINode.class, CSINodeList.class);
}

@Override
public MixedOperation<CSIStorageCapacity, CSIStorageCapacityList, Resource<CSIStorageCapacity>> csiStorageCapacities() {
return resources(CSIStorageCapacity.class, CSIStorageCapacityList.class);
}

@Override
public NonNamespaceOperation<VolumeAttachment, VolumeAttachmentList, Resource<VolumeAttachment>> volumeAttachments() {
return resources(VolumeAttachment.class, VolumeAttachmentList.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIDriver;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIDriverList;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSINode;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSINodeList;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacity;
import io.fabric8.kubernetes.api.model.storage.v1beta1.CSIStorageCapacityList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.dsl.V1beta1StorageAPIGroupDSL;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1beta1StorageAPIGroupClient extends ClientAdapter<V1beta1StorageAPIGroupClient>
implements V1beta1StorageAPIGroupDSL {
@Override
public NonNamespaceOperation<CSIDriver, CSIDriverList, Resource<CSIDriver>> csiDrivers() {
return resources(CSIDriver.class, CSIDriverList.class);
}

@Override
public NonNamespaceOperation<CSINode, CSINodeList, Resource<CSINode>> csiNodes() {
return resources(CSINode.class, CSINodeList.class);
}

@Override
public MixedOperation<CSIStorageCapacity, CSIStorageCapacityList, Resource<CSIStorageCapacity>> csiStorageCapacities() {
return resources(CSIStorageCapacity.class, CSIStorageCapacityList.class);
}

@Override
public V1beta1StorageAPIGroupClient newInstance() {
return new V1beta1StorageAPIGroupClient();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public static void main(String[] args) {
try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) {
final String storageClassName = UUID.randomUUID().toString();
logger.info("List of existent storage classes:");
client.storage().storageClasses().list().getItems()
client.storage().v1().storageClasses().list().getItems()
.forEach(sc -> logger.info(" - {}", sc.getMetadata().getName()));

logger.info("Creating new Storage class");
final StorageClass storageClass = client.storage().storageClasses().create(
final StorageClass storageClass = client.storage().v1().storageClasses().create(
new StorageClassBuilder()
.withNewMetadata().withName(storageClassName).endMetadata()
.addToParameters("resturl", "http://localhost:8080")
Expand All @@ -56,11 +56,11 @@ public static void main(String[] args) {
logger.info("Newly created storage class details:\n{}", storageClass);

logger.info("Updated list of existent storage classes:");
client.storage().storageClasses().list().getItems()
client.storage().v1().storageClasses().list().getItems()
.forEach(sc -> logger.info(" - {}", sc.getMetadata().getName()));

logger.info("Updating {} storage clas to add new label", storageClassName);
final StorageClass updatedStorageClass = client.storage().storageClasses().withName(storageClassName).edit(
final StorageClass updatedStorageClass = client.storage().v1().storageClasses().withName(storageClassName).edit(
s -> new StorageClassBuilder(s).editMetadata().addToLabels("testLabel", "testLabelValue").endMetadata().build());
logger.info("Updated storage class details:\n{}", updatedStorageClass);

Expand Down
Loading