Commit Graph

17371 Commits

Author SHA1 Message Date
Lang Martin
15ffae2798 csi: server-side plugin state tracking and api (#6966)
* structs: CSIPlugin indexes jobs acting as plugins and node updates

* schema: csi_plugins table for CSIPlugin

* nomad: csi_endpoint use vol.Denormalize, plugin requests

* nomad: csi_volume_endpoint: rename to csi_endpoint

* agent: add CSI plugin endpoints

* state_store_test: use generated ids to avoid t.Parallel conflicts

* contributing: add note about registering new RPC structs

* command: agent http register plugin lists

* api: CSI plugin queries, ControllerHealthy -> ControllersHealthy

* state_store: copy on write for volumes and plugins

* structs: copy on write for volumes and plugins

* state_store: CSIVolumeByID returns an unhealthy volume, denormalize

* nomad: csi_endpoint use CSIVolumeDenormalizePlugins

* structs: remove struct errors for missing objects

* nomad: csi_endpoint return nil for missing objects, not errors

* api: return meta from Register to avoid EOF error

* state_store: CSIVolumeDenormalize keep allocs in their own maps

* state_store: CSIVolumeDeregister error on missing volume

* state_store: CSIVolumeRegister set indexes

* nomad: csi_endpoint use CSIVolumeDenormalizePlugins tests
2020-03-23 13:58:29 -04:00
Danielle Lancashire
1250d56333 csi: Add VolumeManager (#6920)
This changeset is some pre-requisite boilerplate that is required for
introducing CSI volume management for client nodes.

It extracts out fingerprinting logic from the csi instance manager.
This change is to facilitate reusing the csimanager to also manage the
node-local CSI functionality, as it is the easiest place for us to
guaruntee health checking and to provide additional visibility into the
running operations through the fingerprinter mechanism and goroutine.

It also introduces the VolumeMounter interface that will be used to
manage staging/publishing unstaging/unpublishing of volumes on the host.
2020-03-23 13:58:29 -04:00
Danielle Lancashire
77f3ef345b csi: Support for NodeUnpublishVolume RPCs 2020-03-23 13:58:29 -04:00
Danielle Lancashire
a84685bf11 csi: Nil check ToCSIRepresentation implementations 2020-03-23 13:58:29 -04:00
Danielle Lancashire
9f73f09f57 csi: Add NodePublishVolume RPCs 2020-03-23 13:58:29 -04:00
Danielle Lancashire
639bcdf813 csi: Add NodeUnstageVolume RPCs to CSIPlugin 2020-03-23 13:58:29 -04:00
Danielle Lancashire
ae8e73a10d csi: Add NodeUnstageVolume as a CSI Dependency 2020-03-23 13:58:29 -04:00
Danielle Lancashire
c48d5a95a1 csi: Add NodeStageVolume to fake client 2020-03-23 13:58:29 -04:00
Danielle Lancashire
3b667d68c1 csi: Add NodeStageVolume RPC 2020-03-23 13:58:29 -04:00
Danielle Lancashire
3086c72650 csi: Add csi.NodeStageVolume to the NodeClient
Implements a fake version of NodeStageVolume as a dependency of
implementing the client.NodeStageVolume request
2020-03-23 13:58:29 -04:00
Danielle Lancashire
ba1c77a998 csi: Add Nomad Model for VolumeCapabilities
This commit introduces a nomad model for interacting with CSI
VolumeCapabilities as a pre-requisite for implementing NodeStageVolume
and NodeMountVolume correctly.

These fields have a few special characteristics that I've tried to model
here - specificially, we make a basic attempt to avoid printing data
that should be redacted during debug logs (additional mount flags), and
also attempt to make debuggability of other integer fields easier by
implementing the fmt.Stringer and fmt.GoStringer interfaces as
necessary.

We do not currnetly implement a CSI Protobuf -> Nomad implementation
transformation as this is currently not needed by any used RPCs.
2020-03-23 13:58:29 -04:00
Lang Martin
a32aa8b547 csi_volume_endpoint_test: gen uuids to avoid t.Parallel conflicts 2020-03-23 13:58:29 -04:00
Lang Martin
c50033efc3 docs contributing: checklist-command 2020-03-23 13:58:29 -04:00
Lang Martin
a85e60d054 nomad/rpc: indicate missing region in error message 2020-03-23 13:58:29 -04:00
Lang Martin
4887c55967 agent: csi endpoint 2020-03-23 13:58:29 -04:00
Lang Martin
44a86bc7d1 api: csi 2020-03-23 13:58:29 -04:00
Lang Martin
2308743603 csi: do not use namespace specific identifiers 2020-03-23 13:58:29 -04:00
Lang Martin
86c8ec1198 structs: move the content of csi_volumes into csi 2020-03-23 13:58:29 -04:00
Lang Martin
ee8496a88e client structs: use nstructs rather than s for nomad/structs 2020-03-23 13:58:29 -04:00
Lang Martin
9214e0c52e server: rpc register CSIVolume 2020-03-23 13:58:29 -04:00
Lang Martin
659519adcb csi volume endpoint: new RPC endpoint for CSI volumes 2020-03-23 13:58:29 -04:00
Lang Martin
63b7f96537 acl: new NamespaceCapabilityCSIAccess, CSICreateVolume 2020-03-23 13:58:29 -04:00
Lang Martin
24d2367da5 state_store: CSIVolume insert, get, delete, claim
state_store: change claim counts

state_store: get volumes by all, by driver

state_store: process volume claims

state_store: csi volume register error on update
2020-03-23 13:58:29 -04:00
Lang Martin
c49f9f2611 schema: csi_volumes schema 2020-03-23 13:58:29 -04:00
Lang Martin
ae10a518f5 fsm: dispatch CSIVolume register, deregister, claim 2020-03-23 13:58:29 -04:00
Lang Martin
38c376bcc5 docs: update checklist-rpc-endpoint 2020-03-23 13:58:29 -04:00
Lang Martin
e0c615bcd1 structs: eliminate MaxReaders & MaxWriters 2020-03-23 13:58:29 -04:00
Lang Martin
c37621cc98 client structs: move CSIVolumeAttachmentMode and CSIVolumeAccessMode 2020-03-23 13:58:29 -04:00
Lang Martin
8a952b4c16 structs: new CSIVolume, request types 2020-03-23 13:58:29 -04:00
Danielle Lancashire
cd0c2a6df0 csi: Setup gRPC Clients with a logger 2020-03-23 13:58:29 -04:00
Danielle Lancashire
48a8f83017 helper: Add initial grpc logging middleware 2020-03-23 13:58:29 -04:00
Danielle Lancashire
d153561b13 node_status: Add CSI Summary info
This commit introduces two new fields to the basic output of `nomad
node status <node-id>`.

1) "CSI Controllers", which displays the names of registered controller
plugins.

2) "CSI Drivers", which displays the names of registered CSI Node
plugins.

