Skip to content

Commit

Permalink
feat: Enable support for capmox
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Teich <matthias.teich@gdata.de>
  • Loading branch information
Mattes83 committed Jan 7, 2025
1 parent 46f4d51 commit 2ec6b55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/proxmox-cloud-controller-manager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ maintainers:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.9
version: 0.2.10
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
5 changes: 4 additions & 1 deletion pkg/cluster/cloud_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ import (
// Provider specifies the provider. Can be 'default' or 'capmox'
type Provider string

// ProviderDefault is the default provider
const ProviderDefault Provider = "default"

// ProviderCapmox is the Provider for capmox
const ProviderCapmox Provider = "capmox"

// ClustersConfig is proxmox multi-cluster cloud config.
type ClustersConfig struct {
Features struct {
Provider Provider `yaml:"provider,omitempty"`
}
} `yaml:"features,omitempty"`
Clusters []struct {
URL string `yaml:"url"`
Insecure bool `yaml:"insecure,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion pkg/proxmox/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func (i *instances) getInstance(node *v1.Node) (*pxapi.VmRef, string, error) {
if i.provider == cluster.ProviderCapmox {
uuid := node.Status.NodeInfo.SystemUUID
vmRef, region, err := i.c.FindVMByUUID(uuid)

if err != nil {
return nil, "", fmt.Errorf("instances.getInstance() error: %v", err)
}
Expand Down Expand Up @@ -258,6 +259,6 @@ func (i *instances) getInstanceType(vmRef *pxapi.VmRef, region string) (string,
}

return fmt.Sprintf("%.0fVCPU-%.0fGB",
vmInfo["maxcpu"].(float64), //nolint:errcheck
vmInfo["maxcpu"].(float64), //nolint:errcheck
vmInfo["maxmem"].(float64)/1024/1024/1024), nil //nolint:errcheck
}

0 comments on commit 2ec6b55

Please sign in to comment.