-
Notifications
You must be signed in to change notification settings - Fork 1
feat: deploy k0s install config #110
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: OliverTrautvetter <[email protected]>
…here-cloud/oms into deploy_k0s_install-config
Signed-off-by: OliverTrautvetter <[email protected]>
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 20 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: OliverTrautvetter <[email protected]>
Co-authored-by: Copilot <[email protected]>
…here-cloud/oms into deploy_k0s_install-config
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.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 15 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else { | ||
| filteredData, err := os.ReadFile(filteredConfigPath) | ||
| if err != nil { | ||
| log.Printf("Warning: failed to read filtered config: %v", err) | ||
| } else { | ||
| if err := os.WriteFile(configPath, filteredData, 0644); err != nil { | ||
| log.Printf("Warning: failed to write filtered config back: %v", err) | ||
| } | ||
| } | ||
| _ = os.Remove(filteredConfigPath) | ||
| } | ||
| args = append(args, "--config", configPath) |
Copilot
AI
Dec 18, 2025
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.
This code reads the filtered config, then immediately overwrites the original config file. This modifies the user's original install-config file, which is unexpected behavior. The original file should be preserved, and the filtered config should be used directly for the k0s install command instead of overwriting the input file.
| } else { | |
| filteredData, err := os.ReadFile(filteredConfigPath) | |
| if err != nil { | |
| log.Printf("Warning: failed to read filtered config: %v", err) | |
| } else { | |
| if err := os.WriteFile(configPath, filteredData, 0644); err != nil { | |
| log.Printf("Warning: failed to write filtered config back: %v", err) | |
| } | |
| } | |
| _ = os.Remove(filteredConfigPath) | |
| } | |
| args = append(args, "--config", configPath) | |
| args = append(args, "--config", configPath) | |
| } else { | |
| // Use the filtered config directly for k0s without modifying the original file | |
| args = append(args, "--config", filteredConfigPath) | |
| } |
| } else { | ||
| conn, err := net.Dial("unix", authSocket) | ||
| if err != nil { | ||
| log.Printf("failed to dial SSH agent socket: %v", err) | ||
| } else { | ||
| ag := agent.NewClient(conn) | ||
| if err := agent.ForwardToAgent(client, ag); err != nil { | ||
| log.Printf("failed to forward agent to remote client: %v", err) | ||
| } | ||
| if session != nil { | ||
| if err := agent.RequestAgentForwarding(session); err != nil { | ||
| log.Printf("failed to request agent forwarding on session: %v", err) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
Copilot
AI
Dec 18, 2025
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 forwardAgent function always returns nil, even when agent forwarding fails. This means errors in SSH agent forwarding are silently ignored (only logged). If agent forwarding is critical for the operation, errors should be properly returned so callers can decide whether to proceed or fail.
| } else { | |
| conn, err := net.Dial("unix", authSocket) | |
| if err != nil { | |
| log.Printf("failed to dial SSH agent socket: %v", err) | |
| } else { | |
| ag := agent.NewClient(conn) | |
| if err := agent.ForwardToAgent(client, ag); err != nil { | |
| log.Printf("failed to forward agent to remote client: %v", err) | |
| } | |
| if session != nil { | |
| if err := agent.RequestAgentForwarding(session); err != nil { | |
| log.Printf("failed to request agent forwarding on session: %v", err) | |
| } | |
| } | |
| } | |
| } | |
| // Treat absence of SSH_AUTH_SOCK as "no agent available", not as an error. | |
| return nil | |
| } | |
| conn, err := net.Dial("unix", authSocket) | |
| if err != nil { | |
| log.Printf("failed to dial SSH agent socket: %v", err) | |
| return fmt.Errorf("failed to dial SSH agent socket: %w", err) | |
| } | |
| ag := agent.NewClient(conn) | |
| if err := agent.ForwardToAgent(client, ag); err != nil { | |
| log.Printf("failed to forward agent to remote client: %v", err) | |
| return fmt.Errorf("failed to forward agent to remote client: %w", err) | |
| } | |
| if session != nil { | |
| if err := agent.RequestAgentForwarding(session); err != nil { | |
| log.Printf("failed to request agent forwarding on session: %v", err) | |
| return fmt.Errorf("failed to request agent forwarding on session: %w", err) | |
| } | |
| } |
internal/installer/k0s.go
Outdated
| specKeysToKeep := map[string]bool{ | ||
| "api": true, | ||
| "controllerManager": true, | ||
| "scheduler": true, | ||
| "extensions": true, | ||
| "network": true, | ||
| "storage": true, | ||
| "telemetry": true, | ||
| "images": true, | ||
| "konnectivity": true, | ||
| } |
Copilot
AI
Dec 18, 2025
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 specKeysToKeep map lists valid k0s spec fields. Like the top-level fields, this hardcoded list could become outdated as k0s evolves. Consider adding a comment referencing the k0s documentation version this is based on, or making this configurable.
| ------ | ||
| To install Codesphere eg.: | ||
| To install k0s (run inside lima): |
Copilot
AI
Dec 18, 2025
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.
Spelling correction: "eg." should be "e.g." (with periods after each letter)
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…here-cloud/oms into deploy_k0s_install-config
…pdate error message in tests
The existing Codespehere install-config format to set up and configure k0s.
Clickup