Skip to content

Commit dd395f0

Browse files
committed
Merge branch 'master' of https://github.com/kubernetes-client/java into metrics-label-selector
2 parents 3b4f83b + a293062 commit dd395f0

File tree

59 files changed

+315925
-229716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+315925
-229716
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Checkout repository
31-
uses: actions/checkout@v5
31+
uses: actions/checkout@v6
3232
- name: Setup Java
3333
uses: actions/setup-java@v5
3434
with:

.github/workflows/generate-crd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v5
31+
uses: actions/checkout@v6
3232
- name: Run CRD Model Generation
3333
run: |
3434
read CRD_SRC_ARGS < <(echo '${{ github.event.inputs.crds }}' | perl -ne 'print join " ", map {"-u $_"} split /,/')

.github/workflows/generate.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: Checkout Java
33-
uses: actions/checkout@v5
33+
uses: actions/checkout@v6
3434
with:
3535
token: ${{ secrets.PAT_TOKEN }}
3636
- name: Setup Java
@@ -39,7 +39,7 @@ jobs:
3939
distribution: 'temurin'
4040
java-version: 17.0.x
4141
- name: Checkout Gen
42-
uses: actions/checkout@v5
42+
uses: actions/checkout@v6
4343
with:
4444
path: gen
4545
repository: kubernetes-client/gen
@@ -73,12 +73,22 @@ jobs:
7373
7474
USE_SINGLE_PARAMETER=true bash java.sh ../../kubernetes/ settings
7575
popd
76-
rm -rf gen
7776
git config user.email "k8s-publishing-bot@users.noreply.github.com"
7877
git config user.name "Kubernetes Publisher"
7978
git checkout -b "$BRANCH"
8079
git add .
8180
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
81+
- name: Generate Proto
82+
run: |
83+
pushd gen/proto
84+
# Download proto dependencies for the specified Kubernetes branch
85+
bash dependencies.sh "${{ github.event.inputs.kubernetesBranch }}"
86+
# Generate Java proto classes
87+
bash generate.sh java ../../proto/src/main/java/
88+
popd
89+
rm -rf gen
90+
git add proto/
91+
git commit -s -m 'Automated proto generation from ${{ github.event.inputs.kubernetesBranch }}'
8292
- name: Apply Manual Diffs
8393
if: ${{ github.event.inputs.skip_patches != 'true' }}
8494
run: |

.github/workflows/maven.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
name: Verify Source Format
1616
steps:
17-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v6
1818
- name: Setup Java
1919
uses: actions/setup-java@v5
2020
with:
@@ -30,7 +30,7 @@ jobs:
3030
os: [ macos-latest, windows-latest, ubuntu-latest ]
3131
runs-on: ${{ matrix.os }}
3232
steps:
33-
- uses: actions/checkout@v5
33+
- uses: actions/checkout@v6
3434
- name: Setup Java
3535
uses: actions/setup-java@v5
3636
with:
@@ -55,7 +55,7 @@ jobs:
5555
runs-on: ubuntu-latest
5656
name: GraalVM Maven Test
5757
steps:
58-
- uses: actions/checkout@v5
58+
- uses: actions/checkout@v6
5959
- uses: graalvm/setup-graalvm@v1
6060
with:
6161
version: '22.3.0'
@@ -67,7 +67,7 @@ jobs:
6767
runs-on: ubuntu-latest
6868
name: End-to-End Test Against Real Cluster
6969
steps:
70-
- uses: actions/checkout@v5
70+
- uses: actions/checkout@v6
7171
- name: Create k8s Kind Cluster
7272
uses: helm/kind-action@v1.13.0
7373
- name: Setup Java
@@ -92,7 +92,7 @@ jobs:
9292
runs-on: ubuntu-latest
9393
name: Examples smoke test
9494
steps:
95-
- uses: actions/checkout@v5
95+
- uses: actions/checkout@v6
9696
- name: Setup Java
9797
uses: actions/setup-java@v5
9898
with:
@@ -142,7 +142,7 @@ jobs:
142142
- 5000:5000
143143
name: CRD Java Models Code Generation
144144
steps:
145-
- uses: actions/checkout@v5
145+
- uses: actions/checkout@v6
146146
- name: Publish to Registry
147147
uses: elgohr/Publish-Docker-Github-Action@v5
148148
with:

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
echo "${{ github.event.inputs.releaseVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+$/'
2828
echo "${{ github.event.inputs.nextDevelopmentVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+-SNAPSHOT$/'
2929
- name: Checkout
30-
uses: actions/checkout@v5
30+
uses: actions/checkout@v6
3131
with:
3232
token: ${{ secrets.PAT_TOKEN }}
3333
- name: Check Actor
@@ -63,7 +63,7 @@ jobs:
6363
run: |
6464
git checkout -b 'automated-release-${{ github.event.inputs.releaseVersion }}'
6565
./mvnw --batch-mode \
66-
release:prepare \
66+
org.apache.maven.plugins:maven-release-plugin:prepare \
6767
-Dtag=v${{ github.event.inputs.releaseVersion }} \
6868
-DconnectionUrl=https://${{ github.token }}@github.com/${{ github.repository }}.git \
6969
-DreleaseVersion=${{ github.event.inputs.releaseVersion }} \
@@ -78,7 +78,7 @@ jobs:
7878
GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
7979
run: |
8080
# The tests are already executed in the prepare, skipping
81-
./mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -DlocalCheckout=true -Darguments=-DskipTests release:perform
81+
./mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -DlocalCheckout=true -Darguments=-DskipTests org.apache.maven.plugins:maven-release-plugin:perform
8282
git push https://${{ github.token }}@github.com/${{ github.repository }}.git \
8383
automated-release-${{ github.event.inputs.releaseVersion }}:automated-release-${{ github.event.inputs.releaseVersion }}
8484
git push https://${{ github.token }}@github.com/${{ github.repository }}.git v${{ github.event.inputs.releaseVersion }}

