Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KRV-6540: jq substitute when importing tokens during authorization deployment #301

Closed
wants to merge 3 commits into from

Conversation

donatwork
Copy link
Contributor

@donatwork donatwork commented Jul 29, 2022

Description

Add alternative method to extract the token and convert to YAML format. Added note in both Helm and RPM deployment sections. There are more than one way to do this but felt that sed is in all major distributions and not everyone may use Python's json module which is another option I thought about.

There were some trailing whitespace that got removed due to my editor's save actions. You may want to ignore whitespace when viewing the diffs.

Testing

  • Compared output of original command and new alternative. The output is the same except for a newline at the top and bottom with the new approach. Not an issue as YAML is tolerant of blank lines. Did not want to add complexity to the sed command.
  • Imported secret into Kubernetes without error.

GitHub Issues

List the GitHub issues impacted by this PR:

GitHub Issue #
dell/csm#390

Checklist:

  • Have you run a grammar and spell checks against your submission?
  • Have you tested the changes locally?
  • Have you tested whether the hyperlinks are working properly?
  • Did you add the examples wherever applicable?
  • [n/a] Have you added high-resolution images?


The following CSM Authorization components are installed in the specified namespace:
- proxy-service, which forwards requests from the CSI Driver to the backend storage array
- tenant-service, which configures tenants, role bindings, and generates JSON Web Tokens
- role-service, which configures roles for tenants to be bound to
- storage-service, which configures backend storage arrays for the proxy-server to foward requests to

The folloiwng third-party components are installed in the specified namespace:
The following third-party components are installed in the specified namespace:

Choose a reason for hiding this comment

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

Change "The following" to "These

@@ -253,7 +259,7 @@ Create the karavi-authorization-config secret using the following command:
`kubectl -n [CSI_DRIVER_NAMESPACE] create secret generic proxy-server-root-certificate --from-file=rootCertificate.pem=/path/to/rootCA -o yaml --dry-run=client | kubectl apply -f -`


>__Note__: Follow the steps below for additional configurations to one or more of the supported CSI drivers.
>__Note__: Follow the steps below for additional configurations to one or more of the supported CSI drivers.

Choose a reason for hiding this comment

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

Change "the steps below: to "these steps"

Copy link

@rsedlock1958 rsedlock1958 left a comment

Choose a reason for hiding this comment

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

I have reviewed this. Minor edits are required.

@@ -231,6 +231,11 @@ data:

This secret must be applied in the driver namespace. Continue reading the next section for configuring the driver to use CSM Authorization.

>__Note__:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this note about jq if we're removing the jq dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using jq should be the preferred approach as it is meant to be used for structured data verses some Unix commands to parse text. Parsing text is fragile. If I make the command more robust then it gets more complex. We should just stick with jq.

I'm not a fan of making doc changes to add substitutions as we should have documented the sed commands in the original issue and closed. Most admins should already have some idea of what they can use as an alternative, even manual copy and pasting, especially if they are managing a k8s cluster in a Linux environment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep the original command with jq as an option for those that have jq in their environment, as well as add this new command with sed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if we had a common section where we cover the tools that are not normally in a distribution. I can see the RPM locations for the selinux as another use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could change to use a more robust Python 3 option. It is more likely that Python 3 is bundled with the distribution.

| python3 -c "import json,sys; print(json.load(sys.stdin)['Token'])"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I changed to using Python. More robust than sed at a smaller risk of changes to the output.

@shaynafinocchiaro
Copy link
Contributor

Please link to the github issue mentioned in this PR. Thanks!

@donatwork
Copy link
Contributor Author

I need one more code owner to approve.

@donatwork donatwork closed this Aug 2, 2022
@donatwork
Copy link
Contributor Author

Need to resubmit with signed commits.

@donatwork donatwork deleted the KRV-6540-jq-substitute branch August 2, 2022 16:09
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.

5 participants