Skip to content

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

Merged
merged 1 commit into from
Mar 24, 2018

Conversation

brendandburns
Copy link
Contributor

@tintoy

Thanks!

{
internal class Exec
{
private static void Main(string[] args)
Copy link
Contributor

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?

Copy link
Contributor Author

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) =>
Copy link
Contributor

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
Copy link
Contributor

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...

Copy link
Contributor Author

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.

Copy link
Contributor

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);
Copy link
Contributor

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 :)

Copy link
Contributor

@tintoy tintoy left a comment

Choose a reason for hiding this comment

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

LGTM!

@tintoy
Copy link
Contributor

tintoy commented Mar 23, 2018

(sorry, review stuff doesn't show up well on mobile 😁)

@brendandburns brendandburns merged commit fcc08bc into kubernetes-client:master Mar 24, 2018
JonJam pushed a commit to JonJam/csharp that referenced this pull request Sep 8, 2018
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.

2 participants