-
Notifications
You must be signed in to change notification settings - Fork 307
feat: enhance Kubernetes client with watch functionality #1667
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
Open
lqlive
wants to merge
13
commits into
kubernetes-client:master
Choose a base branch
from
lqlive:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+645
−91
Open
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
80b46b7
feat: enhance Kubernetes client with watch functionality
lqlive 6979dd5
refactor: simplify watch event handling in Kubernetes client example
lqlive 136b103
refactor: update Kubernetes watch functionality to use new event hand…
lqlive f9a3d9c
fix
lqlive 201be85
fix
lqlive 942a645
Merge branch 'master' into master
lqlive 9ac1f9c
fix: correct usage of Pod list items in client example and update Obs…
lqlive 4d752ed
fix: update client example to use correct Pod list method and improve…
lqlive 5e47c09
Merge branch 'kubernetes-client:master' into master
lqlive 6de5558
refactor: enhance type resolution for list items in TypeHelper by add…
lqlive c6bda21
feat: mark Watch methods as obsolete to prepare for future deprecation
lqlive 85d7011
fix
lqlive 0877710
refactor: update WatcherExt class to internal and remove obsolete att…
lqlive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
using k8s; | ||
using k8s; | ||
using k8s.ClientSets; | ||
Check warning on line 2 in examples/clientset/Program.cs
|
||
using System.Threading.Tasks; | ||
Check warning on line 3 in examples/clientset/Program.cs
|
||
|
||
namespace clientset | ||
Check warning on line 5 in examples/clientset/Program.cs
|
||
{ | ||
internal class Program | ||
{ | ||
|
@@ -12,15 +11,21 @@ | |
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(); | ||
var client = new Kubernetes(config); | ||
|
||
ClientSet clientSet = new ClientSet(client); | ||
var clientSet = new ClientSet(client); | ||
var list = await clientSet.CoreV1.Pod.ListAsync("default").ConfigureAwait(false); | ||
foreach (var item in list) | ||
{ | ||
System.Console.WriteLine(item.Metadata.Name); | ||
} | ||
|
||
var pod = await clientSet.CoreV1.Pod.GetAsync("test","default").ConfigureAwait(false); | ||
var pod = await clientSet.CoreV1.Pod.GetAsync("test", "default").ConfigureAwait(false); | ||
System.Console.WriteLine(pod?.Metadata?.Name); | ||
|
||
var watch = clientSet.CoreV1.Pod.WatchListAsync("default"); | ||
await foreach (var (_, item)in watch.ConfigureAwait(false)) | ||
{ | ||
System.Console.WriteLine(item.Metadata.Name); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.