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

feature-261: Role Service #167

Merged
merged 23 commits into from
May 5, 2022
Merged

feature-261: Role Service #167

merged 23 commits into from
May 5, 2022

Conversation

atye
Copy link
Contributor

@atye atye commented Apr 27, 2022

Description

This PR adds a role service which will contain the logic for karavictl role commands in a helm deployment and implements the karavictl role create functionality.

Here is a view of new files and service structure.

internal/types holds types that are shared across services.
internal/k8s is an abstraction for working with configured storage and roles in k8s for any service can use.
internal/role-service/service.go is the role service that implements the role-service protobuf definitions.
internal/role-service/roles is existing code and provides management of role data.
internal/role-service/validate validates new roles for the storage types.

┣ 📂cmd
┃ ┣ 📂karavictl
┃ ┃ ┣ 📂cmd
┃ ┃ ┃ ┣ 📜role_create_grpc_test.go
┃ ┣ 📂role-service
┃ ┃ ┗ 📜main.go
┣ 📂internal
┃ ┣ 📂k8s
┃ ┃ ┣ 📜api.go
┃ ┃ ┗ 📜api_test.go
┃ ┣ 📂role-service
┃ ┃ ┣ 📂roles
┃ ┃ ┃ ┣ 📜roles.go
┃ ┃ ┃ ┗ 📜roles_test.go
┃ ┃ ┣ 📂validate
┃ ┃ ┃ ┣ 📜powerflex.go
┃ ┃ ┃ ┣ 📜powermax.go
┃ ┃ ┃ ┣ 📜powerscale.go
┃ ┃ ┃ ┣ 📜validate.go
┃ ┃ ┃ ┗ 📜validate_test.go
┃ ┃ ┣ 📜service.go
┃ ┃ ┗ 📜service_test.go
┃ ┣ 📂types
┃ ┃ ┗ 📜types.go
┣ 📂pb
┃ ┣ 📜role-service.pb.go
┃ ┣ 📜role-service.proto
┃ ┣ 📜role-service_grpc.pb.go

See dell/helm-charts#109 for installing the helm chart and examples.

The internal/k8s package has low coverage because fake k8s client used for testing doesn't support the operation we are doing. kubernetes/client-go#970

GitHub Issues

List the GitHub issues impacted by this PR:

GitHub Issue #
dell/csm#261

Checklist:

  • I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Backward compatibility is not broken

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration

Unit tests and integration style testing via manually running karavictl.

go test -count=1 -cover -race -timeout 30s -short ./...
?       karavi-authorization/cmd/karavictl      [no test files]
ok      karavi-authorization/cmd/karavictl/cmd  2.256s  coverage: 60.7% of statements
ok      karavi-authorization/cmd/proxy-server   0.064s  coverage: 4.0% of statements
?       karavi-authorization/cmd/role-service   [no test files]
?       karavi-authorization/cmd/sidecar-proxy  [no test files]
ok      karavi-authorization/cmd/tenant-service 0.068s  coverage: 8.7% of statements
ok      karavi-authorization/deploy     0.161s  coverage: 87.5% of statements
?       karavi-authorization/internal/decision  [no test files]
ok      karavi-authorization/internal/k8s       0.137s  coverage: 56.4% of statements
ok      karavi-authorization/internal/powerflex 9.609s  coverage: 92.6% of statements
ok      karavi-authorization/internal/proxy     7.919s  coverage: 66.1% of statements
ok      karavi-authorization/internal/quota     0.362s  coverage: 90.1% of statements
ok      karavi-authorization/internal/role-service      0.039s  coverage: 78.4% of statements
ok      karavi-authorization/internal/role-service/roles        0.054s  coverage: 93.2% of statements
ok      karavi-authorization/internal/role-service/validate     0.197s  coverage: 79.6% of statements
ok      karavi-authorization/internal/tenantsvc 2.586s  coverage: 82.3% of statements
ok      karavi-authorization/internal/token     0.040s  coverage: 100.0% of statements
ok      karavi-authorization/internal/token/jwx 0.034s  coverage: 71.7% of statements
?       karavi-authorization/internal/types     [no test files]
ok      karavi-authorization/internal/web       0.046s  coverage: 6.2% of statements

? karavi-authorization/pb [no test files]

@atye atye merged commit fbb30b8 into main May 5, 2022
@atye atye deleted the feature-261-role-service branch May 5, 2022 12:34
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