Skip to content

Comments

vcluster platform config restructure#3433

Merged
johannesfrey merged 8 commits intomainfrom
config-restructure
Jan 29, 2026
Merged

vcluster platform config restructure#3433
johannesfrey merged 8 commits intomainfrom
config-restructure

Conversation

@johannesfrey
Copy link
Contributor

@johannesfrey johannesfrey commented Dec 23, 2025

Depends on https://github.com/loft-sh/loft-enterprise/pull/5745

TODOs after merge of https://github.com/loft-sh/loft-enterprise/pull/5745

  • Bump github.com/loft-sh/api/v4 and github.com/loft-sh/agentapi/v4

TODOs after merge of this PR

  • Create PR after running ./hack/generate-typescript-client.sh in platform in order to get schema for vcluster main.

What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix
/kind enhancement
/kind feature
/kind documentation
/kind test

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
Part of ENG-10404
Part of ENG-10495

Please provide a short message that should be published in the vcluster release notes
Fixed an issue where vcluster ...

What else do we need to know?

@johannesfrey johannesfrey force-pushed the config-restructure branch 3 times, most recently from 6e79f78 to e591520 Compare December 23, 2025 15:30
@johannesfrey johannesfrey force-pushed the config-restructure branch 3 times, most recently from 7e38cf3 to 4017d06 Compare January 8, 2026 08:32
@johannesfrey johannesfrey changed the title Config restructure vcluster platform config restructure Jan 8, 2026
@johannesfrey johannesfrey force-pushed the config-restructure branch 10 times, most recently from b28cdd3 to 7655daa Compare January 19, 2026 22:40
@johannesfrey johannesfrey marked this pull request as ready for review January 20, 2026 00:08
@johannesfrey johannesfrey marked this pull request as draft January 27, 2026 13:29
@johannesfrey johannesfrey force-pushed the config-restructure branch 2 times, most recently from f54ad1c to c2f8c9c Compare January 29, 2026 07:50
@johannesfrey johannesfrey marked this pull request as ready for review January 29, 2026 08:25
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

vcluster/config/config.go

Lines 1014 to 1019 in c2f8c9c

func (c *Config) IsProFeatureEnabled() bool {
if os.Getenv("SKIP_VALIDATE_PRO_FEATURES") == "true" {
return false
}
if len(c.Networking.ResolveDNS) > 0 {

P2 Badge Treat platform config as pro feature in IsProFeatureEnabled

After the platform config moved to top-level fields, IsProFeatureEnabled no longer accounts for platform/sleep/snapshots/deletion. addVCluster (in create_helm/create_docker) relies on this flag to decide whether to hard-fail when the user isn’t logged in and no API key secret is provided. With the current logic, a user can set platform.project (or sleep/snapshot/deletion) while not logged in; InitClientFromConfig fails, IsProFeatureEnabled returns false, and the CLI silently skips creating the platform secret, leaving the cluster unregistered and the platform-only features inactive. Consider treating the new platform-related fields as pro features or explicitly erroring when they’re set but no login/secret is available.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@github-actions
Copy link

Code review

I found 1 issue during code review:

Nil pointer dereference in IsConfiguredForSleepMode

File: config/config.go:933-939

The guard condition in IsConfiguredForSleepMode has inverted logic that can cause a nil pointer dereference. When c is nil, the AND condition short-circuits, making the guard false, and the function proceeds to line 938 where it attempts to access c.External["platform"] causing a panic.

Current code:

func (c *Config) IsConfiguredForSleepMode() bool {
    if c \!= nil && c.External \!= nil && c.External["platform"] == nil {
        return false
    }

    return c.External["platform"]["autoSleep"] \!= nil || c.External["platform"]["autoDelete"] \!= nil
}

Issue: The guard logic uses AND when it should use OR. When c is nil, the condition c \!= nil && ... evaluates to false, so the guard doesn't return early, and line 938 attempts c.External["platform"] which dereferences a nil pointer.

Suggested fix:

func (c *Config) IsConfiguredForSleepMode() bool {
    if c == nil || c.External == nil || c.External["platform"] == nil {
        return false
    }

    return c.External["platform"]["autoSleep"] \!= nil || c.External["platform"]["autoDelete"] \!= nil
}

This matches the correct pattern used in GetPlatformConfig:

vcluster/config/config.go

Lines 853 to 858 in 5634acc

// Port is the target port on the host service to connect to.
Port int `json:"port,omitempty"`
}
func (c *Config) UnmarshalYAMLStrict(data []byte) error {
return UnmarshalYAMLStrict(data, c)


Checked for bugs and CLAUDE.md compliance.

@johannesfrey johannesfrey merged commit d4e40ea into main Jan 29, 2026
42 checks passed
@johannesfrey johannesfrey deleted the config-restructure branch January 29, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants