Commit Graph

342 Commits

Author SHA1 Message Date
Fraser Waters
c47babf203 Parse clientCertificateData/clientKeyData from auth plugins (#479)
* Parse clientCertificateData/clientKeyData from auth plugins

Currently ExecuteExternalCommand crashes with a key not found error if
it runs a certificate based (rather than token based) plugin. This
commit will now return either the token string, or the certificate and
key strings which are then used to set the relevant fields on the
configuration object.

* Fix formatting

* Use new return style
2020-09-18 21:56:28 -07:00
Ludovic Alarcon
2d5c7c0317 Metrics optional property (#474)
* fix: timespan can be optional

* use one comment on properties
2020-08-10 15:51:59 -07:00
Ludovic Alarcon
4ea7c26f11 Nodes and pods metrics tests (#471)
* Add pod metrics empty response test

* Add test for pod metrics by namespace

* Add test for non existing namespace
2020-08-08 16:24:19 -07:00
Ludovic Alarcon
5411bb6651 Nodes and pods metrics (#466)
* Add models for node metrics

* Add models for pod metrics

* Add extension method for node metrics

* Add extension method for pods metrics

* dotnet format

* fix type: use of interface type

* Add metrics sample

* Add tests for node and pod metrics
2020-08-02 21:53:42 -07:00
Richard Semmens
b5f5681b21 Fix declaration of authentication environment variables and add test. (#459)
* Fix declaration of authentication environment variables and add test.

* Run dotnet format

* Run dotnet format
2020-06-27 22:44:14 -07:00
Kyle J. Fischer
187ec8fb18 Removed NETSTANDARD2_0 IFDefs and added Brackets (#451)
* Removed NETSTANDARD2_0 IFDefs and Fixed some brackets it wouldn't let me build if I didn't fix them

* Removed bracket changes

* Fixed Formatting hopefully

* Updated StartInfo.EnvironmentVariables from StartInfo.Environment so it is compatiable with 4.5.2

* Forgot I had changed this and didn't check git diff till now. My Bad

* Missed a spot where it was referencing Envrionment and not EnvironmentVariables
2020-05-29 11:32:34 -07:00
Andrew Stakhov
f1a3586c43 Support for conversions between models of different versions (#420) 2020-05-20 16:28:19 -07:00
admilazz
a4ff002bde Add convenient model extensions (#405)
* Add useful model extensions

* Rename a function

* Add more model extensions; add unit tests

* Add a couple more extensions requested in PR

* Rebase on master

* Remove unused using statement
2020-05-18 15:11:36 -07:00
Shihang Zhang
6d5fefdbab add TokenFileAUth which reloads token if it expires (#440) 2020-05-18 15:01:36 -07:00
Alexey Golub
914c78b5f9 Fix reading incorrect stream in ExecuteExternalCommand (#444) 2020-05-11 14:14:22 -07:00
Ridwan Hoq
b32f9d1567 Quoted non-string values remain quoted after serialization (#442)
* add failing test for environment variable and annotation yaml serialization

* simplify the test case

* initial tests passing with StringQuotingEmitter

* cleanup

* expand test

* add attribution

* run dotnet format
2020-05-11 14:12:21 -07:00
Alexey Golub
4c85bc1de1 Use invariant culture when parsing fractions (#443) 2020-05-11 13:46:12 -07:00
Andrew Stakhov
9bd8ed6350 Fix issue with test randomly failing on windows - exclude from windows runner (#434) 2020-05-04 16:01:08 -07:00
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
Boshi Lian
56b7f76d6c path combine instead of string concat (#429) 2020-04-22 09:09:52 -07:00
Boshi Lian
732653096d remove travis related files (#430) 2020-04-22 09:07:54 -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
233dc03ac8 Share code to create ServiceClientCredentials (#425) 2020-04-20 09:39:40 -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
Andreas Häber
0fe237f3d6 Improve documentation for BuildDefaultConfig (#423)
The current documentation only mentions that it uses a default config file. However, it actually works with a lot more than that and it is helpful to see that in the documentation.
2020-04-17 02:19:52 -07:00
admilazz
fcfeeedba2 Remove retry (#415)
* Remove RetryDelegatingHandler

* Slightly optimize WatcherDelegatingHandler

* Fix tests; remove WatcherDelegatingHandler changes
2020-04-16 10:54:47 -07:00
admilazz
33e0b28138 Add WatchEventType.Bookmark (#414)
* Add WatchEventType.Bookmark

* Avoid changing value order
2020-04-16 10:52:46 -07:00
Andrew Stakhov
4da6b657e0 Fix test project namespace inconsistency (#413) 2020-04-14 17:08:03 -07:00
Boshi Lian
4ce6e876e2 Gen v1.18.0 (#385)
* gen v1.18.0

* Update version.json

* add missing files

* bump to 2.0
2020-04-10 19:17:47 -07:00
Andrew Stakhov
326243b5b0 Add gitattributes to properly process some filetypes and exclude autogenerated code from LOC statistics (#407) 2020-04-09 15:15:48 -07:00
admilazz
7ea11a75f6 Add IKubernetesObject<TMetadata> (#404) 2020-04-09 15:13:48 -07:00
Andy Kernahan
e90be77e42 Fix nuget's "Setup SxS dotnet" not being run. (#401) 2020-04-06 05:25:33 -07:00
Andy Kernahan
944622dd65 Upgrade to .NET Core SDK 3.1. (#395)
* Upgrade to .NET Core SDK 3.1.

* Add workaround for setup-dotnet not supporting SxS dotnet installs.

* Specify explicit fetch depth of 0 for Nerdbank.GitVersioning.

* Make step names consistent across workflows.

* Coerce robocopy's exit code when it does not indicate an error.

* Make robocopy as quiet as possible.
2020-04-06 02:51:48 -07:00
Nicholas Steicke
3164e9234c introduce CreateWatchHandle for use with HttpClientFactory (#379) 2020-04-05 21:27:46 -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
Andy Kernahan
3e94068d43 Improve Watcher thread utilisation. (#386)
* Add Watcher constructor overload which accepts the more general TextReader.

* Make CancelableStream delegate the async methods to the inner stream.

* Make CancelableStream dispose of the inner stream.

* Make PeekableStreamReader a decorator enabling direct delegation to the inner's asynchronous methods.

* Make CancelableStream.Flush respect the cancellation token.

* Rename CancellationTokenSourceSlim -> LinkedCancellationTokenSource.

* Specify 7.3 language version.
2020-03-31 19:45:27 -07:00
Tyler Jensen
ddb4b21aeb Remove dupe null check (#384) 2020-03-25 14:45:41 -07:00
Andrew Stakhov
c48fc0dc56 Add interfaces for generated Kubernetes objects (#378)
* Add interfaces for generated Kubernetes objects that can allow working with them without using concrete types. This work is needed for future shared informers / controllers components being developed

* Add metadata for plural names. This opens up a path for many generic  operations as plural name is needed to construct path
2020-03-22 21:22:45 -07:00
Boshi Lian
40026e40a5 update source link to release (#377) 2020-03-22 21:20:45 -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
Boshi Lian
af741302de fix watch generator uses different name pattern from gen project (#369)
* fix watch generator uses different name pattern from gen project

* run generator to refresh bad files

* fix npe when not x-kind
2020-03-17 13:57:26 -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
c1bab3caed following up after switching to gh action (#367)
* disable az pipeline

* disable ci coverage report

* do test before push

* remove push nuget from travis

* fix coverage ignore
2020-03-13 21:58:34 -07:00
Boshi Lian
c8de0ca263 Introduce githuh action (#364)
* gh build and test

* fix dotnet env

* fix DisposeWatch test fickle

* mini 0??

* nuget push from gh
2020-03-10 15:19:57 -07:00
Boshi Lian
7749ae07c8 revert move fraction internal (#366) 2020-03-10 15:19:37 -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