Skip to content

Commit 16cbecf

Browse files
committed
Update POMs. Create examples-release-12
1 parent 3618425 commit 16cbecf

40 files changed

+2804
-20
lines changed

examples/examples-release-10/pom.xml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33

4-
<parent>
5-
<groupId>io.kubernetes</groupId>
6-
<artifactId>client-java-examples-parent</artifactId>
7-
<version>1.0.0-SNAPSHOT</version>
8-
<relativePath>../pom.xml</relativePath>
9-
</parent>
10-
4+
<groupId>io.kubernetes</groupId>
115
<artifactId>client-java-examples-release-10</artifactId>
126
<packaging>bundle</packaging>
137
<name>client-java-examples-release-10</name>
14-
8+
<version>1.0.0</version>
159
<properties>
1610
<kubernetes.client.version>10.0.0</kubernetes.client.version>
11+
<java.version>1.8</java.version>
12+
<maven.compiler.source>${java.version}</maven.compiler.source>
13+
<maven.compiler.target>${java.version}</maven.compiler.target>
14+
<junit.version>4.13</junit.version>
1715
</properties>
1816
<dependencies>
1917
<dependency>
@@ -54,6 +52,7 @@
5452
<dependency>
5553
<groupId>commons-cli</groupId>
5654
<artifactId>commons-cli</artifactId>
55+
<version>1.4</version>
5756
</dependency>
5857
<dependency>
5958
<groupId>io.kubernetes</groupId>
@@ -69,11 +68,13 @@
6968
<dependency>
7069
<groupId>junit</groupId>
7170
<artifactId>junit</artifactId>
71+
<version>${junit.version}</version>
7272
<scope>test</scope>
7373
</dependency>
7474
<dependency>
7575
<groupId>com.github.tomakehurst</groupId>
7676
<artifactId>wiremock</artifactId>
77+
<version>2.27.2</version>
7778
<scope>test</scope>
7879
</dependency>
7980
</dependencies>

examples/examples-release-11/pom.xml

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33

4-
<parent>
5-
<groupId>io.kubernetes</groupId>
6-
<artifactId>client-java-examples-parent</artifactId>
7-
<version>1.0.0-SNAPSHOT</version>
8-
<relativePath>../pom.xml</relativePath>
9-
</parent>
10-
114
<artifactId>client-java-examples-release-11</artifactId>
125
<packaging>bundle</packaging>
136
<name>client-java-examples-release-11</name>
7+
<version>1.0.0</version>
8+
<properties>
9+
<kubernetes.client.version>10.0.0</kubernetes.client.version>
10+
<java.version>1.8</java.version>
11+
<maven.compiler.source>${java.version}</maven.compiler.source>
12+
<maven.compiler.target>${java.version}</maven.compiler.target>
13+
<junit.version>4.13</junit.version>
14+
</properties>
1415

1516
<dependencies>
1617
<dependency>
@@ -51,6 +52,7 @@
5152
<dependency>
5253
<groupId>commons-cli</groupId>
5354
<artifactId>commons-cli</artifactId>
55+
<version>1.4</version>
5456
</dependency>
5557
<dependency>
5658
<groupId>io.kubernetes</groupId>
@@ -66,11 +68,13 @@
6668
<dependency>
6769
<groupId>junit</groupId>
6870
<artifactId>junit</artifactId>
71+
<version>${junit.version}</version>
6972
<scope>test</scope>
7073
</dependency>
7174
<dependency>
7275
<groupId>com.github.tomakehurst</groupId>
7376
<artifactId>wiremock</artifactId>
77+
<version>2.27.2</version>
7478
<scope>test</scope>
7579
</dependency>
7680
<!--for spring controller example-->

examples/examples-release-12/.google

Whitespace-only changes.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM openjdk:8-jre
2+
3+
COPY target/client-java-examples-*-SNAPSHOT-jar-with-dependencies.jar /examples.jar
4+
5+
CMD ["java", "-jar", "/examples.jar"]
6+
7+
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Running examples
2+
3+
```sh
4+
export REPO_ROOT=/path/to/client-java/repo
5+
6+
cd ${REPO_ROOT}/kubernetes
7+
mvn install
8+
9+
cd ${REPO_ROOT}/examples
10+
mvn package
11+
mvn exec:java -Dexec.mainClass="io.kubernetes.client.examples.Example"
12+
```
13+
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# creates a pod and runs
4+
# Example.java(list pods for all namespaces) on starting of pod
5+
6+
# Exit on any error.
7+
set -e
8+
9+
if ! which minikube > /dev/null; then
10+
echo "This script requires minikube installed."
11+
exit 100
12+
fi
13+
14+
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15+
16+
export REPO_ROOT=${dir}/..
17+
18+
cd ${REPO_ROOT}
19+
mvn install
20+
21+
cd ${REPO_ROOT}/examples
22+
mvn package
23+
24+
eval $(minikube docker-env)
25+
docker build -t test/examples:1.0 .
26+
kubectl apply -f test.yaml

