Skip to content

Commit f1693c4

Browse files
authored
Feature/fix poms (#4)
* Updated javadoc settings in poms Signed-off-by: Knut-Erik Johnsen <[email protected]> * Switched naming of tags/releases Signed-off-by: Knut-Erik Johnsen <[email protected]> * Added springboot starter and example. Reverted to version 1.14 to cover more releases Signed-off-by: Knut-Erik Johnsen <[email protected]> * Cleanup naming ved using autoregister functionality Signed-off-by: Knut-Erik Johnsen <[email protected]> --------- Signed-off-by: Knut-Erik Johnsen <[email protected]>
1 parent cdead31 commit f1693c4

File tree

37 files changed

+2311
-2015
lines changed

37 files changed

+2311
-2015
lines changed

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

Lines changed: 197 additions & 232 deletions
Large diffs are not rendered by default.

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

Lines changed: 861 additions & 1095 deletions
Large diffs are not rendered by default.

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

Lines changed: 420 additions & 531 deletions
Large diffs are not rendered by default.

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.13.0
66
name: environmentconfigs.apiextensions.crossplane.io
77
spec:
88
group: apiextensions.crossplane.io
@@ -28,26 +28,20 @@ spec:
2828
values.
2929
properties:
3030
apiVersion:
31-
description: |-
32-
APIVersion defines the versioned schema of this representation of an object.
33-
Servers should convert recognized schemas to the latest internal value, and
34-
may reject unrecognized values.
35-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
31+
description: 'APIVersion defines the versioned schema of this representation
32+
of an object. Servers should convert recognized schemas to the latest
33+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3634
type: string
3735
data:
3836
additionalProperties:
3937
x-kubernetes-preserve-unknown-fields: true
40-
description: |-
41-
The data of this EnvironmentConfig.
42-
This may contain any kind of structure that can be serialized into JSON.
38+
description: The data of this EnvironmentConfig. This may contain any
39+
kind of structure that can be serialized into JSON.
4340
type: object
4441
kind:
45-
description: |-
46-
Kind is a string value representing the REST resource this object represents.
47-
Servers may infer this from the endpoint the client submits requests to.
48-
Cannot be updated.
49-
In CamelCase.
50-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
42+
description: 'Kind is a string value representing the REST resource this
43+
object represents. Servers may infer this from the endpoint the client
44+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
5145
type: string
5246
metadata:
5347
type: object

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

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.13.0
66
name: usages.apiextensions.crossplane.io
77
spec:
88
group: apiextensions.crossplane.io
@@ -32,19 +32,14 @@ spec:
3232
resources.
3333
properties:
3434
apiVersion:
35-
description: |-
36-
APIVersion defines the versioned schema of this representation of an object.
37-
Servers should convert recognized schemas to the latest internal value, and
38-
may reject unrecognized values.
39-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
35+
description: 'APIVersion defines the versioned schema of this representation
36+
of an object. Servers should convert recognized schemas to the latest
37+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
4038
type: string
4139
kind:
42-
description: |-
43-
Kind is a string value representing the REST resource this object represents.
44-
Servers may infer this from the endpoint the client submits requests to.
45-
Cannot be updated.
46-
In CamelCase.
47-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
40+
description: 'Kind is a string value representing the REST resource this
41+
object represents. Servers may infer this from the endpoint the client
42+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4843
type: string
4944
metadata:
5045
type: object
@@ -58,9 +53,7 @@ spec:
5853
description: API version of the referent.
5954
type: string
6055
kind:
61-
description: |-
62-
Kind of the referent.
63-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
56+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
6457
type: string
6558
resourceRef:
6659
description: Reference to the resource.
@@ -72,14 +65,12 @@ spec:
7265
- name
7366
type: object
7467
resourceSelector:
75-
description: |-
76-
Selector to the resource.
77-
This field will be ignored if ResourceRef is set.
68+
description: Selector to the resource. This field will be ignored
69+
if ResourceRef is set.
7870
properties:
7971
matchControllerRef:
80-
description: |-
81-
MatchControllerRef ensures an object with the same controller reference
82-
as the selecting object is selected.
72+
description: MatchControllerRef ensures an object with the
73+
same controller reference as the selecting object is selected.
8374
type: boolean
8475
matchLabels:
8576
additionalProperties:
@@ -100,9 +91,7 @@ spec:
10091
description: API version of the referent.
10192
type: string
10293
kind:
103-
description: |-
104-
Kind of the referent.
105-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
94+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
10695
type: string
10796
resourceRef:
10897
description: Reference to the resource.
@@ -114,14 +103,12 @@ spec:
114103
- name
115104
type: object
116105
resourceSelector:
117-
description: |-
118-
Selector to the resource.
119-
This field will be ignored if ResourceRef is set.
106+
description: Selector to the resource. This field will be ignored
107+
if ResourceRef is set.
120108
properties:
121109
matchControllerRef:
122-
description: |-
123-
MatchControllerRef ensures an object with the same controller reference
124-
as the selecting object is selected.
110+
description: MatchControllerRef ensures an object with the
111+
same controller reference as the selecting object is selected.
125112
type: boolean
126113
matchLabels:
127114
additionalProperties:
@@ -158,15 +145,13 @@ spec:
158145
description: A Condition that may apply to a resource.
159146
properties:
160147
lastTransitionTime:
161-
description: |-
162-
LastTransitionTime is the last time this condition transitioned from one
163-
status to another.
148+
description: LastTransitionTime is the last time this condition
149+
transitioned from one status to another.
164150
format: date-time
165151
type: string
166152
message:
167-
description: |-
168-
A Message containing details about this condition's last transition from
169-
one status to another, if any.
153+
description: A Message containing details about this condition's
154+
last transition from one status to another, if any.
170155
type: string
171156
reason:
172157
description: A Reason for this condition's last transition from
@@ -177,9 +162,8 @@ spec:
177162
False, or Unknown?
178163
type: string
179164
type:
180-
description: |-
181-
Type of this condition. At most one of each condition type may apply to
182-
a resource at any point in time.
165+
description: Type of this condition. At most one of each condition
166+
type may apply to a resource at any point in time.
183167
type: string
184168
required:
185169
- lastTransitionTime

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="release-1.16"
3+
release="release-1.14"
44

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

crossplane-function-base/src/main/java/io/crossplane/compositefunctions/CrossplaneFunctionRequest.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

crossplane-function-base/src/main/java/io/crossplane/compositefunctions/CrossplaneCompositeFunctionBase.java renamed to crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneCompositeFunctionBase.java

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
package io.crossplane.compositefunctions;
1+
package io.crossplane.compositefunctions.base;
22

3-
import io.crossplane.compositefunctions.protobuf.*;
3+
4+
import io.crossplane.compositefunctions.protobuf.FunctionRunnerServiceGrpc;
5+
import io.crossplane.compositefunctions.protobuf.RunFunctionRequest;
6+
import io.crossplane.compositefunctions.protobuf.RunFunctionResponse;
7+
import io.crossplane.compositefunctions.protobuf.State;
48
import io.grpc.stub.StreamObserver;
59
import org.slf4j.Logger;
610
import org.slf4j.LoggerFactory;
@@ -25,11 +29,12 @@ public void runFunction(RunFunctionRequest request, StreamObserver<RunFunctionRe
2529
State desired = request.getDesired();
2630

2731
// Copy existing state into new desired state
28-
// Should these be sent to the function? Probably?
2932
desiredBuilder.putAllResources(desired.getResourcesMap());
3033

3134
CrossplaneFunctionRequest crossplaneFunctionRequest = new CrossplaneFunctionRequest(request.getObserved(),
32-
request.getExtraResourcesMap(), request.getCredentialsMap());
35+
request.getDesired());
36+
37+
// request.getExtraResourcesMap(), request.getCredentialsMap()
3338

3439
logger.debug("Calling method with implemented logic");
3540
CrossplaneFunctionResponse crossplaneFunctionResponse = runFunction(crossplaneFunctionRequest);
@@ -39,15 +44,26 @@ public void runFunction(RunFunctionRequest request, StreamObserver<RunFunctionRe
3944
desiredBuilder.putResources(entry.getKey(), CrossplaneObjectToProtobufConverter.convertToResource(entry.getValue()));
4045
}
4146

42-
Requirements requirements = Requirements.newBuilder()
43-
.putAllExtraResources(crossplaneFunctionResponse.resourceSelectors())
44-
.build();
47+
RunFunctionResponse.Builder responseBuilder = RunFunctionResponse.newBuilder();
48+
49+
/*
50+
if (! crossplaneFunctionResponse.resourceSelectors().isEmpty()) {
51+
Requirements requirements = Requirements.newBuilder()
52+
.putAllExtraResources(crossplaneFunctionResponse.resourceSelectors())
53+
.build();
54+
responseBuilder.setRequirements(requirements);
55+
}
56+
*/
57+
58+
if (! crossplaneFunctionResponse.results().isEmpty()) {
59+
responseBuilder.addAllResults(crossplaneFunctionResponse.results());
60+
}
61+
62+
if (desiredBuilder.getResourcesCount() > 0) {
63+
responseBuilder.setDesired(desiredBuilder.build());
64+
}
4565

46-
RunFunctionResponse runFunctionResponse = RunFunctionResponse
47-
.newBuilder()
48-
.setRequirements(requirements)
49-
.addAllResults(crossplaneFunctionResponse.results())
50-
.setDesired(desiredBuilder.build())
66+
RunFunctionResponse runFunctionResponse = responseBuilder
5167
.build();
5268

5369
responseObserver.onNext(runFunctionResponse);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.crossplane.compositefunctions.base;
2+
3+
import io.crossplane.compositefunctions.protobuf.State;
4+
5+
import java.util.Map;
6+
7+
/**
8+
* Holder for the request from crossplane
9+
* @param observedState The observedstate of the crossplane resources
10+
* @param desiredState The sum of previously called functions state. To override, create a new resource with the same name in the response
11+
*/
12+
public record CrossplaneFunctionRequest(State observedState, State desiredState) {
13+
14+
// * @param extraResourcesMap A map of any extra resources requested
15+
// * @param credentialsMap A map of credentials sent as input
16+
// Map<String, Resources> extraResourcesMap,
17+
// Map<String, Credentials> credentialsMap
18+
}

crossplane-function-base/src/main/java/io/crossplane/compositefunctions/CrossplaneFunctionResponse.java renamed to crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneFunctionResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
package io.crossplane.compositefunctions;
1+
package io.crossplane.compositefunctions.base;
22

3-
import io.crossplane.compositefunctions.protobuf.ResourceSelector;
43
import io.crossplane.compositefunctions.protobuf.Result;
54

65
import java.util.ArrayList;
@@ -11,18 +10,19 @@
1110
/**
1211
* Holder for the response to Crossplane
1312
* @param desiredResources Map of the desired resources
14-
* @param resourceSelectors Map of the resource selectors for any extra resources
1513
* @param results List of the results
1614
*/
1715
public record CrossplaneFunctionResponse(Map<String, Object> desiredResources,
18-
Map<String, ResourceSelector> resourceSelectors,
1916
List<Result> results) {
2017

18+
// @param resourceSelectors Map of the resource selectors for any extra resources
19+
// Map<String, ResourceSelector> resourceSelectors,
20+
2121

2222
/**
2323
* Create an empty response with all fields initiated
2424
*/
2525
public CrossplaneFunctionResponse() {
26-
this(new HashMap<>(), new HashMap<>(), new ArrayList<>());
26+
this(new HashMap<>(), new ArrayList<>());
2727
}
2828
}

0 commit comments

Comments
 (0)