Commit Graph

203 Commits

Author SHA1 Message Date
Andrew Stakhov
ae9dd04a2e Allow token refresh for GCP (#402) 2020-04-28 15:34:25 -07:00
Boshi Lian
cfc4306528 stylecop fix followup, enforce SA1503 (#432)
* enforce SA1503

* fix spacing

* fix SA1413

* fix spacing

* fix SA1013
2020-04-23 11:40:06 -07:00
Justin Kotalik
324a3e72fd Allow KUBECONFIG environment variable to point to multiple files (#411)
* Allow KUBECONFIG environment variable to point to multiple files

* Add more tests, add API (can make internal if necessary)

* test

* allow passing in env var

* small amount of feedback

* Feedback

* Nits

* Some extra tests and comments
2020-04-22 15:17:45 -07:00
Boshi Lian
8e7bf0b6f2 Stylecop (#428)
* add auto generate header

* run gen

* introduce first style analyizer

* fix tab
2020-04-22 13:41:45 -07:00
Brendan Burns
c1de779933 Add in formatting pre-check. (#431) 2020-04-22 12:15:45 -07:00
Andrew Stakhov
2dd9f60dbc Fix issue with WatchDispose test that had a race condition that may result in test failing (#427) 2020-04-20 15:30:12 -07:00
admilazz
392ebcf10c Override ToString on V1Status (#424) 2020-04-20 09:37:39 -07:00
admilazz
f2e1c4b883 Remove Microsoft.AspNetCore.WebUtilities dependency (#419)
* Remove Microsoft.AspNetCore.WebUtilities dependency

* Fix more query-string handling

* Add unit test

* Merge with master
2020-04-20 09:33:40 -07:00
Andrew Stakhov
b0e7d9979a Allow testing of the internal methods (#421) 2020-04-17 15:31:36 -07:00
Andrew Stakhov
4da6b657e0 Fix test project namespace inconsistency (#413) 2020-04-14 17:08:03 -07:00
Tyler Jensen
4e1c9bd20c Test exception type expected for .NET Standard 2.0 (#389)
* different exception type expected for 2.0

* remove net452 as tests cannot run for Framework

* Eliminate build target in test. Use common type.
2020-04-03 13:21:51 -07:00
Boshi Lian
d55a333bed fix watch=true doesn't respect cancellation token (#376)
* fix watch=true doesn't respect cancellation token

* use exp body where can

* address comments
2020-03-22 21:18:45 -07:00
Andy Kernahan
3e6815ad4c Ensure that awaits do not continue on the captured context. (#370)
* Ensure that awaits do not continue on the captured context.

* Make functions async for maintainability.

* Add documentation detailing the use of UIFact.
2020-03-18 21:54:44 -07:00
Ryan Nowak
da3bff5b3e Use value from ContextDetails to populate Namespace (#373)
* Use value from ContextDetails to populate Namespace

This is a fix for: #372

This change uses the value from ContextDetails.Namespace to populate
KubernetesClientConfiguration.Namespace.

The issue is there's a Namespace property on both Context and ContextDetails
 - The property on Context is used today
 - The property on ContextDetails is not
 - The property on ContextDetails maps to the actual yaml config

* Obsolete Context.Namespace

This property doesn't map to anything in the YAML and thus will never be
set. Other clients I checked (java, golang) don't look for a property
at this level.

I think this was likely a mistake, and it should be obsoleted because
it will never be populated.

Example:

```yaml
contexts:
- context:
    cluster: ...
    namespace: ... # this is ContextDetails.Namespace
    user: ...
  name: foo
```

```yaml
contexts:
- context:
    cluster: ...
    namespace: ...
    user: ...
  name: foo
  namespace: ... # this is Context.Namespace
```
2020-03-17 09:48:23 -07:00
Boshi Lian
0468a66de4 fix DisposeWatch test fickle (#365) 2020-03-09 14:35:36 -07:00
Boshi Lian
435ab5cd15 [breaking changes] cleanup targets (#361)
* remove target xamarin ios and android (supported by netstandard)

* remove 1.4

* build warning cleared

* remove bom

* fix ci failed
2020-03-08 15:57:34 -07:00
Kubernetes Prow Robot
b07e78afa4 Out-of-tree client authentication providers (UserCredentials exec option) for asp.net core applications (#359)
* Adding the user credentials exec abillity
	new file:   src/KubernetesClient/KubeConfigModels/ExecCredentialResponse.cs
	new file:   src/KubernetesClient/KubeConfigModels/ExternalExecution.cs
	modified:   src/KubernetesClient/KubeConfigModels/UserCredentials.cs
	modified:   src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs

* Fixed a few issues with the process spawning and some null references issues

* Removed unused import that caused the build to fail (Mail)

* Added preprocessor directive that will disable out-of-tree client authentication in case it is not a asp.net core app

* Added tests to the new external execution (out-of-tree client authentication) extension

* Trying to fix failing tests that fail apparently due to the preprocessor symbol

* Trying to fix failing macos tests

* Added the -n (do not output trailing newline) and the -E options to the echo command in OSX

* initializing arguments variable

* Changes according to tg123 comments
Changed OSX testing command to printf to try and solve the JSON
parsing errors

* Added missing references

* Environment.UserInteractive and Process applies to .NET Standard >= 2.0 according to Microsoft documentation
2020-03-05 09:12:38 -08:00
Brendan Burns
67be97e74b Add a loadAll to load multiple objects from a single YAML. (and tests) (#344) 2020-01-10 13:59:37 -08:00
idubnori
f67aaec566 Fix - Not applied patch if path contains Uppercase (#330)
* Add JsonPatchTests

* Upgrade JsonPatch and Json.net, if netstandard2.0 or netcoreapp2.1
2019-12-05 17:42:49 -08:00
Boshi Lian
35f54a779f make windows happy (#314) 2019-10-22 16:04:12 -07:00
Boshi Lian
a95400bd50 watcher to support empty response (#313)
* Add a WatchAsync method.

* proposal for watcher async

* fix and add testcase for async watch

* try fix build
2019-10-22 16:02:13 -07:00
Brendan Burns
239125a85d Fix YAML serialization for IntOrString values. (#310) 2019-09-30 00:47:37 -07:00
Boshi Lian
e3e5ee9a41 fix build 2019-06-24 04:25:54 -07:00
Frederik Carlier
466e33995d Prototype Exec API (#271) 2019-04-01 14:18:34 -07:00
Frederik Carlier
425d4f81f0 Update NuGet dependencies for the Tests project (#260) 2019-03-20 08:55:04 -07:00
Frederik Carlier
9ae3cb38fc Fix build warnings in the StreamDemuxerTests (#259)
* Make sure StreamDemuxer.Start() returns immediately.

* Make MockWebSocket.RecieveAsync cancellable

* Fix staging
2019-03-20 08:53:04 -07:00
etchang
9bdaf132d4 Add bundle certificate support (#253)
* initial

* add some comments

* cleanup

* var

* Use X509Certificate2cCollection

* add missing asset files

* address comments
2019-03-11 06:39:28 -07:00
Boshi Lian
e0db2ae8bd add az pipepline yaml (#247)
* add az pipepline yaml

* use az pipeline versioning

* build on vsts condition
2019-03-04 16:12:39 -08:00
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