Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/docker.yaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,16 +21,16 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: false

- name: Lint
uses: golangci/golangci-lint-action@v8
uses: golangci/golangci-lint-action@v9
with:
args: -D protogetter --timeout=5m

Expand DownExpand Up@@ -58,10 +58,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
FROM alpine:3.21
FROM alpine:3.23
COPY bin/metal-linux-amd64 /metal
ENTRYPOINT ["/metal"]
2 changes: 1 addition & 1 deletion cmd/admin/v1/audit.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,7 +113,7 @@ func (a *adminAudit) List() ([]*apiv1.AuditTrace, error) {

var code *int32
if viper.IsSet("result-code") {
code = pointer.Pointer(viper.GetInt32("result-code"))
code = new(viper.GetInt32("result-code"))
}

req := &adminv1.AuditServiceListRequest{
Expand Down
3 changes: 1 addition & 2 deletions cmd/admin/v1/commands.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ import (
"connectrpc.com/connect"
adminv1 "github.com/metal-stack-cloud/api/go/admin/v1"
"github.com/metal-stack-cloud/cli/cmd/config"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -49,7 +48,7 @@ func newStorageCmd(c *config.Config) *cobra.Command {

req := &adminv1.StorageServiceClusterInfoRequest{}
if viper.IsSet("partition") {
req.Partition = pointer.Pointer(viper.GetString("partition"))
req.Partition = new(viper.GetString("partition"))
}

resp, err := c.Client.Adminv1().Storage().ClusterInfo(ctx, connect.NewRequest(req))
Expand Down
3 changes: 1 addition & 2 deletions cmd/admin/v1/project.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/sorters"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -67,7 +66,7 @@ func (p *project) List() ([]*apiv1.Project, error) {

if viper.IsSet("limit") {
req.Paging = &apiv1.Paging{
Count: pointer.Pointer(viper.GetUint64("limit")),
Count: new(viper.GetUint64("limit")),
Page: nextPage,
}
}
Expand Down
11 changes: 5 additions & 6 deletions cmd/admin/v1/snapshot.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/config"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -79,19 +78,19 @@ func (c *snapshot) List() ([]*apiv1.Snapshot, error) {
req := &adminv1.StorageServiceListSnapshotsRequest{}

if viper.IsSet("uuid") {
req.Uuid = pointer.Pointer(viper.GetString("uuid"))
req.Uuid = new(viper.GetString("uuid"))
}
if viper.IsSet("name") {
req.Name = pointer.Pointer(viper.GetString("name"))
req.Name = new(viper.GetString("name"))
}
if viper.IsSet("project") {
req.Project = pointer.Pointer(viper.GetString("project"))
req.Project = new(viper.GetString("project"))
}
if viper.IsSet("partition") {
req.Partition = pointer.Pointer(viper.GetString("partition"))
req.Partition = new(viper.GetString("partition"))
}
if viper.IsSet("tenant") {
req.Tenant = pointer.Pointer(viper.GetString("tenant"))
req.Tenant = new(viper.GetString("tenant"))
}

resp, err := c.c.Client.Adminv1().Storage().ListSnapshots(ctx, connect.NewRequest(req))
Expand Down
9 changes: 4 additions & 5 deletions cmd/admin/v1/tenant.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/sorters"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -172,11 +171,11 @@ func (c *tenant) List() ([]*apiv1.Tenant, error) {
req := &adminv1.TenantServiceListRequest{}

if viper.IsSet("admitted") {
req.Admitted = pointer.Pointer(viper.GetBool("admitted"))
req.Admitted = new(viper.GetBool("admitted"))
}
if viper.IsSet("limit") {
req.Paging = &apiv1.Paging{
Count: pointer.Pointer(viper.GetUint64("limit")),
Count: new(viper.GetUint64("limit")),
Page: nextpage,
}
}
Expand All@@ -185,10 +184,10 @@ func (c *tenant) List() ([]*apiv1.Tenant, error) {
req.OauthProvider = &provider
}
if viper.IsSet("email") {
req.Email = pointer.Pointer(viper.GetString("email"))
req.Email = new(viper.GetString("email"))
}
if viper.IsSet("tenant") {
req.Tenant = pointer.Pointer(viper.GetString("tenant"))
req.Tenant = new(viper.GetString("tenant"))
}

resp, err := c.c.Client.Adminv1().Tenant().List(ctx, connect.NewRequest(req))
Expand Down
3 changes: 1 addition & 2 deletions cmd/admin/v1/token.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/sorters"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -58,7 +57,7 @@ func (c *token) List() ([]*apiv1.Token, error) {
req := &adminv1.TokenServiceListRequest{}

if viper.IsSet("user") {
req.UserId = pointer.Pointer(viper.GetString("user"))
req.UserId = new(viper.GetString("user"))
}

resp, err := c.c.Client.Adminv1().Token().List(ctx, connect.NewRequest(req))
Expand Down
11 changes: 5 additions & 6 deletions cmd/admin/v1/volume.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/config"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -79,19 +78,19 @@ func (c *volume) List() ([]*apiv1.Volume, error) {
req := &adminv1.StorageServiceListVolumesRequest{}

if viper.IsSet("uuid") {
req.Uuid = pointer.Pointer(viper.GetString("uuid"))
req.Uuid = new(viper.GetString("uuid"))
}
if viper.IsSet("name") {
req.Name = pointer.Pointer(viper.GetString("name"))
req.Name = new(viper.GetString("name"))
}
if viper.IsSet("project") {
req.Project = pointer.Pointer(viper.GetString("project"))
req.Project = new(viper.GetString("project"))
}
if viper.IsSet("partition") {
req.Partition = pointer.Pointer(viper.GetString("partition"))
req.Partition = new(viper.GetString("partition"))
}
if viper.IsSet("tenant") {
req.Tenant = pointer.Pointer(viper.GetString("tenant"))
req.Tenant = new(viper.GetString("tenant"))
}

resp, err := c.c.Client.Adminv1().Storage().ListVolumes(ctx, connect.NewRequest(req))
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/v1/audit.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -123,7 +123,7 @@ func (a *audit) List() ([]*apiv1.AuditTrace, error) {

var code *int32
if viper.IsSet("result-code") {
code = pointer.Pointer(viper.GetInt32("result-code"))
code = new(viper.GetInt32("result-code"))
}

req := &apiv1.AuditServiceListRequest{
Expand Down
23 changes: 10 additions & 13 deletions cmd/api/v1/cluster.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -363,7 +363,6 @@ func ClusterResponseToUpdate(r *apiv1.Cluster) *apiv1.ClusterServiceUpdateReques
func clusterWorkersToWorkerUpdate(workers []*apiv1.Worker) []*apiv1.WorkerUpdate {
var res []*apiv1.WorkerUpdate
for _, worker := range workers {
worker := worker

res = append(res, clusterWorkerToWorkerUpdate(worker))
}
Expand All@@ -374,11 +373,11 @@ func clusterWorkersToWorkerUpdate(workers []*apiv1.Worker) []*apiv1.WorkerUpdate
func clusterWorkerToWorkerUpdate(worker *apiv1.Worker) *apiv1.WorkerUpdate {
return &apiv1.WorkerUpdate{
Name: worker.Name,
MachineType: pointer.Pointer(worker.MachineType),
Minsize: pointer.Pointer(worker.Minsize),
Maxsize: pointer.Pointer(worker.Maxsize),
Maxsurge: pointer.Pointer(worker.Maxsurge),
Maxunavailable: pointer.Pointer(worker.Maxunavailable),
MachineType: new(worker.MachineType),
Minsize: new(worker.Minsize),
Maxsize: new(worker.Maxsize),
Maxsurge: new(worker.Maxsurge),
Maxunavailable: new(worker.Maxunavailable),
}
}

Expand DownExpand Up@@ -443,7 +442,6 @@ func (c *cluster) updateFromCLI(args []string) (*apiv1.ClusterServiceUpdateReque
}

for _, worker := range cluster.Workers {
worker := worker
if worker.Name == viper.GetString("worker-group") {
return worker, nil
}
Expand DownExpand Up@@ -515,25 +513,24 @@ func (c *cluster) updateFromCLI(args []string) (*apiv1.ClusterServiceUpdateReque
}

for _, worker := range cluster.Workers {
worker := worker

workerUpdate := clusterWorkerToWorkerUpdate(worker)

if worker.Name == selectedGroup.Name {
if viper.IsSet("worker-min") {
workerUpdate.Minsize = pointer.Pointer(viper.GetUint32("worker-min"))
workerUpdate.Minsize = new(viper.GetUint32("worker-min"))
}
if viper.IsSet("worker-max") {
workerUpdate.Maxsize = pointer.Pointer(viper.GetUint32("worker-max"))
workerUpdate.Maxsize = new(viper.GetUint32("worker-max"))
}
if viper.IsSet("worker-max-surge") {
workerUpdate.Maxsurge = pointer.Pointer(viper.GetUint32("worker-max-surge"))
workerUpdate.Maxsurge = new(viper.GetUint32("worker-max-surge"))
}
if viper.IsSet("worker-max-unavailable") {
workerUpdate.Maxunavailable = pointer.Pointer(viper.GetUint32("worker-max-unavailable"))
workerUpdate.Maxunavailable = new(viper.GetUint32("worker-max-unavailable"))
}
if viper.IsSet("worker-type") {
workerUpdate.MachineType = pointer.Pointer(viper.GetString("worker-type"))
workerUpdate.MachineType = new(viper.GetString("worker-type"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/api/v1/project.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,8 +229,8 @@ func (c *project) Convert(r *apiv1.Project) (string, *apiv1.ProjectServiceCreate
Description: r.Description,
}, &apiv1.ProjectServiceUpdateRequest{
Project: r.Uuid,
Name: pointer.Pointer(r.Name),
Description: pointer.Pointer(r.Description),
Name: new(r.Name),
Description: new(r.Description),
}, nil
}

Expand Down
7 changes: 3 additions & 4 deletions cmd/api/v1/snapshot.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,6 @@ import (
"github.com/metal-stack-cloud/cli/cmd/config"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand DownExpand Up@@ -101,13 +100,13 @@ func (c *snapshot) List() ([]*apiv1.Snapshot, error) {
Project: c.c.GetProject(),
}
if viper.IsSet("uuid") {
req.Uuid = pointer.Pointer(viper.GetString("uuid"))
req.Uuid = new(viper.GetString("uuid"))
}
if viper.IsSet("name") {
req.Name = pointer.Pointer(viper.GetString("name"))
req.Name = new(viper.GetString("name"))
}
if viper.IsSet("partition") {
req.Partition = pointer.Pointer(viper.GetString("partition"))
req.Partition = new(viper.GetString("partition"))
}

resp, err := c.c.Client.Apiv1().Snapshot().List(ctx, connect.NewRequest(req))
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/v1/tenant.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -290,7 +290,7 @@ func (c *tenant) updateRequestFromCLI(args []string) (*apiv1.TenantServiceUpdate
return nil, fmt.Errorf("you can only withdraw terms and conditions by deleting your account, please contact the metalstack.cloud support if necessary")
}

termsAndConditions = pointer.Pointer(true)
termsAndConditions = new(true)

ctx, cancel := c.c.NewRequestContext()
defer cancel()
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/v1/token.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,7 +86,7 @@ func newTokenCmd(c *config.Config) *cobra.Command {
return nil, fmt.Errorf("unknown role: %s", roleString)
}

adminRole = pointer.Pointer(apiv1.AdminRole(role))
adminRole = new(apiv1.AdminRole(role))
}

return &apiv1.TokenServiceCreateRequest{
Expand Down
7 changes: 3 additions & 4 deletions cmd/api/v1/volume.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ import (
"github.com/metal-stack-cloud/cli/pkg/helpers"
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/genericcli/printers"
"github.com/metal-stack/metal-lib/pkg/pointer"
"github.com/spf13/cobra"
"github.com/spf13/viper"

Expand DownExpand Up@@ -145,13 +144,13 @@ func (c *volume) List() ([]*apiv1.Volume, error) {
}

if viper.IsSet("uuid") {
req.Uuid = pointer.Pointer(viper.GetString("uuid"))
req.Uuid = new(viper.GetString("uuid"))
}
if viper.IsSet("name") {
req.Name = pointer.Pointer(viper.GetString("name"))
req.Name = new(viper.GetString("name"))
}
if viper.IsSet("partition") {
req.Partition = pointer.Pointer(viper.GetString("partition"))
req.Partition = new(viper.GetString("partition"))
}

resp, err := c.c.Client.Apiv1().Volume().List(ctx, connect.NewRequest(req))
Expand Down
Loading