examples/examples-release-12/pom.xml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
4+
<parent>
5+
<groupId>io.kubernetes</groupId>
6+
<artifactId>client-java-examples-parent</artifactId>
7+
<version>1.0.0-SNAPSHOT</version>
8+
<relativePath>../pom.xml</relativePath>
9+
</parent>
10+
11+
<artifactId>client-java-examples-release-12</artifactId>
12+
<packaging>bundle</packaging>
13+
<name>client-java-examples-release-12</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.prometheus</groupId>
18+
<artifactId>simpleclient</artifactId>
19+
<version>0.9.0</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>io.prometheus</groupId>
23+
<artifactId>simpleclient_httpserver</artifactId>
24+
<version>0.9.0</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>io.kubernetes</groupId>
28+
<artifactId>client-java-api</artifactId>
29+
<version>${kubernetes.client.version}</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>io.kubernetes</groupId>
33+
<artifactId>client-java</artifactId>
34+
<version>${kubernetes.client.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>io.kubernetes</groupId>
38+
<artifactId>client-java-extended</artifactId>
39+
<version>${kubernetes.client.version}</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>io.kubernetes</groupId>
43+
<artifactId>client-java-spring-integration</artifactId>
44+
<version>${kubernetes.client.version}</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.kubernetes</groupId>
48+
<artifactId>client-java-proto</artifactId>
49+
<version>${kubernetes.client.version}</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>commons-cli</groupId>
53+
<artifactId>commons-cli</artifactId>
54+
</dependency>
55+
<dependency>
56+
<groupId>io.kubernetes</groupId>
57+
<artifactId>client-java-cert-manager-models</artifactId>
58+
<version>0.16.1-SNAPSHOT</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>io.kubernetes</groupId>
62+
<artifactId>client-java-prometheus-operator-models</artifactId>
63+
<version>0.38.1-SNAPSHOT</version>
64+
</dependency>
65+
<!-- test dependencies -->
66+
<dependency>
67+
<groupId>junit</groupId>
68+
<artifactId>junit</artifactId>
69+
<scope>test</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>com.github.tomakehurst</groupId>
73+
<artifactId>wiremock</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
<!--for spring controller example-->
77+
<dependency>
78+
<groupId>org.springframework.boot</groupId>
79+
<artifactId>spring-boot-starter-web</artifactId>
80+
<version>${spring.boot.version}</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.springframework.boot</groupId>
84+
<artifactId>spring-boot-starter-actuator</artifactId>
85+
<version>${spring.boot.version}</version>
86+
</dependency>
87+
88+
</dependencies>
89+
90+
91+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
Copyright 2020 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.examples;
14+
15+
import io.kubernetes.client.Attach;
16+
import io.kubernetes.client.openapi.ApiClient;
17+
import io.kubernetes.client.openapi.ApiException;
18+
import io.kubernetes.client.openapi.Configuration;
19+
import io.kubernetes.client.util.Config;
20+
import io.kubernetes.client.util.Streams;
21+
import java.io.BufferedReader;
22+
import java.io.IOException;
23+
import java.io.InputStreamReader;
24+
import java.io.OutputStream;
25+
26+
/**
27+
* A simple example of how to use the Java API
28+
*
29+
* <p>Easiest way to run this: mvn exec:java
30+
* -Dexec.mainClass="io.kubernetes.client.examples.AttachExample"
31+
*
32+
* <p>From inside $REPO_DIR/examples
33+
*/
34+
public class AttachExample {
35+
public static void main(String[] args) throws IOException, ApiException, InterruptedException {
36+
ApiClient client = Config.defaultClient();
37+
Configuration.setDefaultApiClient(client);
38+
39+
Attach attach = new Attach();
40+
final Attach.AttachResult result = attach.attach("default", "nginx-4217019353-k5sn9", true);
41+
42+
new Thread(
43+
new Runnable() {
44+
public void run() {
45+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
46+
OutputStream output = result.getStandardInputStream();
47+
try {
48+
while (true) {
49+
String line = in.readLine();
50+
output.write(line.getBytes());
51+
output.write('\n');
52+
output.flush();
53+
}
54+
} catch (IOException ex) {
55+
ex.printStackTrace();
56+
}
57+
}
58+
})
59+
.start();
60+
61+
new Thread(
62+
new Runnable() {
63+
public void run() {
64+
try {
65+
Streams.copy(result.getStandardOutputStream(), System.out);
66+
} catch (IOException ex) {
67+
ex.printStackTrace();
68+
}
69+
}
70+
})
71+
.start();
72+
73+
Thread.sleep(10 * 1000);
74+
result.close();
75+
System.exit(0);
76+
}
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Copyright 2020 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.examples;
14+
15+
import io.cert.manager.models.V1alpha2IssuerSpecSelfSigned;
16+
import io.cert.manager.models.V1beta1Issuer;
17+
import io.cert.manager.models.V1beta1IssuerList;
18+
import io.cert.manager.models.V1beta1IssuerSpec;
19+
import io.kubernetes.client.openapi.models.V1ObjectMeta;
20+
import io.kubernetes.client.util.ClientBuilder;
21+
import io.kubernetes.client.util.generic.GenericKubernetesApi;
22+
import java.io.IOException;
23+
24+
/**
25+
* This sample creates a self signed issuer "self-signed-issuer" in default namespace on a
26+
* Kubernetes cluster where cert-manager is installed
27+
*/
28+
public class CertManagerExample {
29+
public static void main(String[] args) throws IOException {
30+
GenericKubernetesApi<V1beta1Issuer, V1beta1IssuerList> issuerApi =
31+
new GenericKubernetesApi<>(
32+
V1beta1Issuer.class,
33+
V1beta1IssuerList.class,
34+
"cert-manager.io",
35+
"v1beta1",
36+
"issuers",
37+
ClientBuilder.defaultClient());
38+
issuerApi.create(
39+
new V1beta1Issuer()
40+
.metadata(new V1ObjectMeta().namespace("default").name("self-signed-issuer"))
41+
.kind("Issuer")
42+
.apiVersion("cert-manager.io/v1beta1")
43+
.spec(new V1beta1IssuerSpec().selfSigned(new V1alpha2IssuerSpecSelfSigned())));
44+
}
45+
}

0 commit comments

Comments
 (0)