Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

[HOLD] chore: convert ServiceIdentity to struct #3732

Closed

Conversation

allenlsy
Copy link
Contributor

@allenlsy allenlsy commented Jul 6, 2021

Signed-off-by: Allen Leigh allenlsy@gmail.com

Description:

Use struct to define ServiceIdentity, to provide more context.

Issue #3188

Affected area:

Functional Area
New Functionality [ ]
Documentation [ ]
Install [ ]
CLI Tool [ ]
Certificate Management [ ]
Control Plane [ ]
Ingress [ ]
Egress [ ]
Networking [ ]
Observability [ ]
SMI Policy [ ]
Sidecar Injection [ ]
Security [ ]
Upgrade [ ]
Tests [ ]
CI System [ ]
Demo [ ]
Performance [ ]
Other [X]

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project?
    • Did you notify the maintainers and provide attribution?

No

  1. Is this a breaking change?

No

@allenlsy allenlsy requested a review from a team as a code owner July 6, 2021 22:08
@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2021

Codecov Report

Merging #3732 (d8c5ae4) into main (0322387) will increase coverage by 2.21%.
The diff coverage is 60.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3732      +/-   ##
==========================================
+ Coverage   67.65%   69.87%   +2.21%     
==========================================
  Files         181      185       +4     
  Lines        8772     8986     +214     
==========================================
+ Hits         5935     6279     +344     
+ Misses       2804     2658     -146     
- Partials       33       49      +16     
Flag Coverage Δ
unittests 69.87% <60.85%> (+2.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/cli/mesh_upgrade.go 70.83% <ø> (+25.00%) ⬆️
cmd/osm-controller/log_handler.go 77.77% <0.00%> (-6.23%) ⬇️
cmd/osm-controller/osm-controller.go 13.07% <0.00%> (-0.45%) ⬇️
pkg/catalog/egress.go 83.89% <0.00%> (-3.72%) ⬇️
pkg/catalog/inbound_traffic_policies.go 78.81% <0.00%> (-4.23%) ⬇️
pkg/catalog/traffictarget.go 88.46% <0.00%> (ø)
pkg/constants/constants.go 0.00% <ø> (ø)
pkg/endpoint/mock_endpoint_provider_generated.go 0.00% <ø> (ø)
pkg/endpoint/types.go 100.00% <ø> (ø)
pkg/providers/kube/fake.go 0.00% <0.00%> (ø)
... and 47 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 038f093...d8c5ae4. Read the comment docs.

Signed-off-by: Allen Leigh <allenlsy@gmail.com>
type ServiceIdentity struct {
ServiceAccount string
Namespace string
ClusterDomain string
Copy link
Member

Choose a reason for hiding this comment

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

In the future, we will need to support non k8s env such as VMs. We most likely will continue to use a ServiceAccount to map non k8s identity types (such as service principals).

Suggested change
ClusterDomain string
TrustDomain string

Comment on lines +42 to +48
serviceIdentity := lb.serviceIdentity
proxyIdentity := identity.ServiceIdentity{
ServiceAccount: serviceIdentity.ServiceAccount,
Namespace: serviceIdentity.Namespace,
ClusterDomain: serviceIdentity.ClusterDomain,
}
trafficTargets, err := lb.meshCatalog.ListInboundTrafficTargetsWithRoutes(serviceIdentity)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
serviceIdentity := lb.serviceIdentity
proxyIdentity := identity.ServiceIdentity{
ServiceAccount: serviceIdentity.ServiceAccount,
Namespace: serviceIdentity.Namespace,
ClusterDomain: serviceIdentity.ClusterDomain,
}
trafficTargets, err := lb.meshCatalog.ListInboundTrafficTargetsWithRoutes(serviceIdentity)
trafficTargets, err := lb.meshCatalog.ListInboundTrafficTargetsWithRoutes(lb.serviceIdentity)

Namespace: serviceIdentity.Namespace,
ClusterDomain: serviceIdentity.ClusterDomain,
}
trafficTargets, err := lb.meshCatalog.ListInboundTrafficTargetsWithRoutes(serviceIdentity)
if err != nil {
log.Error().Err(err).Msgf("Error listing allowed inbound traffic targets for proxy identity %s", proxyIdentity)
Copy link
Member

Choose a reason for hiding this comment

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

s/proxyIdentity/lb.serviceIdentity

@allenlsy allenlsy added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 12, 2021
@allenlsy allenlsy changed the title chore: convert ServiceIdentity to struct [HOLD] chore: convert ServiceIdentity to struct Jul 12, 2021
@shashankram shashankram marked this pull request as draft September 22, 2021 16:19
@allenlsy allenlsy closed this Jan 14, 2022
@allenlsy allenlsy deleted the serviceidentity-struct branch January 14, 2022 23:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants