-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (kubernetes-client-api) : Add DSL support for new resources in K…
…ubernetes v1.27.0 Add DSL support and mock tests for the following Kubernetes resources to KubernetesClient: - `networking.k8s.io/v1alpha1` IPAddress - `networking.k8s.io/v1alpha1` ClusterCIDR - `certificates.k8s.io/v1alpha1` ClusterTrustBundle - `authentication.k8s.io/v1beta1` SelfSubjectReview Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
0b666f7
commit b421555
Showing
18 changed files
with
767 additions
and
1 deletion.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...tes-client-api/src/main/java/io/fabric8/kubernetes/client/V1Alpha1NetworkAPIGroupDSL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* 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.networking.v1alpha1.ClusterCIDR; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.ClusterCIDRList; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.IPAddress; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.IPAddressList; | ||
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
|
||
public interface V1Alpha1NetworkAPIGroupDSL extends Client { | ||
/** | ||
* API entrypoint for networking.k8s.io/v1alpha1 IPAddress | ||
* <br> | ||
* IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs | ||
* that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. | ||
* | ||
* @return {@link NonNamespaceOperation} for IPAddress | ||
*/ | ||
NonNamespaceOperation<IPAddress, IPAddressList, Resource<IPAddress>> ipAddresses(); | ||
|
||
/** | ||
* API entrypoint for networking.k8s.io/v1alpha1 ClusterCIDR | ||
* <br> | ||
* ClusterCIDR represents a single configuration for per-Node Pod CIDR | ||
* allocations when the MultiCIDRRangeAllocator is enabled (see the config for | ||
* kube-controller-manager). A cluster may have any number of ClusterCIDR | ||
* resources, all of which will be considered when allocating a CIDR for a | ||
* Node. A ClusterCIDR is eligible to be used for a given Node when the node | ||
* selector matches the node in question and has free CIDRs to allocate. In | ||
* case of multiple matching ClusterCIDR resources, the allocator will attempt | ||
* to break ties using internal heuristics, but any ClusterCIDR whose node | ||
* selector matches the Node may be used. | ||
* | ||
* @return {@link NonNamespaceOperation} for ClusterCIDR | ||
*/ | ||
NonNamespaceOperation<ClusterCIDR, ClusterCIDRList, Resource<ClusterCIDR>> clusterCIDRs(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...t-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1Alpha1CertificatesAPIGroupDSL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* 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.certificates.v1alpha1.ClusterTrustBundle; | ||
import io.fabric8.kubernetes.api.model.certificates.v1alpha1.ClusterTrustBundleList; | ||
import io.fabric8.kubernetes.client.Client; | ||
|
||
public interface V1Alpha1CertificatesAPIGroupDSL extends Client { | ||
/** | ||
* API entrypoint for certificates.k8s.io/v1alpha1 ClusterTrustBundle | ||
* <br> | ||
* ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors | ||
* (root certificates). | ||
* <br> | ||
* ClusterTrustBundle objects are considered to be readable by any authenticated | ||
* user in the cluster, because they can be mounted by pods using the | ||
* `clusterTrustBundle` projection. All service accounts have read access to | ||
* ClusterTrustBundles by default. Users who only have namespace-level access | ||
* to a cluster can read ClusterTrustBundles by impersonating a serviceaccount | ||
* that they have access to. | ||
* <br> | ||
* It can be optionally associated with a particular assigner, in which case it | ||
* contains one valid set of trust anchors for that signer. Signers may have | ||
* multiple associated ClusterTrustBundles; each is an independent set of trust | ||
* anchors for that signer. Admission control is used to enforce that only users | ||
* with permissions on the signer can create or modify the corresponding bundle. | ||
* | ||
* @return {@link NonNamespaceOperation} for ClusterTrustBundle | ||
*/ | ||
NonNamespaceOperation<ClusterTrustBundle, ClusterTrustBundleList, Resource<ClusterTrustBundle>> clusterTrustBundles(); | ||
} |
32 changes: 32 additions & 0 deletions
32
...-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1Beta1AuthenticationAPIGroupDSL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* 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.authentication.v1beta1.SelfSubjectReview; | ||
import io.fabric8.kubernetes.client.Client; | ||
|
||
public interface V1Beta1AuthenticationAPIGroupDSL extends Client { | ||
/** | ||
* API for creating authentication.k8s.io/v1beta1 SelfSubjectReview. | ||
* <br> | ||
* SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. | ||
* When using impersonation, users will receive the user info of the user being impersonated. If impersonation or | ||
* request header authentication is used, any extra keys will have their case ignored and returned as lowercase. | ||
* | ||
* @return InOutCreateable instance for creating SelfSubjectReview object | ||
*/ | ||
InOutCreateable<SelfSubjectReview, SelfSubjectReview> selfSubjectReview(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t/src/main/java/io/fabric8/kubernetes/client/impl/V1Alpha1CertificatesAPIGroupClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* 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.impl; | ||
|
||
import io.fabric8.kubernetes.api.model.certificates.v1alpha1.ClusterTrustBundle; | ||
import io.fabric8.kubernetes.api.model.certificates.v1alpha1.ClusterTrustBundleList; | ||
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
import io.fabric8.kubernetes.client.dsl.V1Alpha1CertificatesAPIGroupDSL; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
|
||
public class V1Alpha1CertificatesAPIGroupClient extends ClientAdapter<V1Alpha1CertificatesAPIGroupClient> | ||
implements V1Alpha1CertificatesAPIGroupDSL { | ||
@Override | ||
public NonNamespaceOperation<ClusterTrustBundle, ClusterTrustBundleList, Resource<ClusterTrustBundle>> clusterTrustBundles() { | ||
return resources(ClusterTrustBundle.class, ClusterTrustBundleList.class); | ||
} | ||
|
||
@Override | ||
public V1Alpha1CertificatesAPIGroupClient newInstance() { | ||
return new V1Alpha1CertificatesAPIGroupClient(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...client/src/main/java/io/fabric8/kubernetes/client/impl/V1Alpha1NetworkAPIGroupClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* 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.impl; | ||
|
||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.ClusterCIDR; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.ClusterCIDRList; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.IPAddress; | ||
import io.fabric8.kubernetes.api.model.networking.v1alpha1.IPAddressList; | ||
import io.fabric8.kubernetes.client.V1Alpha1NetworkAPIGroupDSL; | ||
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
|
||
public class V1Alpha1NetworkAPIGroupClient extends ClientAdapter<V1Alpha1NetworkAPIGroupClient> | ||
implements V1Alpha1NetworkAPIGroupDSL { | ||
@Override | ||
public NonNamespaceOperation<IPAddress, IPAddressList, Resource<IPAddress>> ipAddresses() { | ||
return resources(IPAddress.class, IPAddressList.class); | ||
} | ||
|
||
@Override | ||
public NonNamespaceOperation<ClusterCIDR, ClusterCIDRList, Resource<ClusterCIDR>> clusterCIDRs() { | ||
return resources(ClusterCIDR.class, ClusterCIDRList.class); | ||
} | ||
|
||
@Override | ||
public V1Alpha1NetworkAPIGroupClient newInstance() { | ||
return new V1Alpha1NetworkAPIGroupClient(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../src/main/java/io/fabric8/kubernetes/client/impl/V1Beta1AuthenticationAPIGroupClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* 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.impl; | ||
|
||
import io.fabric8.kubernetes.api.model.authentication.v1beta1.SelfSubjectReview; | ||
import io.fabric8.kubernetes.client.dsl.InOutCreateable; | ||
import io.fabric8.kubernetes.client.dsl.V1Beta1AuthenticationAPIGroupDSL; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
|
||
public class V1Beta1AuthenticationAPIGroupClient extends ClientAdapter<V1Beta1AuthenticationAPIGroupClient> | ||
implements V1Beta1AuthenticationAPIGroupDSL { | ||
@Override | ||
public InOutCreateable<SelfSubjectReview, SelfSubjectReview> selfSubjectReview() { | ||
return getClient().adapt(BaseClient.class).getHandlers().getNonListingOperation(SelfSubjectReview.class, this); | ||
} | ||
|
||
@Override | ||
public V1Beta1AuthenticationAPIGroupClient newInstance() { | ||
return new V1Beta1AuthenticationAPIGroupClient(); | ||
} | ||
} |
Oops, something went wrong.