-
Notifications
You must be signed in to change notification settings - Fork 309
Add an 'exec' example. Clean up some websockets code. #114
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
Conversation
examples/exec/Exec.cs
Outdated
{ | ||
internal class Exec | ||
{ | ||
private static void Main(string[] args) |
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.
Note sure what version of C# this is built with but latest supports async main if that makes the code cleaner?
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.
Done (had to move to c# 7.1)
@@ -59,10 +60,15 @@ public Kubernetes(KubernetesClientConfiguration config, params DelegatingHandler | |||
} | |||
|
|||
#if NET452 | |||
((WebRequestHandler) HttpClientHandler).ServerCertificateValidationCallback = | |||
CertificateValidationCallBack; | |||
((WebRequestHandler) HttpClientHandler).ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => |
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.
Noted for next time :)
webSocketBuilder.ExpectServerCertificate(this.CaCert); | ||
else |
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.
Aren't these mutually exclusive? I suppose throwing an exception would have been clearer when I first wrote this...
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.
Maybe? I sort of lean on "the customer is always right" or "the caller is always right"
If they ship us a config with a ca Cert and noVerifyTLS who are we to judge? We should obey their wishes.
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.
Yeah fair enough, that reasoning makes sense to me :)
My personal approach to API design is "forgiving, but also willing to point out when the caller may be making a mistake". If someone specifies both CaCert
and SkipTlsVerify
, which one did they really intend to specify? Is it intuitive to them which one we'd select when there's a conflict like this, and do we document this assumption anywhere?
But in this case, correct behaviour is dictated by the K8s client config spec which doesn't prevent them specifying both (so I agree with you that there's not much point in stopping them from doing so).
|
||
return false; | ||
} | ||
return Kubernetes.CertificateValidationCallBack(sender, serverCertificate, certificate, chain, sslPolicyErrors); |
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.
Oops! Sorry, must have missed that :)
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.
LGTM!
(sorry, review stuff doesn't show up well on mobile 😁) |
@tintoy
Thanks!