diff --git a/client/allocdir/alloc_dir_test.go b/client/allocdir/alloc_dir_test.go index b2467483ebba..e8871b4a6729 100644 --- a/client/allocdir/alloc_dir_test.go +++ b/client/allocdir/alloc_dir_test.go @@ -82,8 +82,9 @@ func TestAllocDir_BuildAlloc(t *testing.T) { } // HACK: This function is copy/pasted from client.testutil to prevent a test -// import cycle, due to testutil transitively importing allocdir. This -// should be fixed after DriverManager is implemented. +// +// import cycle, due to testutil transitively importing allocdir. This +// should be fixed after DriverManager is implemented. func MountCompatible(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("Windows does not support mount") diff --git a/client/allochealth/tracker.go b/client/allochealth/tracker.go index 87820d9ed672..1de1cb12fc07 100644 --- a/client/allochealth/tracker.go +++ b/client/allochealth/tracker.go @@ -258,8 +258,9 @@ func (t *Tracker) setTaskHealth(healthy, terminal bool) { // returns true if health is propagated and no more health monitoring is needed // // todo: this is currently being shared by watchConsulEvents and watchNomadEvents, -// and must be split up if/when we support registering services (and thus checks) -// of different providers. +// +// and must be split up if/when we support registering services (and thus checks) +// of different providers. func (t *Tracker) setCheckHealth(healthy bool) bool { t.lock.Lock() defer t.lock.Unlock() diff --git a/client/allocrunner/taskrunner/envoy_bootstrap_hook.go b/client/allocrunner/taskrunner/envoy_bootstrap_hook.go index 144a4a1607e1..3cc9e4fd4d1e 100644 --- a/client/allocrunner/taskrunner/envoy_bootstrap_hook.go +++ b/client/allocrunner/taskrunner/envoy_bootstrap_hook.go @@ -152,8 +152,8 @@ func newEnvoyBootstrapHook(c *envoyBootstrapHookConfig) *envoyBootstrapHook { } // getConsulNamespace will resolve the Consul namespace, choosing between -// - agent config (low precedence) -// - task group config (high precedence) +// - agent config (low precedence) +// - task group config (high precedence) func (h *envoyBootstrapHook) getConsulNamespace() string { var namespace string if h.consulConfig.Namespace != "" { diff --git a/client/allocrunner/taskrunner/envoy_version_hook.go b/client/allocrunner/taskrunner/envoy_version_hook.go index 3501e27252aa..ef958736d968 100644 --- a/client/allocrunner/taskrunner/envoy_version_hook.go +++ b/client/allocrunner/taskrunner/envoy_version_hook.go @@ -181,9 +181,9 @@ func (h *envoyVersionHook) tweakImage(configured string, supported map[string][] // semver sanitizes the envoy version string coming from Consul into the format // used by the Envoy project when publishing images (i.e. proper semver). This // resulting string value does NOT contain the 'v' prefix for 2 reasons: -// 1) the version library does not include the 'v' -// 2) its plausible unofficial images use the 3 numbers without the prefix for -// tagging their own images +// 1. the version library does not include the 'v' +// 2. its plausible unofficial images use the 3 numbers without the prefix for +// tagging their own images func semver(chosen string) (string, error) { v, err := version.NewVersion(chosen) if err != nil { diff --git a/client/allocrunner/taskrunner/plugin_supervisor_hook.go b/client/allocrunner/taskrunner/plugin_supervisor_hook.go index 03e52e66b099..a21c632f8da1 100644 --- a/client/allocrunner/taskrunner/plugin_supervisor_hook.go +++ b/client/allocrunner/taskrunner/plugin_supervisor_hook.go @@ -22,11 +22,11 @@ import ( // to their requisite plugin manager. // // It provides a few things to a plugin task running inside Nomad. These are: -// * A mount to the `csi_plugin.mount_dir` where the plugin will create its csi.sock -// * A mount to `local/csi` that node plugins will use to stage volume mounts. -// * When the task has started, it starts a loop of attempting to connect to the -// plugin, to perform initial fingerprinting of the plugins capabilities before -// notifying the plugin manager of the plugin. +// - A mount to the `csi_plugin.mount_dir` where the plugin will create its csi.sock +// - A mount to `local/csi` that node plugins will use to stage volume mounts. +// - When the task has started, it starts a loop of attempting to connect to the +// plugin, to perform initial fingerprinting of the plugins capabilities before +// notifying the plugin manager of the plugin. type csiPluginSupervisorHook struct { logger hclog.Logger alloc *structs.Allocation @@ -247,13 +247,13 @@ func (h *csiPluginSupervisorHook) Poststart(_ context.Context, _ *interfaces.Tas // the passed in context is terminated. // // The supervisor works by: -// - Initially waiting for the plugin to become available. This loop is expensive -// and may do things like create new gRPC Clients on every iteration. -// - After receiving an initial healthy status, it will inform the plugin catalog -// of the plugin, registering it with the plugins fingerprinted capabilities. -// - We then perform a more lightweight check, simply probing the plugin on a less -// frequent interval to ensure it is still alive, emitting task events when this -// status changes. +// - Initially waiting for the plugin to become available. This loop is expensive +// and may do things like create new gRPC Clients on every iteration. +// - After receiving an initial healthy status, it will inform the plugin catalog +// of the plugin, registering it with the plugins fingerprinted capabilities. +// - We then perform a more lightweight check, simply probing the plugin on a less +// frequent interval to ensure it is still alive, emitting task events when this +// status changes. // // Deeper fingerprinting of the plugin is implemented by the csimanager. func (h *csiPluginSupervisorHook) ensureSupervisorLoop(ctx context.Context) { diff --git a/client/allocrunner/taskrunner/remotetask_hook.go b/client/allocrunner/taskrunner/remotetask_hook.go index 5a8ac03d12ac..4fd9a63769b7 100644 --- a/client/allocrunner/taskrunner/remotetask_hook.go +++ b/client/allocrunner/taskrunner/remotetask_hook.go @@ -32,10 +32,10 @@ func (h *remoteTaskHook) Name() string { } // Prestart performs 2 remote task driver related tasks: -// 1. If there is no local handle, see if there is a handle propagated from a -// previous alloc to be restored. -// 2. If the alloc is lost make sure the task signal is set to detach instead -// of kill. +// 1. If there is no local handle, see if there is a handle propagated from a +// previous alloc to be restored. +// 2. If the alloc is lost make sure the task signal is set to detach instead +// of kill. func (h *remoteTaskHook) Prestart(ctx context.Context, req *interfaces.TaskPrestartRequest, resp *interfaces.TaskPrestartResponse) error { if h.tr.getDriverHandle() != nil { // Driver handle already exists so don't try to load remote diff --git a/client/allocrunner/taskrunner/restarts/restarts.go b/client/allocrunner/taskrunner/restarts/restarts.go index a117e8d49d14..0e39e471524a 100644 --- a/client/allocrunner/taskrunner/restarts/restarts.go +++ b/client/allocrunner/taskrunner/restarts/restarts.go @@ -139,11 +139,11 @@ func (r *RestartTracker) GetCount() int { // GetState returns the tasks next state given the set exit code and start // error. One of the following states are returned: -// * TaskRestarting - Task should be restarted -// * TaskNotRestarting - Task should not be restarted and has exceeded its -// restart policy. -// * TaskTerminated - Task has terminated successfully and does not need a -// restart. +// - TaskRestarting - Task should be restarted +// - TaskNotRestarting - Task should not be restarted and has exceeded its +// restart policy. +// - TaskTerminated - Task has terminated successfully and does not need a +// restart. // // If TaskRestarting is returned, the duration is how long to wait until // starting the task again. diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index 981998b4f323..de4fccfbc6af 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -1413,7 +1413,7 @@ func (tr *TaskRunner) UpdateStats(ru *cstructs.TaskResourceUsage) { } } -//TODO Remove Backwardscompat or use tr.Alloc()? +// TODO Remove Backwardscompat or use tr.Alloc()? func (tr *TaskRunner) setGaugeForMemory(ru *cstructs.TaskResourceUsage) { alloc := tr.Alloc() var allocatedMem float32 @@ -1445,7 +1445,7 @@ func (tr *TaskRunner) setGaugeForMemory(ru *cstructs.TaskResourceUsage) { } } -//TODO Remove Backwardscompat or use tr.Alloc()? +// TODO Remove Backwardscompat or use tr.Alloc()? func (tr *TaskRunner) setGaugeForCPU(ru *cstructs.TaskResourceUsage) { alloc := tr.Alloc() var allocatedCPU float32 diff --git a/client/client.go b/client/client.go index 27e6f19e6bf3..9c10ff53530f 100644 --- a/client/client.go +++ b/client/client.go @@ -136,7 +136,7 @@ type ClientStatsReporter interface { } // AllocRunner is the interface implemented by the core alloc runner. -//TODO Create via factory to allow testing Client with mock AllocRunners. +// TODO Create via factory to allow testing Client with mock AllocRunners. type AllocRunner interface { Alloc() *structs.Allocation AllocState() *arstate.State @@ -1252,8 +1252,8 @@ func (c *Client) restoreState() error { // wait until it gets allocs from server to launch them. // // See: -// * https://github.com/hashicorp/nomad/pull/6207 -// * https://github.com/hashicorp/nomad/issues/5984 +// - https://github.com/hashicorp/nomad/pull/6207 +// - https://github.com/hashicorp/nomad/issues/5984 // // COMPAT(0.12): remove once upgrading from 0.9.5 is no longer supported func (c *Client) hasLocalState(alloc *structs.Allocation) bool { diff --git a/client/dynamicplugins/registry.go b/client/dynamicplugins/registry.go index 65f8c355cbc7..3059c1a2763c 100644 --- a/client/dynamicplugins/registry.go +++ b/client/dynamicplugins/registry.go @@ -98,7 +98,8 @@ type PluginInfo struct { // PluginConnectionInfo is the data required to connect to the plugin. // note: We currently only support Unix Domain Sockets, but this may be expanded -// to support other connection modes in the future. +// +// to support other connection modes in the future. type PluginConnectionInfo struct { // SocketPath is the path to the plugins api socket. SocketPath string diff --git a/client/pluginmanager/csimanager/doc.go b/client/pluginmanager/csimanager/doc.go index 42400a092414..298bf18bf7a2 100644 --- a/client/pluginmanager/csimanager/doc.go +++ b/client/pluginmanager/csimanager/doc.go @@ -1,15 +1,16 @@ -/** +/* +* csimanager manages locally running CSI Plugins on a Nomad host, and provides a few different interfaces. It provides: -- a pluginmanager.PluginManager implementation that is used to fingerprint and - heartbeat local node plugins -- (TODO) a csimanager.AttachmentWaiter implementation that can be used to wait for an - external CSIVolume to be attached to the node before returning -- (TODO) a csimanager.NodeController implementation that is used to manage the node-local - portions of the CSI specification, and encompassess volume staging/publishing -- (TODO) a csimanager.VolumeChecker implementation that can be used by hooks to ensure - their volumes are healthy(ish) + - a pluginmanager.PluginManager implementation that is used to fingerprint and + heartbeat local node plugins + - (TODO) a csimanager.AttachmentWaiter implementation that can be used to wait for an + external CSIVolume to be attached to the node before returning + - (TODO) a csimanager.NodeController implementation that is used to manage the node-local + portions of the CSI specification, and encompassess volume staging/publishing + - (TODO) a csimanager.VolumeChecker implementation that can be used by hooks to ensure + their volumes are healthy(ish) */ package csimanager diff --git a/client/state/08types.go b/client/state/08types.go index a10d537f0af2..b4cc54bf702d 100644 --- a/client/state/08types.go +++ b/client/state/08types.go @@ -16,7 +16,6 @@ import ( // changed over the life-cycle of the alloc_runner in Nomad 0.8. // // https://github.com/hashicorp/nomad/blob/v0.8.6/client/alloc_runner.go#L146-L153 -// type allocRunnerMutableState08 struct { // AllocClientStatus does not need to be upgraded as it is computed // from task states. diff --git a/client/state/upgrade.go b/client/state/upgrade.go index 31f8c3bef6de..863dbe6e3dce 100644 --- a/client/state/upgrade.go +++ b/client/state/upgrade.go @@ -82,15 +82,14 @@ func backupDB(bdb *bbolt.DB, dst string) error { // UpgradeAllocs upgrades the boltdb schema. Example 0.8 schema: // -// * allocations -// * 15d83e8a-74a2-b4da-3f17-ed5c12895ea8 -// * echo -// - simple-all (342 bytes) -// - alloc (2827 bytes) -// - alloc-dir (166 bytes) -// - immutable (15 bytes) -// - mutable (1294 bytes) -// +// - allocations +// - 15d83e8a-74a2-b4da-3f17-ed5c12895ea8 +// - echo +// - simple-all (342 bytes) +// - alloc (2827 bytes) +// - alloc-dir (166 bytes) +// - immutable (15 bytes) +// - mutable (1294 bytes) func UpgradeAllocs(logger hclog.Logger, tx *boltdd.Tx) error { btx := tx.BoltTx() allocationsBucket := btx.Bucket(allocationsBucketName) diff --git a/client/taskenv/env.go b/client/taskenv/env.go index d40b52ab95c4..7fb6a27cc2e8 100644 --- a/client/taskenv/env.go +++ b/client/taskenv/env.go @@ -903,7 +903,6 @@ func (b *Builder) SetDriverNetwork(n *drivers.DriverNetwork) *Builder { // Handled by setAlloc -> otherPorts: // // Task: NOMAD_TASK_{IP,PORT,ADDR}__