mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Makes odo work with v0.3.0 of Service Binding Operator (#4274)
* Makes odo work with v0.3.0 of Service Binding Operator * Self-review of documentation * Change from SBR to SB in integration test * Fix Group and Kind when checking for SB support
This commit is contained in:
42
docs/public/install-service-binding-operator.adoc
Normal file
42
docs/public/install-service-binding-operator.adoc
Normal file
@@ -0,0 +1,42 @@
|
||||
== Installing Service Binding Operator
|
||||
|
||||
This document walks you through the steps to install link:https://github.com/redhat-developer/service-binding-operator/tree/v0.3.0[Service Binding Operator v0.3.0] on OpenShift and Kubernetes clusters.
|
||||
|
||||
=== Why do I need the Service Binding Operator?
|
||||
|
||||
odo uses Service Binding Operator to provide the `odo link` feature which helps connect an odo component to a service or another component.
|
||||
|
||||
=== Installing Service Binding Operator on OpenShift
|
||||
|
||||
To install Service Binding Operator on OpenShift, refer link:https://www.youtube.com/watch?v=8QmewscQwHg[this video].
|
||||
|
||||
=== Installing Service Binding Operator on Kubernetes
|
||||
|
||||
Steps mentioned in this section were tested on link:https://minikube.sigs.k8s.io/[minikube]. We tested this on minikube v1.15.1 but it should work on v1.11.0 and above.
|
||||
|
||||
For Kubernetes, Service Binding Operator is not yet available via the OLM. The team is link:https://github.com/redhat-developer/service-binding-operator/issues/727[working on making it available].
|
||||
|
||||
To install the Operator, execute the following `kubectl` command:
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl apply -f https://gist.githubusercontent.com/dharmit/0e05be20e98c9271b2117acea7908cc2/raw/1e45fc89fc576e184e41fcc23e88d35f0e08a7e9/install.yaml
|
||||
----
|
||||
|
||||
You should now see a `Deployment` for Service Binding Operator in the `default` namespace:
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl get deploy -n default
|
||||
----
|
||||
|
||||
If you would like to install the Service Binding Operator in a different namespace, edit link:https://gist.github.com/dharmit/0e05be20e98c9271b2117acea7908cc2#file-install-yaml-L464[this line] by downloading the YAML mentioned in previous set to the namespace of your choice.
|
||||
|
||||
==== Making sure that Service Binding Operator got correctly installed
|
||||
|
||||
One way to make sure that the Operator installed properly is to verify that its link:https://kubernetes.io/docs/concepts/workloads/pods/[pod] started and is in "Running" state (note that you will have to specify the namespace where you installed Service Binding Operator in earlier step, and the pod name will be different in your setup than what's shown in below output):
|
||||
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl get pods --namespace default
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
service-binding-operator-6b7c654c89-rg9gq 1/1 Running 0 15m
|
||||
----
|
||||
@@ -1,4 +1,10 @@
|
||||
== Introduction to Operators
|
||||
== Creating and linking with Operator backed services
|
||||
|
||||
In this document we will go through what Operators are, how to create and delete services from the installed Operators, and how to link an odo component with an Operator backed service. We do this walking through an example Node.js application and linking it with an etcd key-value store.
|
||||
|
||||
NOTE: We will be updating our documentation with more examples of linking components to different kinds of Operator backed services in future.
|
||||
|
||||
=== Introduction to Operators
|
||||
|
||||
What is an Operator?
|
||||
|
||||
@@ -17,13 +23,13 @@ To install Operators on a Kubernetes cluster, contact your cluster administrator
|
||||
To install Operators on an OpenShift cluster, contact your cluster administrator or see the link:https://docs.openshift.com/container-platform/4.6/operators/admin/olm-adding-operators-to-cluster.html[OpenShift documentation].
|
||||
====
|
||||
|
||||
== Deploying your first Operator
|
||||
=== Deploying your first Operator
|
||||
|
||||
==== Prerequisites
|
||||
===== Prerequisites
|
||||
|
||||
* You must have cluster permissions to install an Operator on either link:https://docs.openshift.com/container-platform/latest/operators/olm-adding-operators-to-cluster.html[OpenShift] or link:https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/install/install.md[Kubernetes]. If you're running a link:https://minikube.sigs.k8s.io/docs/[minikube] cluster, you can refer link:operators-on-minikube.adoc[this guide] to install Operators required to run example mentioned in this document.
|
||||
|
||||
== Creating a project
|
||||
=== Creating a project
|
||||
|
||||
Create a project to keep your source code, tests, and libraries
|
||||
organized in a separate single unit.
|
||||
@@ -44,7 +50,7 @@ $ odo project create myproject
|
||||
✓ New project created and now using project : myproject
|
||||
----
|
||||
|
||||
== Installing an Operator
|
||||
=== Installing an Operator
|
||||
|
||||
In our examples, we install link:https://etcd.io/[etcd], a distributed key-value store from link:https://operatorhub.io/operator/etcd[Operator Hub].
|
||||
|
||||
@@ -54,15 +60,15 @@ Each Operator we install refers to the built-in `metadata.annotations.alm-exampl
|
||||
====
|
||||
|
||||
|
||||
=== Kubernetes installation
|
||||
==== Kubernetes installation
|
||||
|
||||
For Kubernetes installation, you must install the Operator Lifecycle Manager and etcd from the link:https://operatorhub.io/operator/etcd[etcd installation guide on Operator Hub].
|
||||
For Kubernetes installation, you must need to install the Operator Lifecycle Manager and etcd Operator from the link:https://operatorhub.io/operator/etcd[etcd installation guide on Operator Hub]. You can refer link:operators-on-minikube.adoc[this document] for steps setup Operator Lifecycle Manager and etcd Operator on a link:https://minikube.sigs.k8s.io/[minikube] cluster.
|
||||
|
||||
=== OpenShift installation
|
||||
==== OpenShift installation
|
||||
|
||||
For OpenShift installation, the etcd Operator can be installed through the link:https://docs.openshift.com/container-platform/latest/operators/olm-adding-operators-to-cluster.html[administrative console].
|
||||
|
||||
=== Listing all available Operators
|
||||
==== Listing all available Operators
|
||||
|
||||
Before deploying your first Operator, have a look at what is available:
|
||||
[source,sh]
|
||||
@@ -77,7 +83,7 @@ In above output, `etcdoperator.v0.9.4` is the Operator while `EtcdCluster`,
|
||||
`EtcdBackup` and `EtcdRestore` are the CRDs provided by this Operator.
|
||||
|
||||
|
||||
== Creating an Operator backed service
|
||||
=== Creating an Operator backed service
|
||||
|
||||
In this example, we will be deploying `EtcdCluster` service from link:https://operatorhub.io/operator/etcd[etcd Operator] to an OpenShift / Kubernetes cluster. This service is provided by the Operator `etcdoperator`. Please ensure that this Operator is installed on your OpenShift / Kubernetes cluster before trying to create `EtcdCluster` service from it. If it's not installed, please install it by logging into your OpenShift / Kubernetes cluster as `kube:admin` user.
|
||||
|
||||
@@ -97,7 +103,7 @@ $ odo service list
|
||||
|
||||
It is important to note that `EtcdBackup` and `EtcdRestore` cannot be deploymeed the same way as we deployed `EtcdCluster` as they require configuring other parameters in their YAML definition.
|
||||
|
||||
== Deploying Operator backed service to a cluster via YAML
|
||||
=== Deploying Operator backed service to a cluster via YAML
|
||||
|
||||
|
||||
In this example, we will be deploying our link:https://operatorhub.io/operator/etcd[installed etcd Operator] to an OpenShift / Kubernetes cluster.
|
||||
@@ -143,11 +149,11 @@ $ odo service create --from-file etcd.yaml
|
||||
$ odo service list
|
||||
----
|
||||
|
||||
== Linking an odo component with an Operator backed service
|
||||
=== Linking an odo component with an Operator backed service
|
||||
|
||||
Linking a component to a service means, in simplest terms, to make a service usable from the component.
|
||||
Linking a component to a service means, in simplest terms, to make a service usable from the component. odo uses link:https://github.com/redhat-developer/service-binding-operator/tree/v0.3.0[Service Binding Operator v0.3.0] to provide the linking feature. Please refer link:install-service-binding-operator.adoc[this document] to install it on OpenShift or Kubernetes.
|
||||
|
||||
For example, once you link an EtcdCluster service with your nodejs application, you can use (or, interact with) the EtcdCluster from within your node app. The way odo facilitates linking is by making sure that specific environment variables from the pod in which the service is running are configured in the pod of the component as well.
|
||||
For example, once you link an EtcdCluster service with your Node.js application, you can use (or, interact with) the EtcdCluster from within your node app. The way odo facilitates linking is by making sure that specific environment variables from the pod in which the service is running are configured in the pod of the component as well.
|
||||
|
||||
After having created a service using either of the two approaches discussed above, we can now connect an odo component with the service thus created.
|
||||
|
||||
@@ -174,10 +180,12 @@ $ odo push
|
||||
For the link between a component and Operator Hub backed service to take effect, make sure you do `odo push`. The link won't be effective otherwise.
|
||||
====
|
||||
|
||||
== Unlinking an odo component from an Operator backed service
|
||||
=== Unlinking an odo component from an Operator backed service
|
||||
|
||||
Unlinking unsets the environment variables that were set by linking. This would cause your application to cease being able to communicate with the service linked using `odo link`.
|
||||
|
||||
IMPORTANT: `odo unlink` doesn't work on a cluster other than OpenShift (that is, minikube, or vanilla Kubernetes, etc.) because Service Binding Operator cannot be setup the OLM way (that is, we cannot list it by doing `odo catalog list services` or `kubectl get csv` like we can do for etcd Operator in this document). We are link:https://github.com/redhat-developer/service-binding-operator/issues/623[working making this possible].
|
||||
|
||||
. Make sure you are executing the command for a component that's pushed (`odo push`) to the cluster.
|
||||
|
||||
. Unlink the component from the service it is connected to:
|
||||
@@ -197,7 +205,7 @@ $ odo push
|
||||
For unlinking to take effect, make sure you do `odo push`. It won't be effective otherwise.
|
||||
====
|
||||
|
||||
== Deleting an Operator backed service
|
||||
=== Deleting an Operator backed service
|
||||
|
||||
To delete an Operator backed service, provide full name of the service that you see in the output of `odo service list`. For example:
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ In this guide, we will discuss installing two Operators on a minikube environmen
|
||||
. etcd Operator
|
||||
. Service Binding Operator
|
||||
|
||||
NOTE: We will be updating our documentation with steps to install and work with more Operators in future.
|
||||
|
||||
=== Prerequisites
|
||||
|
||||
You must enable the `olm` addon for your minikube cluster by doing:
|
||||
@@ -70,7 +72,7 @@ spec:
|
||||
EOF
|
||||
----
|
||||
|
||||
Give it a few seconds before checking the availability of the etcd Operator:
|
||||
Give it a few seconds before checking the availability of the etcd Operator. odo lists only those Operators which are successfully installed on the cluster. If an Operator failed to install or is getting installed (that is, its status is `Installing`), odo won't list it. This is to prevent accidental creation of service(s) from an Operator that is not yet availabe for use:
|
||||
[source,sh]
|
||||
----
|
||||
$ odo catalog list services
|
||||
@@ -87,7 +89,7 @@ If you don't see etcd Operator using above command or by doing `kubectl get csv
|
||||
$ kubectl get po -n olm | grep operatorhubio-catalog
|
||||
----
|
||||
|
||||
If the state of this pod is `CrashLoopBackOff`, delete it so that Kubernetes will automatically spin up a new pod for the `CatalogSource`:
|
||||
If the state of this pod is `CrashLoopBackOff` or `NodeAffinity`, delete it so that Kubernetes will automatically spin up a new pod for the `CatalogSource`:
|
||||
|
||||
[source,sh]
|
||||
----
|
||||
@@ -98,30 +100,4 @@ Once the pod for this `CatalogSource` is up, wait a few seconds before trying to
|
||||
|
||||
=== Installing the Service Binding Operator
|
||||
|
||||
odo uses the link:https://github.com/redhat-developer/service-binding-operator/[Service Binding Operator] to provide `odo link` feature which links an odo component with an Operator backed service. Thus, to be able to use this feature, it's essential that we install the Operator first.
|
||||
|
||||
Service Binding Operator is not yet available via the OLM. The team is link:https://github.com/redhat-developer/service-binding-operator/issues/727[working on making it available] through OLM.
|
||||
|
||||
To install the Operator, execute the following `kubectl` command:
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl apply -f https://github.com/redhat-developer/service-binding-operator/releases/download/v0.1.1-364/install-v0.1.1-364.yaml
|
||||
----
|
||||
|
||||
You should now see a `Deployment` for Service Binding Operator in the namespace where you installed it:
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl get deploy -n <replace-namespace-value>
|
||||
----
|
||||
|
||||
==== Troubleshooting
|
||||
|
||||
If linking doesn't work after installing the Service Binding Operator as described above, please open an issue on the odo repository describing the issue. On the issue, please provide the logs of the `Pod` created by the `Deployment` of Service Binding Operator. Execute below command in the namespace where you installed Service Binding Operator (note that `Pod` name will be different in your environment than what's shown below):
|
||||
[source,sh]
|
||||
----
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
service-binding-operator-65745c4bdc-gc6km 1/1 Running 0 34m
|
||||
|
||||
$ kubectl logs service-binding-operator-65745c4bdc-gc6km --follow
|
||||
----
|
||||
Service Binding Operator is used by odo to provide `odo link` feature. Please refer link:install-service-binding-operator.adoc[this document] to install it on both OpenShift and Kubernetes.
|
||||
2
go.mod
2
go.mod
@@ -39,7 +39,7 @@ require (
|
||||
github.com/operator-framework/operator-lifecycle-manager v0.0.0-20200422144016-a6acf50218ed
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/posener/complete v1.1.2
|
||||
github.com/redhat-developer/service-binding-operator v0.1.1
|
||||
github.com/redhat-developer/service-binding-operator v0.3.0
|
||||
github.com/spf13/afero v1.2.2
|
||||
github.com/spf13/cobra v0.0.5
|
||||
github.com/spf13/pflag v1.0.5
|
||||
|
||||
2
go.sum
2
go.sum
@@ -897,6 +897,8 @@ github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/redhat-developer/service-binding-operator v0.1.1 h1:HsJlqFkAjBgKedg3os9XALjKHqyqQpjZJ7Z+XMgS9Ik=
|
||||
github.com/redhat-developer/service-binding-operator v0.1.1/go.mod h1:gc/ns7SpvoPSdy9uqp5Abwqm2jNLjzzExul2Nx5wuGQ=
|
||||
github.com/redhat-developer/service-binding-operator v0.3.0 h1:79FuZinHtInpC5NYmDREiKK8DxmXV1L28OSzENtg8tA=
|
||||
github.com/redhat-developer/service-binding-operator v0.3.0/go.mod h1:FQgDVBuBvln4TRlPQcTxTnNuJSIhNv3Z/xsMvalLaqo=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||
github.com/robfig/cron v0.0.0-20170526150127-736158dc09e1/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
|
||||
@@ -12,16 +12,16 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoSuchOperator = errors.New("Could not find specified operator")
|
||||
ErrNoSuchOperator = errors.New("could not find specified operator")
|
||||
)
|
||||
|
||||
const (
|
||||
apiVersion = "odo.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// IsSBRSupported checks if resource of type service binding request present on the cluster
|
||||
func (c *Client) IsSBRSupported() (bool, error) {
|
||||
return c.IsResourceSupported("apps.openshift.io", "v1alpha1", "servicebindingrequests")
|
||||
// IsServiceBindingSupported checks if resource of type service binding request present on the cluster
|
||||
func (c *Client) IsServiceBindingSupported() (bool, error) {
|
||||
return c.IsResourceSupported("operators.coreos.com", "v1alpha1", "servicebindings")
|
||||
}
|
||||
|
||||
// IsCSVSupported checks if resource of type service binding request present on the cluster
|
||||
@@ -109,7 +109,7 @@ func (c *Client) GetCustomResource(customResource string) (*olm.CRDDescription,
|
||||
}
|
||||
}
|
||||
|
||||
return &olm.CRDDescription{}, fmt.Errorf("Couldn't find a Custom Resource named %q in the namespace", customResource)
|
||||
return &olm.CRDDescription{}, fmt.Errorf("could not find a Custom Resource named %q in the namespace", customResource)
|
||||
}
|
||||
|
||||
// GetCSVWithCR returns the CSV (Operator) that contains the CR (service)
|
||||
@@ -127,5 +127,5 @@ func (c *Client) GetCSVWithCR(name string) (*olm.ClusterServiceVersion, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return &olm.ClusterServiceVersion{}, fmt.Errorf("Could not find any Operator containing requested CR: %s", name)
|
||||
return &olm.ClusterServiceVersion{}, fmt.Errorf("could not find any Operator containing requested CR: %s", name)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/openshift/odo/pkg/secret"
|
||||
svc "github.com/openshift/odo/pkg/service"
|
||||
"github.com/openshift/odo/pkg/util"
|
||||
sbo "github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1"
|
||||
servicebinding "github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1"
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -25,10 +25,10 @@ import (
|
||||
var (
|
||||
// Hardcoded variables since we can't install SBO on k8s using OLM
|
||||
// (https://github.com/redhat-developer/service-binding-operator/issues/536)
|
||||
sbrGroup = "apps.openshift.io"
|
||||
sbrVersion = "v1alpha1"
|
||||
sbrKind = "ServiceBindingRequest"
|
||||
sbrResource = "servicebindingrequests"
|
||||
serviceBindingGroup = "operators.coreos.com"
|
||||
serviceBindingVersion = "v1alpha1"
|
||||
serviceBindingKind = "ServiceBinding"
|
||||
serviceBindingResource = "servicebindings"
|
||||
)
|
||||
|
||||
const unlink = "unlink"
|
||||
@@ -46,9 +46,9 @@ type commonLinkOptions struct {
|
||||
operationName string
|
||||
|
||||
// Service Binding Operator options
|
||||
sbr *sbo.ServiceBindingRequest
|
||||
serviceType string
|
||||
serviceName string
|
||||
serviceBinding *servicebinding.ServiceBinding
|
||||
serviceType string
|
||||
serviceName string
|
||||
*genericclioptions.Context
|
||||
// choose between Operator Hub and Service Catalog. If true, Operator Hub
|
||||
csvSupport bool
|
||||
@@ -84,13 +84,13 @@ func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []str
|
||||
}
|
||||
|
||||
if o.csvSupport && o.Context.EnvSpecificInfo != nil {
|
||||
sboSupport, err := o.Client.GetKubeClient().IsSBRSupported()
|
||||
serviceBindingSupport, err := o.Client.GetKubeClient().IsServiceBindingSupported()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !sboSupport {
|
||||
return fmt.Errorf("please install Service Binding Operator to be able to create/delete a link")
|
||||
if !serviceBindingSupport {
|
||||
return fmt.Errorf("please install Service Binding Operator to be able to create/delete a link\nrefer https://odo.dev/docs/install-service-binding-operator")
|
||||
}
|
||||
|
||||
o.serviceType, o.serviceName, err = svc.IsOperatorServiceNameValid(suppliedName)
|
||||
@@ -106,13 +106,14 @@ func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []str
|
||||
componentName := o.EnvSpecificInfo.GetName()
|
||||
|
||||
// Assign static/hardcoded values to SBR
|
||||
o.sbr.Kind = sbrKind
|
||||
o.sbr.APIVersion = strings.Join([]string{sbrGroup, sbrVersion}, "/")
|
||||
o.serviceBinding.Kind = serviceBindingKind
|
||||
o.serviceBinding.APIVersion = strings.Join([]string{serviceBindingGroup, serviceBindingVersion}, "/")
|
||||
|
||||
// service binding request name will be like <component-name>-<service-type>-<service-name>. For example: nodejs-etcdcluster-example
|
||||
o.sbr.Name = getSBRName(componentName, o.serviceType, o.serviceName)
|
||||
o.sbr.Namespace = o.EnvSpecificInfo.GetNamespace()
|
||||
o.sbr.Spec.DetectBindingResources = true // because we want the operator what to bind from the service
|
||||
o.serviceBinding.Name = getServiceBindingName(componentName, o.serviceType, o.serviceName)
|
||||
o.serviceBinding.Namespace = o.EnvSpecificInfo.GetNamespace()
|
||||
truePtr := true
|
||||
o.serviceBinding.Spec.DetectBindingResources = &truePtr // because we want the operator what to bind from the service
|
||||
|
||||
deployment, err := o.KClient.GetDeploymentByName(componentName)
|
||||
if err != nil {
|
||||
@@ -121,7 +122,7 @@ func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []str
|
||||
|
||||
// make this deployment the owner of the link we're creating so that link gets deleted upon doing "odo delete"
|
||||
ownerReference := generator.GetOwnerReference(deployment)
|
||||
o.sbr.SetOwnerReferences(append(o.sbr.GetOwnerReferences(), ownerReference))
|
||||
o.serviceBinding.SetOwnerReferences(append(o.serviceBinding.GetOwnerReferences(), ownerReference))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -131,14 +132,14 @@ func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []str
|
||||
deploymentSelfLinkSplit := strings.Split(deployment.SelfLink, "/")
|
||||
|
||||
// Populate the application selector field in service binding request
|
||||
o.sbr.Spec.ApplicationSelector = sbo.ApplicationSelector{
|
||||
o.serviceBinding.Spec.Application = &servicebinding.Application{
|
||||
GroupVersionResource: metav1.GroupVersionResource{
|
||||
Group: deploymentSelfLinkSplit[2], // "apps" in above example output
|
||||
Version: deploymentSelfLinkSplit[3], // "v1" in above example output
|
||||
Resource: deploymentSelfLinkSplit[6], // "deployments" in above example output
|
||||
},
|
||||
ResourceRef: componentName,
|
||||
}
|
||||
o.serviceBinding.Spec.Application.Name = componentName
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -192,25 +193,25 @@ func (o *commonLinkOptions) validate(wait bool) (err error) {
|
||||
|
||||
if o.operationName == unlink {
|
||||
componentName := o.EnvSpecificInfo.GetName()
|
||||
sbrName := getSBRName(componentName, o.serviceType, o.serviceName)
|
||||
serviceBindingName := getServiceBindingName(componentName, o.serviceType, o.serviceName)
|
||||
links := o.EnvSpecificInfo.GetLink()
|
||||
|
||||
linked := isComponentLinked(sbrName, links)
|
||||
linked := isComponentLinked(serviceBindingName, links)
|
||||
if !linked {
|
||||
// user's trying to unlink a service that's not linked with the component
|
||||
return fmt.Errorf("failed to unlink the service %q since it's not linked with the component %q", svcFullName, componentName)
|
||||
}
|
||||
|
||||
// Verify if the underlying service binding request actually exists
|
||||
sbrSvcFullName := strings.Join([]string{sbrKind, sbrName}, "/")
|
||||
sbrExists, err := svc.OperatorSvcExists(o.KClient, sbrSvcFullName)
|
||||
serviceBindingSvcFullName := strings.Join([]string{serviceBindingKind, serviceBindingName}, "/")
|
||||
serviceBindingExists, err := svc.OperatorSvcExists(o.KClient, serviceBindingSvcFullName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !sbrExists {
|
||||
// This could have happened if the service binding request was deleted outside odo workflow (eg: oc delete sbr/<sbr-name>)
|
||||
if !serviceBindingExists {
|
||||
// This could have happened if the service binding was deleted outside odo workflow (eg: oc delete sb/<sb-name>)
|
||||
// we must remove entry of the link from env.yaml in this case
|
||||
err = o.Context.EnvSpecificInfo.DeleteLink(sbrName)
|
||||
err = o.Context.EnvSpecificInfo.DeleteLink(serviceBindingName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("component's link with %q has been deleted outside odo; unable to delete odo's state of the link", svcFullName)
|
||||
}
|
||||
@@ -232,15 +233,16 @@ func (o *commonLinkOptions) validate(wait bool) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
o.sbr.Spec.BackingServiceSelector = &sbo.BackingServiceSelector{
|
||||
service := servicebinding.Service{
|
||||
GroupVersionKind: metav1.GroupVersionKind{
|
||||
Group: group,
|
||||
Version: version,
|
||||
Kind: kind,
|
||||
},
|
||||
ResourceRef: o.serviceName,
|
||||
Namespace: &o.KClient.Namespace,
|
||||
Namespace: &o.KClient.Namespace,
|
||||
}
|
||||
service.Name = o.serviceName
|
||||
o.serviceBinding.Spec.Services = &[]servicebinding.Service{service}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -265,7 +267,7 @@ func (o *commonLinkOptions) validate(wait bool) (err error) {
|
||||
// the secret should have been created along with the secret
|
||||
_, err = o.Client.GetKubeClient().GetSecret(o.secretName, o.Project)
|
||||
if err != nil {
|
||||
return fmt.Errorf("The service %s created by 'odo service create' is being provisioned. You may have to wait a few seconds until OpenShift fully provisions it before executing 'odo %s'.", o.secretName, o.operationName)
|
||||
return fmt.Errorf("The service %s created by 'odo service create' is being provisioned. You may have to wait a few seconds until OpenShift fully provisions it before executing 'odo %s'", o.secretName, o.operationName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,14 +278,14 @@ func (o *commonLinkOptions) validate(wait bool) (err error) {
|
||||
func (o *commonLinkOptions) run() (err error) {
|
||||
if o.csvSupport && o.Context.EnvSpecificInfo != nil {
|
||||
if o.operationName == unlink {
|
||||
sbrName := getSBRName(o.EnvSpecificInfo.GetName(), o.serviceType, o.serviceName)
|
||||
svcFullName := getSvcFullName(sbrKind, sbrName)
|
||||
serviceBindingName := getServiceBindingName(o.EnvSpecificInfo.GetName(), o.serviceType, o.serviceName)
|
||||
svcFullName := getSvcFullName(serviceBindingKind, serviceBindingName)
|
||||
err = svc.DeleteServiceBindingRequest(o.KClient, svcFullName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = o.Context.EnvSpecificInfo.DeleteLink(sbrName)
|
||||
err = o.Context.EnvSpecificInfo.DeleteLink(serviceBindingName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -296,19 +298,19 @@ func (o *commonLinkOptions) run() (err error) {
|
||||
|
||||
// convert service binding request into a ma[string]interface{} type so
|
||||
// as to use it with dynamic client
|
||||
sbrMap := make(map[string]interface{})
|
||||
inrec, _ := json.Marshal(o.sbr)
|
||||
err = json.Unmarshal(inrec, &sbrMap)
|
||||
serviceBindingMap := make(map[string]interface{})
|
||||
intermediate, _ := json.Marshal(o.serviceBinding)
|
||||
err = json.Unmarshal(intermediate, &serviceBindingMap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// this creates a link by creating a service of type
|
||||
// "ServiceBindingRequest" from the Operator "ServiceBindingOperator".
|
||||
err = o.KClient.CreateDynamicResource(sbrMap, sbrGroup, sbrVersion, sbrResource)
|
||||
err = o.KClient.CreateDynamicResource(serviceBindingMap, serviceBindingGroup, serviceBindingVersion, serviceBindingResource)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "already exists") {
|
||||
return fmt.Errorf("component %q is already linked with the service %q\n", o.Context.EnvSpecificInfo.GetName(), o.suppliedName)
|
||||
return fmt.Errorf("component %q is already linked with the service %q", o.Context.EnvSpecificInfo.GetName(), o.suppliedName)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -316,7 +318,7 @@ func (o *commonLinkOptions) run() (err error) {
|
||||
// once the link is created, we need to store the information in
|
||||
// env.yaml so that subsequent odo push can create a new deployment
|
||||
// based on it
|
||||
err = o.Context.EnvSpecificInfo.SetConfiguration("link", envinfo.EnvInfoLink{Name: o.sbr.Name, ServiceKind: o.serviceType, ServiceName: o.serviceName})
|
||||
err = o.Context.EnvSpecificInfo.SetConfiguration("link", envinfo.EnvInfoLink{Name: o.serviceBinding.Name, ServiceKind: o.serviceType, ServiceName: o.serviceName})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -430,16 +432,16 @@ func getSvcFullName(serviceType, serviceName string) string {
|
||||
return strings.Join([]string{serviceType, serviceName}, "/")
|
||||
}
|
||||
|
||||
// getSBRName creates a name to be used for creation/deletion of SBR during link/unlink operations
|
||||
func getSBRName(componentName, serviceType, serviceName string) string {
|
||||
// getServiceBindingName creates a name to be used for creation/deletion of SBR during link/unlink operations
|
||||
func getServiceBindingName(componentName, serviceType, serviceName string) string {
|
||||
return strings.Join([]string{componentName, strings.ToLower(serviceType), serviceName}, "-")
|
||||
}
|
||||
|
||||
// isComponentLinked checks if link with "sbrName" exists in the component's
|
||||
// isComponentLinked checks if link with "serviceBindingName" exists in the component's
|
||||
// config. It confirms if the component is linked with the service
|
||||
func isComponentLinked(sbrName string, links []envinfo.EnvInfoLink) bool {
|
||||
func isComponentLinked(serviceBindingName string, links []envinfo.EnvInfoLink) bool {
|
||||
for _, link := range links {
|
||||
if link.Name == sbrName {
|
||||
if link.Name == serviceBindingName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/openshift/odo/pkg/odo/genericclioptions"
|
||||
odoutil "github.com/openshift/odo/pkg/odo/util"
|
||||
svc "github.com/openshift/odo/pkg/service"
|
||||
sbo "github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1"
|
||||
servicebinding "github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1"
|
||||
|
||||
appCmd "github.com/openshift/odo/pkg/odo/cli/application"
|
||||
projectCmd "github.com/openshift/odo/pkg/odo/cli/project"
|
||||
@@ -89,7 +89,7 @@ func NewLinkOptions() *LinkOptions {
|
||||
options := LinkOptions{}
|
||||
options.commonLinkOptions = newCommonLinkOptions()
|
||||
options.commonLinkOptions.csvSupport, _ = svc.IsCSVSupported()
|
||||
options.commonLinkOptions.sbr = &sbo.ServiceBindingRequest{}
|
||||
options.commonLinkOptions.serviceBinding = &servicebinding.ServiceBinding{}
|
||||
return &options
|
||||
}
|
||||
|
||||
@@ -102,11 +102,6 @@ func (o *LinkOptions) Complete(name string, cmd *cobra.Command, args []string) (
|
||||
return err
|
||||
}
|
||||
|
||||
o.csvSupport, err = o.Client.GetKubeClient().IsCSVSupported()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if o.csvSupport && o.Context.EnvSpecificInfo != nil {
|
||||
o.operation = o.KClient.LinkSecret
|
||||
} else {
|
||||
|
||||
@@ -24,15 +24,17 @@ install_service_binding_operator(){
|
||||
apiVersion: operators.coreos.com/v1alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: service-binding-operator
|
||||
labels:
|
||||
operators.coreos.com/rh-service-binding-operator.openshift-operators: ""
|
||||
name: rh-service-binding-operator
|
||||
namespace: openshift-operators
|
||||
spec:
|
||||
channel: alpha
|
||||
channel: beta
|
||||
installPlanApproval: Automatic
|
||||
name: service-binding-operator
|
||||
source: community-operators
|
||||
name: rh-service-binding-operator
|
||||
source: redhat-operators
|
||||
sourceNamespace: openshift-marketplace
|
||||
startingCSV: service-binding-operator.v0.1.1-364
|
||||
startingCSV: service-binding-operator.v0.3.0
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ spec:
|
||||
// next, delete a link outside of odo (using oc) and ensure that it throws an error
|
||||
helper.CmdShouldPass("odo", "link", "EtcdCluster/example")
|
||||
sbrName := strings.Join([]string{componentName, "etcdcluster", "example"}, "-")
|
||||
helper.CmdShouldPass("oc", "delete", fmt.Sprintf("ServiceBindingRequest/%s", sbrName))
|
||||
helper.CmdShouldPass("oc", "delete", fmt.Sprintf("ServiceBinding/%s", sbrName))
|
||||
stdOut = helper.CmdShouldFail("odo", "unlink", "EtcdCluster/example")
|
||||
helper.MatchAllInOutput(stdOut, []string{"component's link with", "has been deleted outside odo"})
|
||||
})
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
|
||||
|
||||
// ServiceBindingRequestSpec defines the desired state of ServiceBindingRequest
|
||||
type ServiceBindingRequestSpec struct {
|
||||
// MountPathPrefix is the prefix for volume mount
|
||||
// +optional
|
||||
MountPathPrefix string `json:"mountPathPrefix,omitempty"`
|
||||
|
||||
// EnvVarPrefix is the prefix for environment variables
|
||||
// +optional
|
||||
EnvVarPrefix string `json:"envVarPrefix,omitempty"`
|
||||
|
||||
// Custom env variables
|
||||
// +optional
|
||||
CustomEnvVar []corev1.EnvVar `json:"customEnvVar,omitempty"`
|
||||
|
||||
// BackingServiceSelector is used to identify the backing service operator.
|
||||
// Deprecation Notice:
|
||||
// In the upcoming release, this field would be depcreated. It would be mandatory
|
||||
// to set "backingServiceSelectors".
|
||||
// +optional
|
||||
BackingServiceSelector *BackingServiceSelector `json:"backingServiceSelector,omitempty"`
|
||||
|
||||
// BackingServiceSelectors is used to identify multiple backing services.
|
||||
// This would be made a required field after 'BackingServiceSelector'
|
||||
// is removed.
|
||||
// +optional
|
||||
BackingServiceSelectors *[]BackingServiceSelector `json:"backingServiceSelectors,omitempty"`
|
||||
|
||||
// ApplicationSelector is used to identify the application connecting to the
|
||||
// backing service operator.
|
||||
// +optional
|
||||
ApplicationSelector ApplicationSelector `json:"applicationSelector"`
|
||||
|
||||
// DetectBindingResources is flag used to bind all non-bindable variables from
|
||||
// different subresources owned by backing operator CR.
|
||||
// +optional
|
||||
DetectBindingResources bool `json:"detectBindingResources,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceBindingRequestStatus defines the observed state of ServiceBindingRequest
|
||||
// +k8s:openapi-gen=true
|
||||
type ServiceBindingRequestStatus struct {
|
||||
// Conditions describes the state of the operator's reconciliation functionality.
|
||||
Conditions []conditionsv1.Condition `json:"conditions"`
|
||||
// Secret is the name of the intermediate secret
|
||||
Secret string `json:"secret"`
|
||||
// Applications contain all the applications filtered by name or label
|
||||
// +optional
|
||||
Applications []BoundApplication `json:"applications,omitempty"`
|
||||
}
|
||||
|
||||
// BackingServiceSelector defines the selector based on resource name, version, and resource kind
|
||||
type BackingServiceSelector struct {
|
||||
metav1.GroupVersionKind `json:",inline"`
|
||||
ResourceRef string `json:"resourceRef"`
|
||||
// +optional
|
||||
Namespace *string `json:"namespace,omitempty"`
|
||||
EnvVarPrefix *string `json:"envVarPrefix,omitempty"`
|
||||
}
|
||||
|
||||
// BoundApplication defines the application workloads to which the binding secret has
|
||||
// injected.
|
||||
type BoundApplication struct {
|
||||
metav1.GroupVersionKind `json:",inline"`
|
||||
corev1.LocalObjectReference `json:",inline"`
|
||||
}
|
||||
|
||||
// ApplicationSelector defines the selector based on labels and GVR
|
||||
type ApplicationSelector struct {
|
||||
// +optional
|
||||
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
|
||||
metav1.GroupVersionResource `json:",inline"`
|
||||
ResourceRef string `json:"resourceRef,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ServiceBindingRequest expresses intent to bind an operator-backed service with
|
||||
// an application workload.
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Service Binding Request"
|
||||
// +kubebuilder:resource:path=servicebindingrequests,shortName=sbr;sbrs
|
||||
type ServiceBindingRequest struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ServiceBindingRequestSpec `json:"spec,omitempty"`
|
||||
Status ServiceBindingRequestStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ServiceBindingRequestList contains a list of ServiceBindingRequest
|
||||
type ServiceBindingRequestList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []ServiceBindingRequest `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ServiceBindingRequest{}, &ServiceBindingRequestList{})
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
// NOTE: Boilerplate only. Ignore this file.
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group
|
||||
// Package v1alpha1 contains API Schema definitions for the operators v1alpha1 API group
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=apps.openshift.io
|
||||
// +groupName=operators.coreos.com
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "apps.openshift.io", Version: "v1alpha1"}
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "operators.coreos.com", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
142
vendor/github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1/servicebinding_types.go
generated
vendored
Normal file
142
vendor/github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1/servicebinding_types.go
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
|
||||
|
||||
// ServiceBindingSpec defines the desired state of ServiceBinding
|
||||
type ServiceBindingSpec struct {
|
||||
// MountPathPrefix is the prefix for volume mount
|
||||
// +optional
|
||||
MountPathPrefix string `json:"mountPathPrefix,omitempty"`
|
||||
|
||||
// EnvVarPrefix is the prefix for environment variables
|
||||
// +optional
|
||||
EnvVarPrefix string `json:"envVarPrefix,omitempty"`
|
||||
|
||||
// Custom env variables
|
||||
// +optional
|
||||
CustomEnvVar []corev1.EnvVar `json:"customEnvVar,omitempty"`
|
||||
|
||||
// Services is used to identify multiple backing services.
|
||||
Services *[]Service `json:"services,omitempty"`
|
||||
|
||||
// Application is used to identify the application connecting to the
|
||||
// backing service operator.
|
||||
// +optional
|
||||
Application *Application `json:"application"`
|
||||
|
||||
// DetectBindingResources is flag used to bind all non-bindable variables from
|
||||
// different subresources owned by backing operator CR.
|
||||
// +optional
|
||||
DetectBindingResources *bool `json:"detectBindingResources,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceBindingStatus defines the observed state of ServiceBinding
|
||||
// +k8s:openapi-gen=true
|
||||
type ServiceBindingStatus struct {
|
||||
// Conditions describes the state of the operator's reconciliation functionality.
|
||||
Conditions []conditionsv1.Condition `json:"conditions"`
|
||||
// Secret is the name of the intermediate secret
|
||||
Secret string `json:"secret"`
|
||||
// Applications contain all the applications filtered by name or label
|
||||
// +optional
|
||||
Applications []BoundApplication `json:"applications,omitempty"`
|
||||
}
|
||||
|
||||
// Service defines the selector based on resource name, version, and resource kind
|
||||
type Service struct {
|
||||
metav1.GroupVersionKind `json:",inline"`
|
||||
corev1.LocalObjectReference `json:",inline"`
|
||||
|
||||
// +optional
|
||||
Namespace *string `json:"namespace,omitempty"`
|
||||
EnvVarPrefix *string `json:"envVarPrefix,omitempty"`
|
||||
Id *string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// BoundApplication defines the application workloads to which the binding secret has
|
||||
// injected.
|
||||
type BoundApplication struct {
|
||||
metav1.GroupVersionKind `json:",inline"`
|
||||
corev1.LocalObjectReference `json:",inline"`
|
||||
}
|
||||
|
||||
// Application defines the selector based on labels and GVR
|
||||
type Application struct {
|
||||
corev1.LocalObjectReference `json:",inline"`
|
||||
// +optional
|
||||
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
|
||||
metav1.GroupVersionResource `json:",inline"`
|
||||
|
||||
// BindingPath refers to the paths in the application workload's schema
|
||||
// where the binding workload would be referenced.
|
||||
// If BindingPath is not specified the default path locations is going to
|
||||
// be used. The default location for ContainersPath is
|
||||
// going to be: "spec.template.spec.containers" and if SecretPath
|
||||
// is not specified, the name of the secret object is not going
|
||||
// to be specified.
|
||||
// +optional
|
||||
BindingPath *BindingPath `json:"bindingPath,omitempty"`
|
||||
}
|
||||
|
||||
// BindingPath defines the path to the field where the binding would be
|
||||
// embedded in the workload
|
||||
type BindingPath struct {
|
||||
// ContainersPath defines the path to the corev1.Containers reference
|
||||
// If BindingPath is not specified, the default location is
|
||||
// going to be: "spec.template.spec.containers"
|
||||
// +optional
|
||||
ContainersPath string `json:"containersPath"`
|
||||
|
||||
// SecretPath defines the path to a string field where
|
||||
// the name of the secret object is going to be assigned.
|
||||
// Note: The name of the secret object is same as that of the name of SBR CR (metadata.name)
|
||||
// +optional
|
||||
SecretPath string `json:"secretPath"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ServiceBinding expresses intent to bind an operator-backed service with
|
||||
// an application workload.
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Service Binding"
|
||||
// +kubebuilder:resource:path=servicebindings,shortName=sbr;sbrs
|
||||
type ServiceBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ServiceBindingSpec `json:"spec,omitempty"`
|
||||
Status ServiceBindingStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ServiceBindingList contains a list of ServiceBinding
|
||||
type ServiceBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []ServiceBinding `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ServiceBinding{}, &ServiceBindingList{})
|
||||
}
|
||||
|
||||
func (sbr ServiceBinding) AsOwnerReference() metav1.OwnerReference {
|
||||
var ownerRefController bool = true
|
||||
return metav1.OwnerReference{
|
||||
Name: sbr.Name,
|
||||
UID: sbr.UID,
|
||||
Kind: sbr.Kind,
|
||||
APIVersion: sbr.APIVersion,
|
||||
Controller: &ownerRefController,
|
||||
}
|
||||
}
|
||||
@@ -28,45 +28,45 @@ import (
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationSelector) DeepCopyInto(out *ApplicationSelector) {
|
||||
func (in *Application) DeepCopyInto(out *Application) {
|
||||
*out = *in
|
||||
out.LocalObjectReference = in.LocalObjectReference
|
||||
if in.LabelSelector != nil {
|
||||
in, out := &in.LabelSelector, &out.LabelSelector
|
||||
*out = new(v1.LabelSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
out.GroupVersionResource = in.GroupVersionResource
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationSelector.
|
||||
func (in *ApplicationSelector) DeepCopy() *ApplicationSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BackingServiceSelector) DeepCopyInto(out *BackingServiceSelector) {
|
||||
*out = *in
|
||||
out.GroupVersionKind = in.GroupVersionKind
|
||||
if in.Namespace != nil {
|
||||
in, out := &in.Namespace, &out.Namespace
|
||||
*out = new(string)
|
||||
if in.BindingPath != nil {
|
||||
in, out := &in.BindingPath, &out.BindingPath
|
||||
*out = new(BindingPath)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackingServiceSelector.
|
||||
func (in *BackingServiceSelector) DeepCopy() *BackingServiceSelector {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Application.
|
||||
func (in *Application) DeepCopy() *Application {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BackingServiceSelector)
|
||||
out := new(Application)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BindingPath) DeepCopyInto(out *BindingPath) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BindingPath.
|
||||
func (in *BindingPath) DeepCopy() *BindingPath {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BindingPath)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@@ -90,7 +90,40 @@ func (in *BoundApplication) DeepCopy() *BoundApplication {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBindingRequest) DeepCopyInto(out *ServiceBindingRequest) {
|
||||
func (in *Service) DeepCopyInto(out *Service) {
|
||||
*out = *in
|
||||
out.GroupVersionKind = in.GroupVersionKind
|
||||
out.LocalObjectReference = in.LocalObjectReference
|
||||
if in.Namespace != nil {
|
||||
in, out := &in.Namespace, &out.Namespace
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.EnvVarPrefix != nil {
|
||||
in, out := &in.EnvVarPrefix, &out.EnvVarPrefix
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Id != nil {
|
||||
in, out := &in.Id, &out.Id
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.
|
||||
func (in *Service) DeepCopy() *Service {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Service)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBinding) DeepCopyInto(out *ServiceBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
@@ -99,18 +132,18 @@ func (in *ServiceBindingRequest) DeepCopyInto(out *ServiceBindingRequest) {
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingRequest.
|
||||
func (in *ServiceBindingRequest) DeepCopy() *ServiceBindingRequest {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBinding.
|
||||
func (in *ServiceBinding) DeepCopy() *ServiceBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBindingRequest)
|
||||
out := new(ServiceBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ServiceBindingRequest) DeepCopyObject() runtime.Object {
|
||||
func (in *ServiceBinding) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
@@ -118,13 +151,13 @@ func (in *ServiceBindingRequest) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBindingRequestList) DeepCopyInto(out *ServiceBindingRequestList) {
|
||||
func (in *ServiceBindingList) DeepCopyInto(out *ServiceBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ServiceBindingRequest, len(*in))
|
||||
*out = make([]ServiceBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
@@ -132,18 +165,18 @@ func (in *ServiceBindingRequestList) DeepCopyInto(out *ServiceBindingRequestList
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingRequestList.
|
||||
func (in *ServiceBindingRequestList) DeepCopy() *ServiceBindingRequestList {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingList.
|
||||
func (in *ServiceBindingList) DeepCopy() *ServiceBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBindingRequestList)
|
||||
out := new(ServiceBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ServiceBindingRequestList) DeepCopyObject() runtime.Object {
|
||||
func (in *ServiceBindingList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
@@ -151,7 +184,7 @@ func (in *ServiceBindingRequestList) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBindingRequestSpec) DeepCopyInto(out *ServiceBindingRequestSpec) {
|
||||
func (in *ServiceBindingSpec) DeepCopyInto(out *ServiceBindingSpec) {
|
||||
*out = *in
|
||||
if in.CustomEnvVar != nil {
|
||||
in, out := &in.CustomEnvVar, &out.CustomEnvVar
|
||||
@@ -160,38 +193,42 @@ func (in *ServiceBindingRequestSpec) DeepCopyInto(out *ServiceBindingRequestSpec
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.BackingServiceSelector != nil {
|
||||
in, out := &in.BackingServiceSelector, &out.BackingServiceSelector
|
||||
*out = new(BackingServiceSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.BackingServiceSelectors != nil {
|
||||
in, out := &in.BackingServiceSelectors, &out.BackingServiceSelectors
|
||||
*out = new([]BackingServiceSelector)
|
||||
if in.Services != nil {
|
||||
in, out := &in.Services, &out.Services
|
||||
*out = new([]Service)
|
||||
if **in != nil {
|
||||
in, out := *in, *out
|
||||
*out = make([]BackingServiceSelector, len(*in))
|
||||
*out = make([]Service, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
in.ApplicationSelector.DeepCopyInto(&out.ApplicationSelector)
|
||||
if in.Application != nil {
|
||||
in, out := &in.Application, &out.Application
|
||||
*out = new(Application)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.DetectBindingResources != nil {
|
||||
in, out := &in.DetectBindingResources, &out.DetectBindingResources
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingRequestSpec.
|
||||
func (in *ServiceBindingRequestSpec) DeepCopy() *ServiceBindingRequestSpec {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingSpec.
|
||||
func (in *ServiceBindingSpec) DeepCopy() *ServiceBindingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBindingRequestSpec)
|
||||
out := new(ServiceBindingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBindingRequestStatus) DeepCopyInto(out *ServiceBindingRequestStatus) {
|
||||
func (in *ServiceBindingStatus) DeepCopyInto(out *ServiceBindingStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
@@ -208,12 +245,12 @@ func (in *ServiceBindingRequestStatus) DeepCopyInto(out *ServiceBindingRequestSt
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingRequestStatus.
|
||||
func (in *ServiceBindingRequestStatus) DeepCopy() *ServiceBindingRequestStatus {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBindingStatus.
|
||||
func (in *ServiceBindingStatus) DeepCopy() *ServiceBindingStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBindingRequestStatus)
|
||||
out := new(ServiceBindingStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@@ -16,8 +16,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by openapi-gen. DO NOT EDIT.
|
||||
|
||||
// This file was autogenerated by openapi-gen. Do not edit it manually!
|
||||
|
||||
package v1alpha1
|
||||
@@ -29,16 +27,16 @@ import (
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequest": schema_pkg_apis_apps_v1alpha1_ServiceBindingRequest(ref),
|
||||
"github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequestStatus": schema_pkg_apis_apps_v1alpha1_ServiceBindingRequestStatus(ref),
|
||||
"./pkg/apis/apps/v1alpha1.ServiceBinding": schema_pkg_apis_apps_v1alpha1_ServiceBinding(ref),
|
||||
"./pkg/apis/apps/v1alpha1.ServiceBindingStatus": schema_pkg_apis_apps_v1alpha1_ServiceBindingStatus(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_apps_v1alpha1_ServiceBindingRequest(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_apps_v1alpha1_ServiceBinding(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceBindingRequest expresses intent to bind an operator-backed service with an application workload.",
|
||||
Description: "ServiceBinding expresses intent to bind an operator-backed service with an application workload.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
@@ -62,27 +60,27 @@ func schema_pkg_apis_apps_v1alpha1_ServiceBindingRequest(ref common.ReferenceCal
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequestSpec"),
|
||||
Ref: ref("./pkg/apis/apps/v1alpha1.ServiceBindingSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequestStatus"),
|
||||
Ref: ref("./pkg/apis/apps/v1alpha1.ServiceBindingStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequestSpec", "github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.ServiceBindingRequestStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"./pkg/apis/apps/v1alpha1.ServiceBindingSpec", "./pkg/apis/apps/v1alpha1.ServiceBindingStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_apps_v1alpha1_ServiceBindingRequestStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_apps_v1alpha1_ServiceBindingStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ServiceBindingRequestStatus defines the observed state of ServiceBindingRequest",
|
||||
Description: "ServiceBindingStatus defines the observed state of ServiceBinding",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"conditions": {
|
||||
@@ -107,12 +105,12 @@ func schema_pkg_apis_apps_v1alpha1_ServiceBindingRequestStatus(ref common.Refere
|
||||
},
|
||||
"applications": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ApplicationObjects contains all the application objects filtered by label",
|
||||
Description: "Applications contain all the applications filtered by name or label",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.BoundApplication"),
|
||||
Ref: ref("./pkg/apis/apps/v1alpha1.BoundApplication"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -123,6 +121,6 @@ func schema_pkg_apis_apps_v1alpha1_ServiceBindingRequestStatus(ref common.Refere
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/openshift/custom-resource-status/conditions/v1.Condition", "github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1.BoundApplication"},
|
||||
"./pkg/apis/apps/v1alpha1.BoundApplication", "github.com/openshift/custom-resource-status/conditions/v1.Condition"},
|
||||
}
|
||||
}
|
||||
5
vendor/modules.txt
vendored
5
vendor/modules.txt
vendored
@@ -434,8 +434,8 @@ github.com/prometheus/common/model
|
||||
github.com/prometheus/procfs
|
||||
github.com/prometheus/procfs/internal/fs
|
||||
github.com/prometheus/procfs/internal/util
|
||||
# github.com/redhat-developer/service-binding-operator v0.1.1
|
||||
github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1
|
||||
# github.com/redhat-developer/service-binding-operator v0.3.0
|
||||
github.com/redhat-developer/service-binding-operator/pkg/apis/operators/v1alpha1
|
||||
# github.com/russross/blackfriday v1.5.2
|
||||
github.com/russross/blackfriday
|
||||
# github.com/sergi/go-diff v1.1.0
|
||||
@@ -872,7 +872,6 @@ k8s.io/utils/exec
|
||||
k8s.io/utils/integer
|
||||
k8s.io/utils/trace
|
||||
# sigs.k8s.io/controller-runtime v0.6.0
|
||||
sigs.k8s.io/controller-runtime/pkg/runtime/scheme
|
||||
sigs.k8s.io/controller-runtime/pkg/scheme
|
||||
# sigs.k8s.io/kustomize v2.0.3+incompatible
|
||||
sigs.k8s.io/kustomize/pkg/commands/build
|
||||
|
||||
29
vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme/scheme.go
generated
vendored
29
vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme/scheme.go
generated
vendored
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package scheme contains utilities for gradually building Schemes,
|
||||
// which contain information associating Go types with Kubernetes
|
||||
// groups, versions, and kinds.
|
||||
//
|
||||
// Deprecated: use pkg/scheme instead.
|
||||
package scheme
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
// Builder builds a new Scheme for mapping go types to Kubernetes GroupVersionKinds.
|
||||
type Builder = scheme.Builder
|
||||
Reference in New Issue
Block a user