Skip to content

Commit

Permalink
Fast Deploy Direct
Browse files Browse the repository at this point in the history
This patch adds support for Fast Deploy Direct -- deploying a VM
from a copy of the source image, cached per-datastore where VMs are
deployed.
  • Loading branch information
akutz committed Jan 10, 2025
1 parent 0936429 commit b55a286
Show file tree
Hide file tree
Showing 71 changed files with 6,097 additions and 2,643 deletions.
234 changes: 120 additions & 114 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ linters-settings:
pkg: github.com/vmware-tanzu/vm-operator/pkg/config
- alias: pkgctx
pkg: github.com/vmware-tanzu/vm-operator/pkg/context
- alias: pkgerr
pkg: github.com/vmware-tanzu/vm-operator/pkg/errors
- alias: ctxop
pkg: github.com/vmware-tanzu/vm-operator/pkg/context/operation
- alias: pkgmgr
Expand All @@ -90,59 +92,63 @@ linters-settings:
pkg: github.com/vmware-tanzu/vm-operator/pkg/util
- alias: proberctx
pkg: github.com/vmware-tanzu/vm-operator/pkg/prober/context
- alias: dsutil
pkg: github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/datastore
- alias: clsutil
pkg: github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/library

depguard:
rules:
main:
list-mode: lax # allow unless explicitly denied
files:
- $all
- "!$test"
- "!**/test/builder/*.go"
- "!**/matcher.go"
- $all
- "!$test"
- "!**/test/builder/*.go"
- "!**/matcher.go"
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: testing
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo$
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo/v2
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/gomega
desc: "do not import testing packages in non-test sources"
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: testing
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo$
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/ginkgo/v2
desc: "do not import testing packages in non-test sources"
- pkg: github.com/onsi/gomega
desc: "do not import testing packages in non-test sources"
test:
list-mode: lax # allow unless explicitly denied
files:
- $test
- $test
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
test-builder:
list-mode: lax # allow unless explicitly denied
files:
- "**/test/builder/*.go"
- "**/matcher.go"
- "!$test"
- "**/test/builder/*.go"
- "**/matcher.go"
- "!$test"
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/pkg/errors
desc: "replaced by stdlib errors package since Go.13: https://go.dev/blog/go1.13-errors"
- pkg: k8s.io/utils
desc: "replaced by internal packages like pkg/util/ptr"
- pkg: github.com/onsi/ginkgo$
desc: "replaced by github.com/onsi/ginkgo/v2"
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
errorf: false
Expand All @@ -152,38 +158,38 @@ linters-settings:
linters:
disable-all: true
enable:
- errorlint
- asciicheck
- bodyclose
- depguard
- dogsled
- errcheck
- exportloopref
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- nolintlint
- prealloc
- revive
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- errorlint
- asciicheck
- bodyclose
- depguard
- dogsled
- errcheck
- exportloopref
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nakedret
- nilerr
- nolintlint
- prealloc
- revive
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused

issues:
max-same-issues: 0
Expand All @@ -193,51 +199,51 @@ issues:
# nitpicking.
exclude-use-default: false
exclude-dirs:
- external
- pkg/util/cloudinit/schema
- pkg/util/netplan/schema
- external
- pkg/util/cloudinit/schema
- pkg/util/netplan/schema
exclude-files:
- ".*generated.*\\.go"
- ".*generated.*\\.go"
exclude:
# TODO: Remove the following exclusions over time once we have fixed those.
- "ST1000: at least one file in a package should have a package comment"
# TODO: Remove the following exclusions over time once we have fixed those.
- "ST1000: at least one file in a package should have a package comment"
# List of regexps of issue texts to exclude, empty list by default.
exclude-rules:
- linters:
- staticcheck
text: "^SA1019: [^.]+.Wait is deprecated: Please use WaitEx instead."
- linters:
- staticcheck
text: "^SA1019: [^.]+.WaitForResult is deprecated: Please use WaitForResultEx instead."
- linters:
- revive
text: ".*should have (a package )?comment.*"
- linters:
- revive
text: "^exported: comment on exported const"
- linters:
- staticcheck
text: "^SA1019: .*TCPSocket is deprecated"
- linters:
- govet
text: "printf: non-constant format string in call"
# Dot imports for gomega or ginkgo are allowed within test files.
- path: test/builder/intg_test_context.go
text: should not use dot imports
- path: test/builder/test_suite.go
text: should not use dot imports
- path: test/builder/vcsim_test_context.go
text: should not use dot imports
- path: _test.go
text: should not use dot imports
# All of our webhooks follow the pattern of passing the webhook context which
# contains fields like the Client. Ignore the linter warnings for now.
- path: webhooks/
text: ".* `ctx` is unused"
- path: _test.go
linters:
- gosec
- depguard
- linters:
- revive
text: "unused-parameter: parameter"
- linters:
- staticcheck
text: "^SA1019: [^.]+.Wait is deprecated: Please use WaitEx instead."
- linters:
- staticcheck
text: "^SA1019: [^.]+.WaitForResult is deprecated: Please use WaitForResultEx instead."
- linters:
- revive
text: ".*should have (a package )?comment.*"
- linters:
- revive
text: "^exported: comment on exported const"
- linters:
- staticcheck
text: "^SA1019: .*TCPSocket is deprecated"
- linters:
- govet
text: "printf: non-constant format string in call"
# Dot imports for gomega or ginkgo are allowed within test files.
- path: test/builder/intg_test_context.go
text: should not use dot imports
- path: test/builder/test_suite.go
text: should not use dot imports
- path: test/builder/vcsim_test_context.go
text: should not use dot imports
- path: _test.go
text: should not use dot imports
# All of our webhooks follow the pattern of passing the webhook context which
# contains fields like the Client. Ignore the linter warnings for now.
- path: webhooks/
text: ".* `ctx` is unused"
- path: _test.go
linters:
- gosec
- depguard
- linters:
- revive
text: "unused-parameter: parameter"
12 changes: 10 additions & 2 deletions api/v1alpha3/virtualmachineimage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ type VirtualMachineImageStatus struct {
Type string `json:"type,omitempty"`
}

func (i VirtualMachineImageStatus) GetConditions() []metav1.Condition {
return i.Conditions
}

func (i *VirtualMachineImageStatus) SetConditions(conditions []metav1.Condition) {
i.Conditions = conditions
}

// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Namespaced,shortName=vmi;vmimage
// +kubebuilder:storageversion
Expand All @@ -273,7 +281,7 @@ type VirtualMachineImage struct {
Status VirtualMachineImageStatus `json:"status,omitempty"`
}

func (i *VirtualMachineImage) GetConditions() []metav1.Condition {
func (i VirtualMachineImage) GetConditions() []metav1.Condition {
return i.Status.Conditions
}

Expand Down Expand Up @@ -311,7 +319,7 @@ type ClusterVirtualMachineImage struct {
Status VirtualMachineImageStatus `json:"status,omitempty"`
}

func (i *ClusterVirtualMachineImage) GetConditions() []metav1.Condition {
func (i ClusterVirtualMachineImage) GetConditions() []metav1.Condition {
return i.Status.Conditions
}

Expand Down
Loading

0 comments on commit b55a286

Please sign in to comment.