Skip to content

Commit

Permalink
Add support for sharing Service data via ConfigMap with OperandBindIn…
Browse files Browse the repository at this point in the history
…fo (#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]>
  • Loading branch information
bitscuit authored Nov 3, 2023
1 parent 144e73b commit b94e873
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 15 deletions.
17 changes: 16 additions & 1 deletion api/v1alpha1/operandbindinfo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ type Bindable struct {
// The configmap identifies an existing configmap object. if it exists, the ODLM will share to the namespace of the OperandRequest.
// +optional
Configmap string `json:"configmap,omitempty"`
// Route data will shared by copying it into a configmap which is then
// Route data will be shared by copying it into a configmap which is then
// created in the target namespace
// +optional
Route *Route `json:"route,omitempty"`
// Service data will be shared by copying it into a configmap which is then
// created in the target namespace
// +optional
Service *ServiceData `json:"service,omitempty"`
}

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

// ServiceData represents the name and data inside an Kubernetes Service.
type ServiceData struct {
// Name is the name of the Kubernetes Service resource
// +optional
Name string `json:"name"`
// Data is a key-value pair where the value is a YAML path to a value in the
// Kubernetes Service, e.g. .spec.ports[0]port
// +optional
Data map[string]string `json:"data"`
}

// OperandBindInfoStatus defines the observed state of OperandBindInfo.
type OperandBindInfoStatus struct {
// Phase describes the overall phase of OperandBindInfo.
Expand Down
27 changes: 27 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ metadata:
categories: Developer Tools, Monitoring, Logging & Tracing, Security
certified: "false"
containerImage: icr.io/cpopen/odlm:latest
createdAt: "2023-11-02T22:53:11Z"
createdAt: "2023-11-03T17:30:05Z"
description: The Operand Deployment Lifecycle Manager provides a Kubernetes CRD-based API to manage the lifecycle of operands.
nss.operator.ibm.com/managed-operators: ibm-odlm
olm.skipRange: '>=1.2.0 <4.2.1'
Expand Down
20 changes: 18 additions & 2 deletions bundle/manifests/operator.ibm.com_operandbindinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ spec:
of the OperandRequest.
type: string
route:
description: Route data will shared by copying it into a configmap
which is then created in the target namespace
description: Route data will be shared by copying it into a
configmap which is then created in the target namespace
properties:
data:
additionalProperties:
Expand All @@ -84,6 +84,22 @@ spec:
description: The secret identifies an existing secret. if it
exists, the ODLM will share to the namespace of the OperandRequest.
type: string
service:
description: Service data will be shared by copying it into
a configmap which is then created in the target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where the value is
a YAML path to a value in the Kubernetes Service, e.g.
.spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes Service
resource
type: string
type: object
type: object
description: The bindings section is used to specify information about
the access/configuration data that is to be shared.
Expand Down
21 changes: 19 additions & 2 deletions bundle/manifests/operator.ibm.com_operandrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ spec:
share to the namespace of the OperandRequest.
type: string
route:
description: Route data will shared by copying it
into a configmap which is then created in the
description: Route data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
Expand All @@ -110,6 +110,23 @@ spec:
if it exists, the ODLM will share to the namespace
of the OperandRequest.
type: string
service:
description: Service data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where
the value is a YAML path to a value in the
Kubernetes Service, e.g. .spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes
Service resource
type: string
type: object
type: object
description: The bindings section is used to specify names
of secret and/or configmap.
Expand Down
20 changes: 18 additions & 2 deletions config/crd/bases/operator.ibm.com_operandbindinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ spec:
of the OperandRequest.
type: string
route:
description: Route data will shared by copying it into a configmap
which is then created in the target namespace
description: Route data will be shared by copying it into a
configmap which is then created in the target namespace
properties:
data:
additionalProperties:
Expand All @@ -82,6 +82,22 @@ spec:
description: The secret identifies an existing secret. if it
exists, the ODLM will share to the namespace of the OperandRequest.
type: string
service:
description: Service data will be shared by copying it into
a configmap which is then created in the target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where the value is
a YAML path to a value in the Kubernetes Service, e.g.
.spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes Service
resource
type: string
type: object
type: object
description: The bindings section is used to specify information about
the access/configuration data that is to be shared.
Expand Down
21 changes: 19 additions & 2 deletions config/crd/bases/operator.ibm.com_operandrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ spec:
share to the namespace of the OperandRequest.
type: string
route:
description: Route data will shared by copying it
into a configmap which is then created in the
description: Route data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
Expand All @@ -108,6 +108,23 @@ spec:
if it exists, the ODLM will share to the namespace
of the OperandRequest.
type: string
service:
description: Service data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where
the value is a YAML path to a value in the
Kubernetes Service, e.g. .spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes
Service resource
type: string
type: object
type: object
description: The bindings section is used to specify names
of secret and/or configmap.
Expand Down
20 changes: 18 additions & 2 deletions config/e2e/crd/bases/operator.ibm.com_operandbindinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ spec:
of the OperandRequest.
type: string
route:
description: Route data will shared by copying it into a configmap
which is then created in the target namespace
description: Route data will be shared by copying it into a
configmap which is then created in the target namespace
properties:
data:
additionalProperties:
Expand All @@ -86,6 +86,22 @@ spec:
description: The secret identifies an existing secret. if it
exists, the ODLM will share to the namespace of the OperandRequest.
type: string
service:
description: Service data will be shared by copying it into
a configmap which is then created in the target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where the value is
a YAML path to a value in the Kubernetes Service, e.g.
.spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes Service
resource
type: string
type: object
type: object
description: The bindings section is used to specify information about
the access/configuration data that is to be shared.
Expand Down
21 changes: 19 additions & 2 deletions config/e2e/crd/bases/operator.ibm.com_operandrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ spec:
share to the namespace of the OperandRequest.
type: string
route:
description: Route data will shared by copying it
into a configmap which is then created in the
description: Route data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
Expand All @@ -112,6 +112,23 @@ spec:
if it exists, the ODLM will share to the namespace
of the OperandRequest.
type: string
service:
description: Service data will be shared by copying
it into a configmap which is then created in the
target namespace
properties:
data:
additionalProperties:
type: string
description: Data is a key-value pair where
the value is a YAML path to a value in the
Kubernetes Service, e.g. .spec.ports[0]port
type: object
name:
description: Name is the name of the Kubernetes
Service resource
type: string
type: object
type: object
description: The bindings section is used to specify names
of secret and/or configmap.
Expand Down
Loading

0 comments on commit b94e873

Please sign in to comment.