-
Notifications
You must be signed in to change notification settings - Fork 0
Hotfix/dockerhub local #50
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -51,7 +51,7 @@ public CreateClusterCommand( | |||||
| controlNodes.Aliases.Add("-c"); | ||||||
| var workers = new Option<int>("--Workers") { DefaultValueFactory = _ => Defaults.WorkerNodes, Description = "The number of worker nodes in the cluster." }; | ||||||
| workers.Aliases.Add("-w"); | ||||||
| var kubeVersion = new Option<string>("--KubeVersion") { DefaultValueFactory = _ => "1.29", Description = "The kubernetes api version." }; | ||||||
| var kubeVersion = new Option<string>("--KubeVersion") { DefaultValueFactory = _ => "1.32", Description = "The kubernetes api version." }; | ||||||
| kubeVersion.Aliases.Add("-k"); | ||||||
|
|
||||||
| Options.Add(nameOption); | ||||||
|
|
@@ -111,6 +111,16 @@ public async Task InvokeAsync(string name = Defaults.ClusterName, int controlPla | |||||
| return; | ||||||
| } | ||||||
|
|
||||||
| // Write hosts.toml to a temp file for containerd registry config | ||||||
| // This ensures the file is accessible to Docker regardless of working directory | ||||||
| var hostsTomlContent = """ | ||||||
| server = "http://host.docker.internal:5000" | ||||||
| [host."http://host.docker.internal:5000"] | ||||||
| capabilities = ["pull", "resolve"] | ||||||
| """; | ||||||
| var hostsTomlPath = _fileSystem.Path.Combine(_fileSystem.Path.GetTempPath(), $"hosts-{Guid.NewGuid()}.toml"); | ||||||
|
||||||
| var hostsTomlPath = _fileSystem.Path.Combine(_fileSystem.Path.GetTempPath(), $"hosts-{Guid.NewGuid()}.toml"); | |
| var hostsTomlPath = _fileSystem.Path.Combine(_fileSystem.Path.GetTempPath(), "vdk-hosts-hub.dev-k8s.cloud.toml"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using System.Net; | ||
| using System.Text.Json; | ||
| using k8s; | ||
| using k8s.Autorest; | ||
| using k8s.Models; | ||
|
|
@@ -114,6 +115,91 @@ public void Bootstrap(string clusterName, string path, string branch = DefaultBr | |
| } | ||
|
|
||
| _console.WriteLine("Flux bootstrap complete."); | ||
|
|
||
|
|
||
| } | ||
|
|
||
| public bool WaitForKustomizations(string clusterName, int maxAttempts = 60, int delaySeconds = 5) | ||
| { | ||
|
Comment on lines
+121
to
+122
|
||
| _console.WriteLine("Waiting for Flux kustomizations to reconcile..."); | ||
|
|
||
| for (int attempt = 0; attempt < maxAttempts; attempt++) | ||
| { | ||
| try | ||
| { | ||
| var result = _client(clusterName).ApiClient.CustomObjects | ||
| .ListNamespacedCustomObject( | ||
| "kustomize.toolkit.fluxcd.io", "v1", | ||
| "flux-system", "kustomizations"); | ||
|
|
||
| var json = JsonSerializer.Serialize(result); | ||
| using var doc = JsonDocument.Parse(json); | ||
| var items = doc.RootElement.GetProperty("items"); | ||
|
|
||
| if (items.GetArrayLength() == 0) | ||
| { | ||
| if (attempt % 5 == 0) | ||
| _console.WriteLine(" No kustomizations found yet. Waiting..."); | ||
| Thread.Sleep(delaySeconds * 1000); | ||
| continue; | ||
| } | ||
|
|
||
| int total = items.GetArrayLength(); | ||
| int readyCount = 0; | ||
|
|
||
| foreach (var item in items.EnumerateArray()) | ||
| { | ||
| var name = item.GetProperty("metadata").GetProperty("name").GetString(); | ||
| bool isReady = false; | ||
|
|
||
| if (item.TryGetProperty("status", out var status) && | ||
| status.TryGetProperty("conditions", out var conditions)) | ||
| { | ||
| foreach (var condition in conditions.EnumerateArray()) | ||
| { | ||
| if (condition.GetProperty("type").GetString() == "Ready") | ||
| { | ||
| var condStatus = condition.GetProperty("status").GetString(); | ||
|
Comment on lines
+151
to
+161
|
||
| if (condStatus == "True") | ||
| { | ||
| isReady = true; | ||
| } | ||
| else if (attempt % 5 == 0) | ||
| { | ||
| var reason = condition.TryGetProperty("reason", out var r) | ||
| ? r.GetString() : "Unknown"; | ||
| var message = condition.TryGetProperty("message", out var m) | ||
| ? m.GetString() : ""; | ||
| _console.WriteLine( | ||
| $" Kustomization '{name}' not ready: {reason} - {message}"); | ||
| } | ||
| break; | ||
| } | ||
| } | ||
|
Comment on lines
+157
to
+177
|
||
| } | ||
|
|
||
| if (isReady) readyCount++; | ||
| } | ||
|
|
||
| if (attempt % 5 == 0 || readyCount == total) | ||
| _console.WriteLine($" Kustomizations ready: {readyCount}/{total}"); | ||
|
|
||
| if (readyCount == total) | ||
| { | ||
| _console.WriteLine("All Flux kustomizations are ready."); | ||
| return true; | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (attempt % 5 == 0) | ||
| _console.WriteLine($" Error checking kustomizations: {ex.Message}. Retrying..."); | ||
| } | ||
|
|
||
| Thread.Sleep(delaySeconds * 1000); | ||
| } | ||
|
|
||
| _console.WriteWarning( | ||
| "Timed out waiting for Flux kustomizations to reconcile. Proceeding anyway..."); | ||
| return false; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ namespace Vdk.Services; | |
| public interface IFluxClient | ||
| { | ||
| void Bootstrap(string clusterName, string path, string branch = FluxClient.DefaultBranch); | ||
| bool WaitForKustomizations(string clusterName, int maxAttempts = 60, int delaySeconds = 5); | ||
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation still references Kubernetes version 1.29 as the default, but the code has been updated to use 1.32. The documentation files docs/usage/command-reference.md (line 39) and docs/usage/creating-clusters.md (line 31) should be updated to reflect the new default version of 1.32.