However, it does not implement support for verbose output, such as
including health status or other fingerprinted data.
2020-03-23 13:58:29 -04:00
Danielle Lancashire
603a0099b3 api: Include CSI metadata on nodes 2020-03-23 13:58:29 -04:00
Danielle Lancashire
3f36dae246 csimanager: Fingerprint Node Service capabilities 2020-03-23 13:58:29 -04:00
Danielle Lancashire
0d412c0d7d csi: Add NodeGetCapabilities RPC 2020-03-23 13:58:29 -04:00
Danielle Lancashire
406984ca8d csimanager: Fingerprint controller capabilities 2020-03-23 13:58:29 -04:00
Danielle Lancashire
91e3bfea2e plugins_csi: Add GetControllerCapabilities RPC 2020-03-23 13:58:28 -04:00
Danielle Lancashire
a7f7114590 client_csi: Validate Access/Attachment modes 2020-03-23 13:58:28 -04:00
Danielle Lancashire
19d06d5bb2 csi: ClientCSIControllerPublish* -> ClientCSIControllerAttach* 2020-03-23 13:58:28 -04:00
Danielle Lancashire
964ede4301 csi: Model Attachment and Access modes 2020-03-23 13:58:28 -04:00
Danielle Lancashire
778a32de4a client: Setup CSI RPC Endpoint
This commit introduces a new set of endpoints to a Nomad Client:
ClientCSI.

ClientCSI is responsible for mediating requests from a Nomad Server to
a CSI Plugin running on a Nomad Client. It should only really be used to
make controller RPCs.
2020-03-23 13:58:28 -04:00
Danielle Lancashire
86de04d840 csi: Add initial plumbing for controller rpcs 2020-03-23 13:58:28 -04:00
Danielle Lancashire
d296efd2c6 CSI Plugin Registration (#6555)
This changeset implements the initial registration and fingerprinting
of CSI Plugins as part of #5378. At a high level, it introduces the
following:

* A `csi_plugin` stanza as part of a Nomad task configuration, to
  allow a task to expose that it is a plugin.

* A new task runner hook: `csi_plugin_supervisor`. This hook does two
  things. When the `csi_plugin` stanza is detected, it will
  automatically configure the plugin task to receive bidirectional
  mounts to the CSI intermediary directory. At runtime, it will then
  perform an initial heartbeat of the plugin and handle submitting it to
  the new `dynamicplugins.Registry` for further use by the client, and
  then run a lightweight heartbeat loop that will emit task events
  when health changes.

* The `dynamicplugins.Registry` for handling plugins that run
  as Nomad tasks, in contrast to the existing catalog that requires
  `go-plugin` type plugins and to know the plugin configuration in
  advance.

* The `csimanager` which fingerprints CSI plugins, in a similar way to
  `drivermanager` and `devicemanager`. It currently only fingerprints
  the NodeID from the plugin, and assumes that all plugins are
  monolithic.

Missing features

* We do not use the live updates of the `dynamicplugin` registry in
  the `csimanager` yet.

* We do not deregister the plugins from the client when they shutdown
  yet, they just become indefinitely marked as unhealthy. This is
  deliberate until we figure out how we should manage deploying new
  versions of plugins/transitioning them.
2020-03-23 13:58:28 -04:00
Lang Martin
d8bff7e940 vendor: Add github.com/grpc-ecosystem/go-grpc-middleware/retry 2020-03-23 13:58:28 -04:00
Danielle Lancashire
cc417f4be3 vendor: go-hclog 0.10.1 -> 0.11.0 2020-03-23 13:58:28 -04:00
Danielle Lancashire
aed4311217 vendor: Init csi protobufs 2020-03-23 13:58:28 -04:00
Mahmood Ali
f0505a24ad Merge pull request #7431 from hashicorp/ci-golang-1.14.1
use golang 14.1
2020-03-23 13:22:11 -04:00
Mahmood Ali
dda776e44a use golang 14.1 2020-03-23 13:02:14 -04:00
Jonathan Neal
7950b5e4a6 Replace internal DocsPage with @hashicorp/react-docs-page 2020-03-23 12:28:00 -04:00
Mahmood Ali
8efa104b97 Merge pull request #7428 from hashicorp/revert-7416-bump-go-dockerclient
Revert "vendor: fsouza/go-docker-client v1.6.3"
2020-03-23 10:50:14 -04:00