Skip to content

Commit b94e873

Browse files
authored
Add support for sharing Service data via ConfigMap with OperandBindInfo (#993)
* added new type ServiceData as a Bindable Signed-off-by: Henry H Li <[email protected]> * added Service data copying to OperandBindInfo Signed-off-by: Henry H Li <[email protected]> * fixed incorrect comment referring to Route when copying Service Signed-off-by: Henry H Li <[email protected]> * added missing error handling when executing jsonpath parsing Signed-off-by: Henry H Li <[email protected]> * fixed sanitized service data value concatenating across multiple keys by re-initializing trueValue for each key in service datax Signed-off-by: Henry H Li <[email protected]> --------- Signed-off-by: Henry H Li <[email protected]>
1 parent 144e73b commit b94e873

11 files changed

+308
-15
lines changed

api/v1alpha1/operandbindinfo_types.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ type Bindable struct {
7272
// The configmap identifies an existing configmap object. if it exists, the ODLM will share to the namespace of the OperandRequest.
7373
// +optional
7474
Configmap string `json:"configmap,omitempty"`
75-
// Route data will shared by copying it into a configmap which is then
75+
// Route data will be shared by copying it into a configmap which is then
7676
// created in the target namespace
7777
// +optional
7878
Route *Route `json:"route,omitempty"`
79+
// Service data will be shared by copying it into a configmap which is then
80+
// created in the target namespace
81+
// +optional
82+
Service *ServiceData `json:"service,omitempty"`
7983
}
8084

8185
// Route represents the name and data inside an OpenShift route.
@@ -89,6 +93,17 @@ type Route struct {
8993
Data map[string]string `json:"data"`
9094
}
9195

96+
// ServiceData represents the name and data inside an Kubernetes Service.
97+
type ServiceData struct {
98+
// Name is the name of the Kubernetes Service resource
99+
// +optional
100+
Name string `json:"name"`
101+
// Data is a key-value pair where the value is a YAML path to a value in the
102+
// Kubernetes Service, e.g. .spec.ports[0]port
103+
// +optional
104+
Data map[string]string `json:"data"`
105+
}
106+
92107
// OperandBindInfoStatus defines the observed state of OperandBindInfo.
93108
type OperandBindInfoStatus struct {
94109
// Phase describes the overall phase of OperandBindInfo.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/operand-deployment-lifecycle-manager.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ metadata:
129129
categories: Developer Tools, Monitoring, Logging & Tracing, Security
130130
certified: "false"
131131
containerImage: icr.io/cpopen/odlm:latest
132-
createdAt: "2023-11-02T22:53:11Z"
132+
createdAt: "2023-11-03T17:30:05Z"
133133
description: The Operand Deployment Lifecycle Manager provides a Kubernetes CRD-based API to manage the lifecycle of operands.
134134
nss.operator.ibm.com/managed-operators: ibm-odlm
135135
olm.skipRange: '>=1.2.0 <4.2.1'

bundle/manifests/operator.ibm.com_operandbindinfos.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ spec:
6666
of the OperandRequest.
6767
type: string
6868
route:
69-
description: Route data will shared by copying it into a configmap
70-
which is then created in the target namespace
69+
description: Route data will be shared by copying it into a
70+
configmap which is then created in the target namespace
7171
properties:
7272
data:
7373
additionalProperties:
@@ -84,6 +84,22 @@ spec:
8484
description: The secret identifies an existing secret. if it
8585
exists, the ODLM will share to the namespace of the OperandRequest.
8686
type: string
87+
service:
88+
description: Service data will be shared by copying it into
89+
a configmap which is then created in the target namespace
90+
properties:
91+
data:
92+
additionalProperties:
93+
type: string
94+
description: Data is a key-value pair where the value is
95+
a YAML path to a value in the Kubernetes Service, e.g.
96+
.spec.ports[0]port
97+
type: object
98+
name:
99+
description: Name is the name of the Kubernetes Service
100+
resource
101+
type: string
102+
type: object
87103
type: object
88104
description: The bindings section is used to specify information about
89105
the access/configuration data that is to be shared.

bundle/manifests/operator.ibm.com_operandrequests.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ spec:
8989
share to the namespace of the OperandRequest.
9090
type: string
9191
route:
92-
description: Route data will shared by copying it
93-
into a configmap which is then created in the
92+
description: Route data will be shared by copying
93+
it into a configmap which is then created in the
9494
target namespace
9595
properties:
9696
data:
@@ -110,6 +110,23 @@ spec:
110110
if it exists, the ODLM will share to the namespace
111111
of the OperandRequest.
112112
type: string
113+
service:
114+
description: Service data will be shared by copying
115+
it into a configmap which is then created in the
116+
target namespace
117+
properties:
118+
data:
119+
additionalProperties:
120+
type: string
121+
description: Data is a key-value pair where
122+
the value is a YAML path to a value in the
123+
Kubernetes Service, e.g. .spec.ports[0]port
124+
type: object
125+
name:
126+
description: Name is the name of the Kubernetes
127+
Service resource
128+
type: string
129+
type: object
113130
type: object
114131
description: The bindings section is used to specify names
115132
of secret and/or configmap.

config/crd/bases/operator.ibm.com_operandbindinfos.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ spec:
6464
of the OperandRequest.
6565
type: string
6666
route:
67-
description: Route data will shared by copying it into a configmap
68-
which is then created in the target namespace
67+
description: Route data will be shared by copying it into a
68+
configmap which is then created in the target namespace
6969
properties:
7070
data:
7171
additionalProperties:
@@ -82,6 +82,22 @@ spec:
8282
description: The secret identifies an existing secret. if it
8383
exists, the ODLM will share to the namespace of the OperandRequest.
8484
type: string
85+
service:
86+
description: Service data will be shared by copying it into
87+
a configmap which is then created in the target namespace
88+
properties:
89+
data:
90+
additionalProperties:
91+
type: string
92+
description: Data is a key-value pair where the value is
93+
a YAML path to a value in the Kubernetes Service, e.g.
94+
.spec.ports[0]port
95+
type: object
96+
name:
97+
description: Name is the name of the Kubernetes Service
98+
resource
99+
type: string
100+
type: object
85101
type: object
86102
description: The bindings section is used to specify information about
87103
the access/configuration data that is to be shared.

config/crd/bases/operator.ibm.com_operandrequests.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ spec:
8787
share to the namespace of the OperandRequest.
8888
type: string
8989
route:
90-
description: Route data will shared by copying it
91-
into a configmap which is then created in the
90+
description: Route data will be shared by copying
91+
it into a configmap which is then created in the
9292
target namespace
9393
properties:
9494
data:
@@ -108,6 +108,23 @@ spec:
108108
if it exists, the ODLM will share to the namespace
109109
of the OperandRequest.
110110
type: string
111+
service:
112+
description: Service data will be shared by copying
113+
it into a configmap which is then created in the
114+
target namespace
115+
properties:
116+
data:
117+
additionalProperties:
118+
type: string
119+
description: Data is a key-value pair where
120+
the value is a YAML path to a value in the
121+
Kubernetes Service, e.g. .spec.ports[0]port
122+
type: object
123+
name:
124+
description: Name is the name of the Kubernetes
125+
Service resource
126+
type: string
127+
type: object
111128
type: object
112129
description: The bindings section is used to specify names
113130
of secret and/or configmap.

config/e2e/crd/bases/operator.ibm.com_operandbindinfos.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ spec:
6868
of the OperandRequest.
6969
type: string
7070
route:
71-
description: Route data will shared by copying it into a configmap
72-
which is then created in the target namespace
71+
description: Route data will be shared by copying it into a
72+
configmap which is then created in the target namespace
7373
properties:
7474
data:
7575
additionalProperties:
@@ -86,6 +86,22 @@ spec:
8686
description: The secret identifies an existing secret. if it
8787
exists, the ODLM will share to the namespace of the OperandRequest.
8888
type: string
89+
service:
90+
description: Service data will be shared by copying it into
91+
a configmap which is then created in the target namespace
92+
properties:
93+
data:
94+
additionalProperties:
95+
type: string
96+
description: Data is a key-value pair where the value is
97+
a YAML path to a value in the Kubernetes Service, e.g.
98+
.spec.ports[0]port
99+
type: object
100+
name:
101+
description: Name is the name of the Kubernetes Service
102+
resource
103+
type: string
104+
type: object
89105
type: object
90106
description: The bindings section is used to specify information about
91107
the access/configuration data that is to be shared.

config/e2e/crd/bases/operator.ibm.com_operandrequests.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ spec:
9191
share to the namespace of the OperandRequest.
9292
type: string
9393
route:
94-
description: Route data will shared by copying it
95-
into a configmap which is then created in the
94+
description: Route data will be shared by copying
95+
it into a configmap which is then created in the
9696
target namespace
9797
properties:
9898
data:
@@ -112,6 +112,23 @@ spec:
112112
if it exists, the ODLM will share to the namespace
113113
of the OperandRequest.
114114
type: string
115+
service:
116+
description: Service data will be shared by copying
117+
it into a configmap which is then created in the
118+
target namespace
119+
properties:
120+
data:
121+
additionalProperties:
122+
type: string
123+
description: Data is a key-value pair where
124+
the value is a YAML path to a value in the
125+
Kubernetes Service, e.g. .spec.ports[0]port
126+
type: object
127+
name:
128+
description: Name is the name of the Kubernetes
129+
Service resource
130+
type: string
131+
type: object
115132
type: object
116133
description: The bindings section is used to specify names
117134
of secret and/or configmap.

0 commit comments

Comments
 (0)