-
Notifications
You must be signed in to change notification settings - Fork 90
Encode the protocol version in the CRD #1097
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,25 +211,16 @@ class KubeClientFabric8( | |
|
|
||
| def getOperatorProtocolVersion(): Try[String] = withClient { client => | ||
| for { | ||
| protocolVersionCM <- Try { | ||
| crd <- Try { | ||
| client | ||
| .configMaps() | ||
| .inAnyNamespace() | ||
| .withLabel(KubeClient.CloudflowProtocolVersionConfigMap) | ||
| .list() | ||
| .getItems() | ||
| } | ||
| protocolVersion <- { | ||
| protocolVersionCM.size() match { | ||
| case 1 => Success(protocolVersionCM.get(0)) | ||
| case x if x > 1 => | ||
| Failure( | ||
| CliException("Multiple Cloudflow operators detected in the cluster. This is not supported. Exiting")) | ||
| case x if x < 1 => Failure(CliException("No Cloudflow operators detected in the cluster. Exiting")) | ||
| } | ||
| .apiextensions() | ||
| .v1beta1() | ||
| .customResourceDefinitions() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need cluster admin / wide permissions?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably a good idea to have a yaml that specifies exactly which permissions CLI needs to function, similar to https://github.com/lightbend/cloudflow-helm-charts/blob/main/cloudflow/templates/02-cloudflow-operator-clusterrole.yaml, what do you think?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a good idea, have to think how to produce it, maybe running the cli from within the cluster and checking permissions. |
||
| .withName(App.ResourceName) | ||
| .get() | ||
| } | ||
| version <- Option(protocolVersion.getData.get(KubeClient.ProtocolVersionKey)) | ||
| .fold[Try[String]](Failure(CliException("Cannot find the protocol version in the config map")))(Success(_)) | ||
| version <- Option(crd.getMetadata.getLabels.get(App.ProtocolVersionKey)) | ||
| .fold[Try[String]](Failure(CliException("Cannot find the protocol version in the CRD")))(Success(_)) | ||
| } yield { | ||
| version | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even
ApplicationDescriptor?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait. No you are right, this stays the same.