Skip to content

Commit ae18b56

Browse files
committed
Update to 1.20.4 of crossplane. Switch to spring-grpc as the driver behind the spring-boot starter
Signed-off-by: Knut-Erik Johnsen <[email protected]>
1 parent 0f73799 commit ae18b56

File tree

14 files changed

+377
-126
lines changed

14 files changed

+377
-126
lines changed

crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_usages.yaml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,200 @@ spec:
213213
storage: true
214214
subresources:
215215
status: {}
216+
- additionalPrinterColumns:
217+
- jsonPath: .metadata.annotations.crossplane\.io/usage-details
218+
name: DETAILS
219+
type: string
220+
- jsonPath: .status.conditions[?(@.type=='Ready')].status
221+
name: READY
222+
type: string
223+
- jsonPath: .metadata.creationTimestamp
224+
name: AGE
225+
type: date
226+
name: v1beta1
227+
schema:
228+
openAPIV3Schema:
229+
description: |-
230+
A Usage defines a deletion blocking relationship between two resources.
231+
232+
Usages prevent accidental deletion of a single resource or deletion of
233+
resources with dependent resources.
234+
235+
Read the Crossplane documentation for
236+
[more information about Compositions](https://docs.crossplane.io/latest/concepts/usages).
237+
properties:
238+
apiVersion:
239+
description: |-
240+
APIVersion defines the versioned schema of this representation of an object.
241+
Servers should convert recognized schemas to the latest internal value, and
242+
may reject unrecognized values.
243+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
244+
type: string
245+
kind:
246+
description: |-
247+
Kind is a string value representing the REST resource this object represents.
248+
Servers may infer this from the endpoint the client submits requests to.
249+
Cannot be updated.
250+
In CamelCase.
251+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
252+
type: string
253+
metadata:
254+
type: object
255+
spec:
256+
description: UsageSpec defines the desired state of Usage.
257+
properties:
258+
by:
259+
description: By is the resource that is "using the other resource".
260+
properties:
261+
apiVersion:
262+
description: API version of the referent.
263+
type: string
264+
kind:
265+
description: |-
266+
Kind of the referent.
267+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
268+
type: string
269+
resourceRef:
270+
description: Reference to the resource.
271+
properties:
272+
name:
273+
description: Name of the referent.
274+
type: string
275+
required:
276+
- name
277+
type: object
278+
resourceSelector:
279+
description: |-
280+
Selector to the resource.
281+
This field will be ignored if ResourceRef is set.
282+
properties:
283+
matchControllerRef:
284+
description: |-
285+
MatchControllerRef ensures an object with the same controller reference
286+
as the selecting object is selected.
287+
type: boolean
288+
matchLabels:
289+
additionalProperties:
290+
type: string
291+
description: MatchLabels ensures an object with matching labels
292+
is selected.
293+
type: object
294+
type: object
295+
type: object
296+
x-kubernetes-validations:
297+
- message: either a resource reference or a resource selector should
298+
be set.
299+
rule: has(self.resourceRef) || has(self.resourceSelector)
300+
of:
301+
description: Of is the resource that is "being used".
302+
properties:
303+
apiVersion:
304+
description: API version of the referent.
305+
type: string
306+
kind:
307+
description: |-
308+
Kind of the referent.
309+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
310+
type: string
311+
resourceRef:
312+
description: Reference to the resource.
313+
properties:
314+
name:
315+
description: Name of the referent.
316+
type: string
317+
required:
318+
- name
319+
type: object
320+
resourceSelector:
321+
description: |-
322+
Selector to the resource.
323+
This field will be ignored if ResourceRef is set.
324+
properties:
325+
matchControllerRef:
326+
description: |-
327+
MatchControllerRef ensures an object with the same controller reference
328+
as the selecting object is selected.
329+
type: boolean
330+
matchLabels:
331+
additionalProperties:
332+
type: string
333+
description: MatchLabels ensures an object with matching labels
334+
is selected.
335+
type: object
336+
type: object
337+
type: object
338+
x-kubernetes-validations:
339+
- message: either a resource reference or a resource selector should
340+
be set.
341+
rule: has(self.resourceRef) || has(self.resourceSelector)
342+
reason:
343+
description: Reason is the reason for blocking deletion of the resource.
344+
type: string
345+
replayDeletion:
346+
description: ReplayDeletion will trigger a deletion on the used resource
347+
during the deletion of the usage itself, if it was attempted to
348+
be deleted at least once.
349+
type: boolean
350+
required:
351+
- of
352+
type: object
353+
x-kubernetes-validations:
354+
- message: either "spec.by" or "spec.reason" must be specified.
355+
rule: has(self.by) || has(self.reason)
356+
status:
357+
description: UsageStatus defines the observed state of Usage.
358+
properties:
359+
conditions:
360+
description: Conditions of the resource.
361+
items:
362+
description: A Condition that may apply to a resource.
363+
properties:
364+
lastTransitionTime:
365+
description: |-
366+
LastTransitionTime is the last time this condition transitioned from one
367+
status to another.
368+
format: date-time
369+
type: string
370+
message:
371+
description: |-
372+
A Message containing details about this condition's last transition from
373+
one status to another, if any.
374+
type: string
375+
observedGeneration:
376+
description: |-
377+
ObservedGeneration represents the .metadata.generation that the condition was set based upon.
378+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
379+
with respect to the current state of the instance.
380+
format: int64
381+
type: integer
382+
reason:
383+
description: A Reason for this condition's last transition from
384+
one status to another.
385+
type: string
386+
status:
387+
description: Status of this condition; is it currently True,
388+
False, or Unknown?
389+
type: string
390+
type:
391+
description: |-
392+
Type of this condition. At most one of each condition type may apply to
393+
a resource at any point in time.
394+
type: string
395+
required:
396+
- lastTransitionTime
397+
- reason
398+
- status
399+
- type
400+
type: object
401+
type: array
402+
x-kubernetes-list-map-keys:
403+
- type
404+
x-kubernetes-list-type: map
405+
type: object
406+
required:
407+
- spec
408+
type: object
409+
served: true
410+
storage: false
411+
subresources:
412+
status: {}

crossplane-crd-model/src/main/resources/kubernetes/fetch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
release="v1.18.0"
3+
release="v1.20.4"
44

55
apiextensions=$(gh api --jq '.[].name' "/repos/crossplane/crossplane/contents/cluster/crds?ref=${release}" | grep apiextensions)
66

crossplane-function-base/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626
<groupId>com.fasterxml.jackson.core</groupId>
2727
<artifactId>jackson-databind</artifactId>
2828
</dependency>
29+
<dependency>
30+
<groupId>com.google.protobuf</groupId>
31+
<artifactId>protobuf-java-util</artifactId>
32+
<exclusions>
33+
<exclusion>
34+
<groupId>com.google.guava</groupId>
35+
<artifactId>guava</artifactId>
36+
</exclusion>
37+
</exclusions>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.google.guava</groupId>
41+
<artifactId>guava</artifactId>
42+
</dependency>
2943
</dependencies>
3044

3145

crossplane-function-example/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
<groupId>org.springframework.boot</groupId>
3131
<artifactId>spring-boot-autoconfigure</artifactId>
3232
</dependency>
33-
<dependency>
34-
<groupId>org.bouncycastle</groupId>
35-
<artifactId>bcpkix-jdk18on</artifactId>
36-
</dependency>
3733
</dependencies>
3834

3935

crossplane-function-example/src/main/java/io/crossplane/compositefunctions/example/ExampleFunctionApplication.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55

6-
import java.security.Security;
76

87
@SpringBootApplication
98
public class ExampleFunctionApplication {
109

1110
public static void main(String[] args) {
12-
// The bouncycastle provider is needed for the autogenerated certificates that crossplane generates to work
13-
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
1411
SpringApplication.run(ExampleFunctionApplication.class, args);
15-
1612
}
1713
}

crossplane-function-example/src/main/java/io/crossplane/compositefunctions/example/resource/ExampleFunctionResource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import io.crossplane.compositefunctions.base.CrossplaneFunctionResponse;
66
import io.crossplane.compositefunctions.example.model.XBuckets;
77
import io.crossplane.compositefunctions.starter.conversion.CrossplaneResourceService;
8-
import net.devh.boot.grpc.server.service.GrpcService;
8+
99
import org.springframework.beans.factory.annotation.Autowired;
10+
import org.springframework.grpc.server.service.GrpcService;
11+
1012

1113
import java.util.Optional;
1214

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
grpc:
2-
server:
3-
security:
4-
# For local testing we disable the security setting. This enables us to use the crossplane beta render functionality
5-
enabled: false
1+
spring:
2+
profiles:
3+
active: development
4+
5+
grpc:
6+
server:
7+
port: 9443
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
grpc:
2-
server:
3-
security:
4-
# When runnin on kubernetes, crossplane expects a TLS endpoint to be presented, and
5-
# injects the pod with the certificate and ca store to use. We just point to the mounted files
6-
# in our config to be compliant.
7-
# See also the ExampleFunctionApplication class, as we need to register bouncycastle as the provider for these
8-
# certificates to work in Java
9-
enabled: true
10-
client-auth: optional
11-
certificate-chain: file:///tls/server/tls.crt
12-
private-key: file:///tls/server/tls.key
13-
trust-cert-collection: file:///tls/server/ca.crt
1+
spring:
2+
grpc:
3+
server:
4+
port: 9443
5+
ssl:
6+
bundle: grpcssl
7+
# When runnin on kubernetes, crossplane expects a TLS endpoint to be presented, and
8+
# injects the pod with the certificate and ca store to use. We just point to the mounted files
9+
# in our config to be compliant.
10+
ssl:
11+
bundle:
12+
pem:
13+
grpcssl:
14+
keystore:
15+
certificate: /tls/server/tls.crt
16+
private-key: /tls/server/tls.key
17+
truststore:
18+
certificate: /tls/server/ca.crt
19+
20+

crossplane-function-example/src/main/resources/application.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ spring:
22
profiles:
33
active: development
44

5-
6-
grpc:
7-
server:
8-
port: 9443
5+
grpc:
6+
server:
7+
port: 9443

crossplane-function-springboot-starter/pom.xml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,57 @@
3232
<dependency>
3333
<groupId>com.google.protobuf</groupId>
3434
<artifactId>protobuf-java-util</artifactId>
35+
<exclusions>
36+
<exclusion>
37+
<groupId>com.google.guava</groupId>
38+
<artifactId>guava</artifactId>
39+
</exclusion>
40+
<exclusion>
41+
<groupId>com.google.j2objc</groupId>
42+
<artifactId>j2objc-annotations</artifactId>
43+
</exclusion>
44+
<exclusion>
45+
<groupId>com.google.errorprone</groupId>
46+
<artifactId>error_prone_annotations</artifactId>
47+
</exclusion>
48+
</exclusions>
3549
</dependency>
3650

3751
<dependency>
38-
<groupId>net.devh</groupId>
39-
<artifactId>grpc-server-spring-boot-starter</artifactId>
52+
<groupId>com.google.guava</groupId>
53+
<artifactId>guava</artifactId>
4054
</dependency>
4155

56+
<dependency>
57+
<groupId>org.springframework.grpc</groupId>
58+
<artifactId>spring-grpc-spring-boot-starter</artifactId>
59+
<exclusions>
60+
<exclusion>
61+
<groupId>io.grpc</groupId>
62+
<artifactId>grpc-netty</artifactId>
63+
</exclusion>
64+
</exclusions>
65+
</dependency>
66+
<dependency>
67+
<groupId>io.grpc</groupId>
68+
<artifactId>grpc-netty-shaded</artifactId>
69+
<exclusions>
70+
<exclusion>
71+
<groupId>com.google.guava</groupId>
72+
<artifactId>guava</artifactId>
73+
</exclusion>
74+
<exclusion>
75+
<groupId>com.google.j2objc</groupId>
76+
<artifactId>j2objc-annotations</artifactId>
77+
</exclusion>
78+
<exclusion>
79+
<groupId>com.google.errorprone</groupId>
80+
<artifactId>error_prone_annotations</artifactId>
81+
</exclusion>
82+
</exclusions>
83+
</dependency>
84+
85+
4286
<dependency>
4387
<groupId>com.fasterxml.jackson.module</groupId>
4488
<artifactId>jackson-module-jsonSchema-jakarta</artifactId>

0 commit comments

Comments
 (0)