.github/workflows/snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v5
18+
uses: actions/checkout@v6
1919
- name: Setup Java
2020
uses: actions/setup-java@v5
2121
with:

client-java-contrib/admissionreview/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@
3333

3434
<build>
3535
<plugins>
36-
<plugin>
37-
<groupId>org.sonatype.plugins</groupId>
38-
<artifactId>nexus-staging-maven-plugin</artifactId>
39-
<extensions>true</extensions>
40-
<configuration>
41-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
42-
</configuration>
43-
</plugin>
4436
<plugin>
4537
<groupId>com.diffplug.spotless</groupId>
4638
<artifactId>spotless-maven-plugin</artifactId>

client-java-contrib/cert-manager/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121
</dependencies>
2222
<build>
2323
<plugins>
24-
<plugin>
25-
<groupId>org.sonatype.plugins</groupId>
26-
<artifactId>nexus-staging-maven-plugin</artifactId>
27-
<extensions>true</extensions>
28-
<configuration>
29-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
30-
</configuration>
31-
</plugin>
3224
<plugin>
3325
<groupId>com.diffplug.spotless</groupId>
3426
<artifactId>spotless-maven-plugin</artifactId>

client-java-contrib/prometheus-operator/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@
2020
</dependencies>
2121
<build>
2222
<plugins>
23-
<plugin>
24-
<groupId>org.sonatype.plugins</groupId>
25-
<artifactId>nexus-staging-maven-plugin</artifactId>
26-
<extensions>true</extensions>
27-
<configuration>
28-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
29-
</configuration>
30-
</plugin>
3123
<plugin>
3224
<groupId>com.diffplug.spotless</groupId>
3325
<artifactId>spotless-maven-plugin</artifactId>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
package io.kubernetes.client.e2e.basic;
14+
15+
import static org.assertj.core.api.Assertions.assertThat;
16+
17+
import io.kubernetes.client.ProtoClient;
18+
import io.kubernetes.client.ProtoClient.ObjectOrStatus;
19+
import io.kubernetes.client.openapi.ApiClient;
20+
import io.kubernetes.client.proto.Meta.ObjectMeta;
21+
import io.kubernetes.client.proto.V1.Namespace;
22+
import io.kubernetes.client.proto.V1.NamespaceList;
23+
import io.kubernetes.client.util.ClientBuilder;
24+
import org.junit.jupiter.api.Test;
25+
26+
class ProtoClientTest {
27+
28+
@Test
29+
void createListGetAndDeleteNamespace() throws Exception {
30+
ApiClient client = ClientBuilder.defaultClient();
31+
ProtoClient protoClient = new ProtoClient(client);
32+
33+
// Create a namespace using protocol buffers
34+
Namespace namespace = Namespace.newBuilder()
35+
.setMetadata(ObjectMeta.newBuilder().setName("e2e-proto-test").build())
36+
.build();
37+
38+
ObjectOrStatus<Namespace> createResult = protoClient.create(
39+
namespace,
40+
"/api/v1/namespaces",
41+
"v1",
42+
"Namespace");
43+
44+
assertThat(createResult.object).isNotNull();
45+
assertThat(createResult.object.getMetadata().getName()).isEqualTo("e2e-proto-test");
46+
assertThat(createResult.status).isNull();
47+
48+
// List namespaces using protocol buffers
49+
ObjectOrStatus<NamespaceList> listResult = protoClient.list(
50+
NamespaceList.newBuilder(),
51+
"/api/v1/namespaces");
52+
53+
assertThat(listResult.object).isNotNull();
54+
assertThat(listResult.object.getItemsCount()).isGreaterThan(0);
55+
assertThat(listResult.status).isNull();
56+
57+
// Verify our namespace is in the list
58+
boolean found = listResult.object.getItemsList().stream()
59+
.anyMatch(ns -> ns.getMetadata().getName().equals("e2e-proto-test"));
60+
assertThat(found).isTrue();
61+
62+
// Get the specific namespace using protocol buffers
63+
ObjectOrStatus<Namespace> getResult = protoClient.get(
64+
Namespace.newBuilder(),
65+
"/api/v1/namespaces/e2e-proto-test");
66+
67+
assertThat(getResult.object).isNotNull();
68+
assertThat(getResult.object.getMetadata().getName()).isEqualTo("e2e-proto-test");
69+
assertThat(getResult.status).isNull();
70+
71+
// Delete the namespace using protocol buffers
72+
ObjectOrStatus<Namespace> deleteResult = protoClient.delete(
73+
Namespace.newBuilder(),
74+
"/api/v1/namespaces/e2e-proto-test");
75+
76+
assertThat(deleteResult).isNotNull();
77+
// Either we get the namespace object back or a status
78+
assertThat(deleteResult.object != null || deleteResult.status != null).isTrue();
79+
}
80+
}

0 commit comments

Comments
 (0)