Skip to content

fix: add support for creating operator based resource#599

Merged
wtrocki merged 6 commits intomainfrom
binding-cr
Apr 20, 2021
Merged

fix: add support for creating operator based resource#599
wtrocki merged 6 commits intomainfrom
binding-cr

Conversation

@wtrocki
Copy link
Collaborator

@wtrocki wtrocki commented Apr 19, 2021

Add option to create CR instead of using SDK for binding.
Issue #595

@wtrocki wtrocki requested a review from craicoverflow April 19, 2021 16:41
@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 19, 2021

@DuncanDoyle This is working end to end, but I need to perform some minor code cleanup for it.
In case this is not merged I will send you google drive with binary containing this feature.

var deploymentResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"}

func ExecuteServiceBinding(logger logging.Logger, serviceName string, ns string, appName string, forceCreationWithoutAsk bool) error {
// TODO extract arguments
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this almost there - moving arguments to structure.

cmd.Flags().BoolVarP(&opts.forceCreationWithoutAsk, "yes", "y", false, localizer.MustLocalizeFromID("cluster.common.flag.yes.description"))
cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "", localizer.MustLocalizeFromID("cluster.common.flag.namespace.description"))
cmd.Flags().BoolVarP(&opts.ignoreContext, "ignore-context", "", false, localizer.MustLocalizeFromID("cluster.common.flag.ignoreContext.description"))
cmd.Flags().BoolVarP(&opts.useOperator, "force-operator", "", false, localizer.MustLocalizeFromID("cluster.bind.flag.onlyOperator.description"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmuir We assume to use Operator by default when installed. If this flag is added and CLI fails to detect operator it will fail. Otherwise if operator is not detected SDK is used.

Would you prefer to have more complex flags like:

--useOperator=true
--useSDK=true

Additionally we should provide name override for the service binding (as it is currently generated which might look bad)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like --force-operator - it's clear what's it's doing :-D What about --force-sdk as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Adding SDK here will be easy. I was hoping to have single flag but that is not possible due to this fallback logic

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 19, 2021

@craicoverflow ready for review :)

@wtrocki wtrocki merged commit 326b41d into main Apr 20, 2021
@wtrocki wtrocki deleted the binding-cr branch April 20, 2021 09:09
@craicoverflow
Copy link
Contributor

Is that a fix or feat?

@wtrocki
Copy link
Collaborator Author

wtrocki commented Apr 20, 2021

I seen that as fix initially but when you have asked I think it is feat :D

craicoverflow pushed a commit that referenced this pull request Apr 20, 2021
* fix: add support for creating operator based resource

* chore: refactor logic to use additional flags

* fix: allow to override bindAsFiles in SDK

* fix: reduce size of random characters in binding name

* fix: problem when having no kafkas available

* style: ignore lint warning

Co-authored-by: Enda Phelan <ephelan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants