Skip to content
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

Backports and gomod dependency updates (stable-5.21) #13244

Merged
merged 32 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2c2f513
test/lint/client-imports: rename godeps.list file
simondeziel Mar 27, 2024
9fc35bf
test/lint/client-imports: export LC_ALL for predictable sorting
simondeziel Mar 27, 2024
8a371ca
test/lint: add lxd-agent-imports
simondeziel Mar 27, 2024
7c989fb
gitignore: Ignore all `.bak`
MggMuggins Mar 28, 2024
9689f89
shared/api: Fix typo
roosterfish Mar 25, 2024
5ea61b2
lxd/api_metrics: Check individual project permissions if set
roosterfish Mar 25, 2024
fdaeef9
lxd/metrics: Use label aware permission check when filtering samples
roosterfish Mar 26, 2024
fa6116e
lxd/api_metrics: Filter metrics by looping only once
roosterfish Mar 25, 2024
645d832
lxd/auth/driver_tls: Allow viewing metrics for unrestricted metrics c…
roosterfish Mar 25, 2024
5e5f4e9
lxd/db/cluster: Add identityTypeCertificateMetricsRestricted and iden…
roosterfish Mar 26, 2024
e5d4476
lxd/db/cluster/identities: Handle unrestricted metrics certificates
roosterfish Mar 28, 2024
1be949f
shared/api/auth: Replace IdentityTypeCertificateMetrics with a restri…
roosterfish Mar 26, 2024
fe6b6ba
lxd/daemon: Use IdentityTypeCertificateMetricsRestricted and Identity…
roosterfish Mar 26, 2024
1a60684
lxd/db/cluster/certificates: Use IdentityTypeCertificateMetricsRestri…
roosterfish Mar 26, 2024
024c122
lxd/identity: Use IdentityTypeCertificateMetricsRestricted and Identi…
roosterfish Mar 26, 2024
f4db647
lxd/auth/openfga: Extend can_view_metrics entitlement to projects
roosterfish Mar 26, 2024
da71678
lxd/db/cluster/update: Fix updateFromV69
roosterfish Mar 26, 2024
aab49aa
test/suites/auth: Update test to account for can_view_metrics
roosterfish Mar 26, 2024
9c3d5d2
test/suites/metrics: Add restricted and unrestricted certificate tests
roosterfish Mar 27, 2024
7896e0a
shared: Return new structure from `ParseLXDFileHeaders`
MggMuggins Mar 28, 2024
3d8cbf0
lxd: Refactor calls to `shared.ParseLXDFileHeaders`
MggMuggins Mar 28, 2024
62da816
client: Refactor calls to `shared.ParseLXDFileHeaders`
MggMuggins Mar 28, 2024
619ae2a
api: Add `instances_files_modify_permissions` extension
MggMuggins Mar 28, 2024
52699b3
shared: Parse `X-LXD-modify-perm` header
MggMuggins Mar 28, 2024
3e75d74
lxd: Allow setting permissions for existing files via API
MggMuggins Mar 28, 2024
9cfde0e
client: Send `X-LXD-modify-perm` on file POST
MggMuggins Mar 28, 2024
b64aa4b
lxc/file: Set ModifyExisting when --mode, --uid, or --gid are passed
MggMuggins Mar 28, 2024
a6d61cf
doc: Run `make update-api`
MggMuggins Mar 28, 2024
061b563
gomod: Update dependencies
tomponline Apr 2, 2024
91bf8fa
incusd/instance/qemu: Set auto-converge on all migrations
stgraber Mar 27, 2024
7002db0
incusd/device/disk: Remove bad comment
stgraber Mar 27, 2024
7d3ae3e
lxc/config/default: Add images remote for images.lxd.canonical.com
tomponline Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ lxd-*.tar.gz
.vagrant
*~
tags
**/*.bak
tomponline marked this conversation as resolved.
Show resolved Hide resolved

# Potential binaries
fuidshift/fuidshift
Expand Down
6 changes: 6 additions & 0 deletions client/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,12 @@ type InstanceFileArgs struct {
// File permissions
Mode int

// Whether to modify the permissions of existing files (see the
// instances_files_modify_permissions api extension)
GIDModifyExisting bool
UIDModifyExisting bool
ModeModifyExisting bool

// File type (file or directory)
Type string

Expand Down
14 changes: 9 additions & 5 deletions client/lxd_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,12 +809,16 @@ func (r *ProtocolLXD) GetContainerFile(containerName string, path string) (io.Re
}

// Parse the headers
uid, gid, mode, fileType, _ := shared.ParseLXDFileHeaders(resp.Header)
headers, err := shared.ParseLXDFileHeaders(resp.Header)
if err != nil {
return nil, nil, fmt.Errorf("Failed to parse response headers: %w", err)
}

fileResp := ContainerFileResponse{
UID: uid,
GID: gid,
Mode: mode,
Type: fileType,
UID: headers.UID,
GID: headers.GID,
Mode: headers.Mode,
Type: headers.Type,
}

if fileResp.Type == "directory" {
Expand Down
32 changes: 27 additions & 5 deletions client/lxd_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,12 +1492,16 @@ func (r *ProtocolLXD) GetInstanceFile(instanceName string, filePath string) (io.
}

// Parse the headers
uid, gid, mode, fileType, _ := shared.ParseLXDFileHeaders(resp.Header)
headers, err := shared.ParseLXDFileHeaders(resp.Header)
if err != nil {
return nil, nil, err
}

fileResp := InstanceFileResponse{
UID: uid,
GID: gid,
Mode: mode,
Type: fileType,
UID: headers.UID,
GID: headers.GID,
Mode: headers.Mode,
Type: headers.Type,
}

if fileResp.Type == "directory" {
Expand Down Expand Up @@ -1593,6 +1597,24 @@ func (r *ProtocolLXD) CreateInstanceFile(instanceName string, filePath string, a
req.Header.Set("X-LXD-write", args.WriteMode)
}

var modifyPerm []string

if args.UIDModifyExisting {
modifyPerm = append(modifyPerm, "uid")
}

if args.GIDModifyExisting {
modifyPerm = append(modifyPerm, "gid")
}

if args.ModeModifyExisting {
modifyPerm = append(modifyPerm, "mode")
}

if len(modifyPerm) != 0 && r.CheckExtension("instance_files_modify_permissions") == nil {
req.Header.Set("X-LXD-modify-perm", strings.Join(modifyPerm, ","))
}

// Send the request
resp, err := r.DoHTTP(req)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions doc/api-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2392,3 +2392,9 @@ Adds the ability to limit disk I/O for virtual machines.
## `storage_volumes_all`

This API extension adds support for listing storage volumes from all storage pools via `/1.0/storage-volumes` or `/1.0/storage-volumes/{type}` to filter by volume type. Also adds a `pool` field to storage volumes.

## `instances_files_modify_permissions`

Adds the ability for `POST /1.0/instances/{name}/files` to modify the permissions of files that already exist via the `X-LXD-modify-perm` header.

`X-LXD-modify-perm` should be a comma-separated list of 0 or more of `mode`, `uid`, and `gid`.
6 changes: 6 additions & 0 deletions doc/rest-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10247,6 +10247,12 @@ paths:
name: X-LXD-mode
schema:
type: integer
- description: Comma-separated list of permissions to set for pre-existing files (0 or more of `uid`, `gid`, `mode`)
example: uid,gid,mode
in: header
name: X-LXD-modify-perm
schema:
type: integer
- description: Type of file (file, symlink or directory)
example: file
in: header
Expand Down
26 changes: 13 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/oklog/ulid/v2 v2.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/openfga/api/proto v0.0.0-20240318145204-66b9e5cb403c
github.com/openfga/language/pkg/go v0.0.0-20240312214103-2c2688b46b9c
github.com/openfga/language/pkg/go v0.0.0-20240401190211-052b5357673a
github.com/openfga/openfga v1.5.1
github.com/osrg/gobgp/v3 v3.24.0
github.com/pkg/sftp v1.13.6
Expand All @@ -48,7 +48,7 @@ require (
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635
github.com/vishvananda/netlink v1.2.1-beta.2
github.com/zitadel/oidc/v2 v2.12.0
go.starlark.net v0.0.0-20240307200823-981680b3e495
go.starlark.net v0.0.0-20240329153429-e6e8e7ce1b7a
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.21.0
golang.org/x/oauth2 v0.18.0
Expand All @@ -59,18 +59,18 @@ require (
google.golang.org/protobuf v1.33.0
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
gopkg.in/yaml.v2 v2.4.0
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
)

require (
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/digitalocean/go-libvirt v0.0.0-20240229222500-83343b985513 // indirect
github.com/digitalocean/go-libvirt v0.0.0-20240308204700-df736b2945cf // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eapache/channels v1.1.0 // indirect
github.com/eapache/queue v1.1.0 // indirect
Expand All @@ -82,7 +82,7 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.20.1 // indirect
github.com/google/renameio v1.0.1 // indirect
github.com/gorilla/schema v1.2.1 // indirect
github.com/gorilla/schema v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
Expand All @@ -106,7 +106,7 @@ require (
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mdlayher/socket v0.5.0 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -115,12 +115,12 @@ require (
github.com/muhlemmer/gu v0.3.1 // indirect
github.com/muhlemmer/httpforwarded v0.1.0 // indirect
github.com/natefinch/wrap v0.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/cors v1.10.1 // indirect
Expand All @@ -145,13 +145,13 @@ require (
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240308144416-29370a3891b7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240308144416-29370a3891b7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.62.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
Expand Down