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

Updated grpc2 to grpc3 #9194

Closed
wants to merge 10 commits into from
Closed

Updated grpc2 to grpc3 #9194

wants to merge 10 commits into from

Conversation

AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Apr 24, 2022

Fixes #9193 #9196
Gitea tests are failing cause problems in gitea.com
https://gitea.com/api/v1/repos/gitea/test-openldap returns main default branch but
https://gitea.com/api/v1/repos/gitea/test-openldap/branches has master only

Andrii Chubatiuk and others added 4 commits April 25, 2022 03:13
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
@@ -717,16 +705,16 @@ func (s *Server) Delete(ctx context.Context, q *application.ApplicationDeleteReq
return nil, err
}

if q.Cascade != nil && !*q.Cascade && q.GetPropagationPolicy() != "" {
if !q.Cascade && q.GetPropagationPolicy() != "" {
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned about the 2->3 proto upgrade because we've lost the ability to detect when boolean fields were omitted as opposed to defaulted false. Argo CD has logic that treats omitted fields differently than false, such as the original code here. I believe this is changing the behavior of cascaded deletion here.

Copy link
Member

Choose a reason for hiding this comment

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

Please see more information about this design decision in proto3:
protocolbuffers/protobuf#359

Copy link
Member

Choose a reason for hiding this comment

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

OK, so @alexmt just informed me that starting with proto 3.15, fields can once again be marked as optional. I think what needs to happen in this PR is to specify optional to fields like Cascade, so that we get back the original behavior. I believe this will generate Has() methods to indicate if the field was explicitly set or not.

See: https://stackoverflow.com/a/62566052

validate = *q.Validate
}
err := s.validateAndNormalizeApp(ctx, a, validate)
err := s.validateAndNormalizeApp(ctx, a, q.Validate)
Copy link
Member

Choose a reason for hiding this comment

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

Validate is another field where omission matters. Omitted actually equates to true.

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

I think those are all the fields where optionality matters (Validate + Cascade). But would like a second pair of eyes on this.

validate = *q.Validate
}
return s.validateAndUpdateApp(ctx, q.Application, false, validate)
return s.validateAndUpdateApp(ctx, q.Application, false, q.Validate)
Copy link
Member

Choose a reason for hiding this comment

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

Another: omitted q.Validate is actually true

validate = *q.Validate
}
a, err = s.validateAndUpdateApp(ctx, a, false, validate)
a, err = s.validateAndUpdateApp(ctx, a, false, q.Validate)
Copy link
Member

Choose a reason for hiding this comment

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

Another: omitted q.Validate is actually true

Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
@codecov
Copy link

codecov bot commented Apr 29, 2022

Codecov Report

Merging #9194 (b1fefd4) into master (1533698) will decrease coverage by 0.01%.
The diff coverage is 24.87%.

@@            Coverage Diff             @@
##           master    #9194      +/-   ##
==========================================
- Coverage   45.73%   45.71%   -0.02%     
==========================================
  Files         220      220              
  Lines       26006    26004       -2     
==========================================
- Hits        11893    11887       -6     
- Misses      12456    12459       +3     
- Partials     1657     1658       +1     
Impacted Files Coverage Δ
cmd/argocd/commands/admin/app.go 30.50% <ø> (ø)
cmd/argocd/commands/app_actions.go 0.00% <0.00%> (ø)
controller/appcontroller.go 52.27% <ø> (ø)
reposerver/askpass/server.go 35.29% <0.00%> (ø)
reposerver/cache/cache.go 64.28% <ø> (ø)
server/server.go 54.23% <ø> (ø)
util/app/discovery/discovery.go 40.27% <0.00%> (ø)
util/cmp/stream.go 52.14% <ø> (ø)
util/oidc/oidc.go 40.67% <ø> (ø)
util/settings/settings.go 48.10% <ø> (ø)
... and 9 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 1533698...b1fefd4. Read the comment docs.

Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Signed-off-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
@AndrewChubatiuk AndrewChubatiuk deleted the optional-group branch May 1, 2022 20:55
@alexmt
Copy link
Collaborator

alexmt commented May 3, 2022

I've also tried @jessesuen 's suggestion and also found that gogoprotobuf does not support optional fields :(

We plan to drop gogoprotobuf but blocked because k8s protobuf definitions are not compatible with most recent golang proto generator. Kubernetes 1.24 should resolve it

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.

Cannot exec or delete pod resource
3 participants