Commit Graph

287 Commits

Author SHA1 Message Date
Brendan Burns
948d78c1bd Fix elliptic curve certs and add a unit test (#243)
* Fix a elipitic curve certs and add a unit test.

* Address comments.

* Change the key to be OSX compatible.
2019-02-27 10:45:21 -08:00
Boshi Lian
406df57f9d pretend to support chain (#245) 2019-02-15 11:57:24 -08:00
itowlson
9f1669b0cb Fix up YAML serialisation to understand AutoRest property renaming (#209) 2019-02-11 21:07:00 -08:00
Xin Yan
5adf9a3841 bug fix - remove port bytes during port forwarding (#233)
* fix a race condition.
when multiple call to GetStream happens around the same time, on the
same inputIndex, a race condition will cause this.buffers.Add() to throw
exception.

* add WebSocket server certificate validation support for net 452

* port forwarding bug fix

In StreamDemuxer, if the buffer is created before connection is established, the port bytes are not removed when
the bytes are delivering to the client. Repro code looks like (the key is to call remoteStreams.Start AFTER
GetStream):

  var ws = await kubernetesClient.WebSocketNamespacedPodPortForwardAsync (... )
  var remoteStreams = new StreamDemuxer(ws);
  var stream = remoteStreams.GetStream(0, 0);
  remoteStreams.Start();

This change filters out the port bytes which are the 2nd and 3rd bytes sent in all cases.

* incorporate review feedbacks.
add an enum StreamType to StreamDemuxer so it knows whether / how
the data stream should be handled.

* add tests, fix skip bytes scenario for multiple streams

* add more tests for verifying content.

* simplify code a bit
2019-02-01 14:57:09 -08:00
Boshi Lian
1600e44b00 generate for 1.13 (#223)
* generate for 1.13 and bump ver to 1.4

* fix examples for 1.13

* update outdated cert
2018-12-11 21:10:39 -08:00
Aaron Roney
b7f79c924f Remove requirement for certificate authority and certificate authority data in kubeconfig. (#222)
* Remove requirement for certificate authority data in kubeconfig.

* Update src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs

Update casing of `URL` at @itowlson suggestion.

Co-Authored-By: twitchax <twitchax@gmail.com>
2018-12-11 21:08:55 -08:00
itowlson
7c9cc88d38 Create KubernetesClientConfiguration from pre-loaded K8SConfiguration (#213)
* Create KubernetesClientConfiguration from pre-loaded K8SConfiguration

* Tweaked a couple more doc strings

* Fix duplicated tests

* Give the new method a more informative name
2018-10-26 23:25:22 -07:00
Brendan Burns
0b1669d5a5 Rev ASPNetCore version (#216) 2018-10-26 23:03:19 -07:00
Brendan Burns
aa1c880301 Disable a test on OS X because it started failing for unknown reasons (#218) 2018-10-26 22:50:22 -07:00
Boshi Lian
9372e3291f align files to .editorconfig (#203)
* align files to .editorconfig

* fix space cause build failed
2018-09-27 10:50:39 -07:00
Brendan Burns
3551f03258 Add support for Azure AAD based authentication. (#193) 2018-07-19 08:07:47 -07:00
Hossam Barakat
dae6d62cba Update tests namespaces for consistency (#191) 2018-07-09 06:52:17 -07:00
Hossam Barakat
8c3152af97 Update WatcherDelegatingHandler to stop eating first line (#183) (#190)
* Update WatcherDelegatingHandler to stop eating first line (#183)

* Override Read methods in PeekableStreamReader to avoid unpredicted behaviour (#183)

Override Read methods in PeekableStreamReader to avoid unpredicted behaviour (#183)
2018-07-09 06:51:49 -07:00
Frederik Carlier
bc1cb6205c Watcher: notify the caller when the server closes the connection (#184)
* Watcher: Add onClosed event and callback

* Update the code generators to accept the onClose callback

* Re-generate API

* Update unit tests

* Fix unit test

* Watcher fixes/improvements:
- Run Task.Yield at the beginning to make sure we're running async
- Set Watching = false before invoking OnClosed, to make sure the callers see a consistent state.
2018-06-27 14:38:28 -07:00
Frederik Carlier
de916f6390 Additional watcher tests (#178) 2018-06-25 07:14:02 -07:00
Boshi Lian
7723604b7e fix test case fail on windows (#177)
* fix test case fail on windows

* fix cert not working on windows

* changed to RuntimeInformation to see if osx

* change to a more common way to deal with line ending (due to git autocrlf)
2018-06-25 07:13:09 -07:00
David Orbelian
6eb5555145 Fix issue with X509VerificationFlags.AllowUnknownCertificateAuthority behavior (#174)
* Fix issue with X509VerificationFlags.AllowUnknownCertificateAuthority behavior

* Add CertificateValidationTests
2018-06-13 10:55:41 -07:00
Adam Friedman
a358cb9afd Remove hacky WebSocket connection factory. (#171)
Replace it with the new (officially-supported) ClientWebSocket
SSL functionality in .NET Core 2.1.

kubernetes-client/csharp#130
2018-06-07 16:47:39 -07:00
Frederik Carlier
6f38b7299e Fix an issue where growing the ByteBuffer would fail (#167)
* Fix an issue where growing a buffer when the read water mark = 0 would fail

* Simplify fix
2018-06-01 11:26:49 -07:00
Frederik Carlier
0f2832b86c Allow callers to specify which WebSocket subprotocol to use (#154)
* Allow callers to specify which WebSocket subprotocol to use.

* Update unit tests

* Update unit test

* Fix ordering

* Trace CancellationToken
2018-05-02 22:02:05 -07:00
Frederik Carlier
29a9c22644 Handle error messages in the watcher (#150)
* Handle error messages in the watcher

* Fix documentation

* Fix typo
2018-04-27 20:51:02 -07:00
Frederik Carlier
194211b370 Fix flakey tests by making them async (#144)
* Fix flakey tests by converting them to async and synchronizing code blocks

* Use the same timeout for all tests

* Use signals to gracefully shut down the mock server
2018-04-27 20:40:47 -07:00
Frederik Carlier
d90289a094 Support relative paths in Kubernetes configuration files (#141)
* Support relative paths in Kubernetes configuration files

* Filename -> FileName

* Filename -> FileName

* KuberentesClientConfiguration: Allow the user to opt-out of the mechanism which resolves relative paths in the configuration file.

* Update unit tests

* Fix test
2018-04-26 21:13:48 -07:00
Bill Pratt
df4d5dc31a Make LoadKubeConfig public and refactor to use YAML helper methods (#133)
* Made LoadKubeConfig public and refactored to use YAML helper methods

* Addressing Code review feedback
2018-04-18 21:52:19 -07:00
Adam Friedman
ea62ca00e0 Move projects to subdirectories of /src and /tests (#134)
kubernetes-client/csharp#127
2018-04-04 22:13:45 -07:00
Frederik Carlier
d20e2597b9 WebSocketNamespacedPodExecAsync: Support specifying command arguments (#123)
* WebSocketNamespacedPodExecAsync: Support specifying command argumets

* Address PR feedback

* Address PR feedback

* Fix unstable test
2018-03-30 22:56:52 -07:00
Frederik Carlier
cf1c9950a0 Run integration tests as part of CI (after #129) (#131)
* Run CI scripts on both Mac and Linux

* Fix AuthTests for macOS

* Use SocketsHttpHandler

* Install minikube on the Travis CI servers

* Add integration tests

* Fix an issue where StreamConnectAsync would crash if the credentials were not set
2018-03-30 22:32:14 -07:00
Brendan Burns
12769b647e Eliminate all arbitrary delays, replace with synchronization. (#124) 2018-03-30 22:24:22 -07:00
Frederik Carlier
801455c4d8 Fix YAML serialization of ResourceQuantity values (#126)
* Fix YAML serialization of ResourceQuantity values

* Address PR feedback
2018-03-30 22:02:29 -07:00
Boshi Lian
c489e066d6 fix testcases (#119) 2018-03-27 19:29:37 -07:00
Brendan Burns
d0c17ee2d5 Add an attach example. Fix the attach code. (#116) 2018-03-23 22:07:51 -07:00
Adam Friedman
c0a42ad884 Custom validation of server certificate for WebSockets (#103)
* Improve SSL customisation for WebSockets

kubernetes-client/csharp#102

* First test for exec-in-pod over WebSockets.

Also, implement basic mock server for testing WebSockets.

kubernetes-client/csharp#102

* Attempt to handle raciness of Watcher tests.

kubernetes-client/csharp#102

* Attempt to handle raciness of ByteBuffer test.

kubernetes-client/csharp#102
2018-03-19 22:03:28 -07:00
Brendan Burns
5b1a831a1f Add a utility for YAML loading. (#98) 2018-03-12 14:55:35 -07:00
Frederik Carlier
a7ee07f6e6 Update the Kubernetes configuration model (#94)
* Add documentaton

* Add Extensions properties
Add as, as-groups, as-user-extra properties to UserCredentials
2018-02-15 22:32:59 -08:00
Allan Targino
a5f0e063f4 support for string and stream config (#83) 2018-01-31 17:21:14 -08:00
Boshi Lian
db7ed9cad1 fix tests stuck and failed on low core machine (#89) 2018-01-25 22:04:06 -08:00
Boshi Lian
db472b0d96 support target net452 (#86)
* support target net452

* dont build net45 on non windows host
2018-01-25 22:03:45 -08:00
Frederik Carlier
ff7a455ae7 RFC - Support WebSockets with channels (#66)
* Add support for demuxing streams from WebSockets.

* Add missing using statement, fix unit test
2018-01-02 20:45:53 -08:00
Phillip Hoff
bbd359f859 Fix for delete post-config-load. (#68) 2017-12-20 09:43:13 -08:00
Frederik Carlier
2a54a8c370 Add support for executing commands within a container (#63)
* Add support for executing commands within a container

* Add WebSocketNamespacedPodPortForwardAsync

* Add Attach functionality

* Simplify code
2017-12-10 22:21:09 -06:00
Boshi LIAN
9d30adb349 add test for json serialize 2017-12-02 14:06:10 +08:00
Boshi LIAN
88f50b1496 add csharp part of quntity 2017-12-02 14:06:10 +08:00
Boshi Lian
f7c0aa34d3 fix tests and examples to use v1.8 model 2017-12-02 14:01:57 +08:00
Boshi Lian
e599e61b70 add user part of int or string 2017-11-16 21:36:08 +08:00
Boshi Lian
d692f2e7db clean up and add testcases for less sensitive config loader 2017-11-12 04:42:37 +08:00
Boshi Lian
83559d5854 clean up test case naming 2017-11-11 03:50:30 +08:00
Boshi Lian
5cb18e9334 remove ctor api of KubernetesClientConfiguration, should use factory style 2017-11-11 03:47:15 +08:00
Boshi Lian
e06dcc57dc testcases: ensure handlers work with watcher 2017-11-11 03:47:15 +08:00
Brendan Burns
8016b6ce32 Merge pull request #47 from tg123/objorstatus
better way to #46
2017-11-10 11:04:38 -08:00
Boshi Lian
cdeebc1fd7 enlarge timeout to ensure watch test does not break by accident 2017-11-08 14:38:05 +08:00