Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build output
docker-machine-driver-triton
75 changes: 75 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a Docker Machine driver for Triton (Joyent's container-native infrastructure). It allows users to create and manage Docker hosts on Triton cloud infrastructure through the `docker-machine` CLI tool.

## Build and Development Commands

### Building the Driver
```bash
go build -o docker-machine-driver-triton
```

### Installing from Source
```bash
go get -u github.com/TritonDataCenter/docker-machine-driver-triton
export PATH=$PATH:$GOPATH/bin
```

### Testing
No specific test framework is configured in this project. Use standard Go testing practices:
```bash
go test ./...
```

## Architecture

### Core Components

**Main Entry Point** (`main.go:8`): Simple plugin registration that registers the Driver with Docker Machine's plugin system.

**Driver Implementation** (`driver.go`): Contains the main `Driver` struct that implements the Docker Machine driver interface with these key responsibilities:

- **Authentication**: Supports multiple auth methods (SSH keys, SSH agent, base64-encoded key material)
- **Instance Management**: Creates, starts, stops, restarts, and removes Triton instances
- **Configuration**: Handles all driver-specific flags and environment variables
- **State Management**: Maps Triton instance states to Docker Machine states

### Key Driver Methods

- `Create()` (`driver.go:335`): Provisions new Triton instances with support for tags and metadata
- `GetState()` (`driver.go:594`): Maps Triton states (running, stopped, provisioning, etc.) to Docker Machine states
- `client()` (`driver.go:204`): Creates authenticated Triton API client with flexible auth options
- `PreCreateCheck()` (`driver.go:440`): Validates images and packages before instance creation

### Configuration Flags

The driver accepts configuration via CLI flags or environment variables (with `SDC_` prefix for historical reasons):

**Required:**
- `--triton-account` / `SDC_ACCOUNT`: Triton account username
- `--triton-key-id` / `SDC_KEY_ID`: SSH key fingerprint
- `--triton-url` / `SDC_URL`: CloudAPI endpoint URL

**Authentication Options:**
- `--triton-key-path` / `SDC_KEY_PATH`: Path to SSH private key
- `--triton-key-material`: Base64-encoded SSH private key content (for Rancher integration)

**Instance Options:**
- `--triton-image`: VM image (defaults to "debian-8")
- `--triton-package`: Instance size (defaults to "k4-highcpu-kvm-250M")
- `--triton-tags` / `SDC_TAGS`: Comma-separated key=value tags
- `--triton-mdata` / `SDC_MDATA`: Comma-separated key=value metadata

### Dependencies

- `github.com/docker/machine`: Docker Machine SDK
- `github.com/TritonDataCenter/triton-go`: Official Triton Go SDK for API interactions
- Go 1.19+

## Usage Examples

See README.md for complete usage examples. The driver integrates with `docker-machine create -d triton` commands.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENV DOCKER_MACHINE_PKG github.com/docker/machine
RUN git clone --depth 1 -b "$DOCKER_MACHINE_VERSION" https://$DOCKER_MACHINE_PKG.git "$GOPATH/src/$DOCKER_MACHINE_PKG" \
&& go build -v -o "$GOPATH/bin/docker-machine" $DOCKER_MACHINE_PKG/cmd

WORKDIR $GOPATH/src/github.com/joyent/docker-machine-driver-triton
WORKDIR $GOPATH/src/github.com/TritonDataCenter/docker-machine-driver-triton

COPY *.go ./
COPY ./vendor/ ./vendor/
Expand Down
57 changes: 0 additions & 57 deletions Gopkg.lock

This file was deleted.

38 changes: 0 additions & 38 deletions Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You need a Triton account to use this driver. See [this page](https://www.joyent
## Installation from source
To get the code and compile the binary, run:
```bash
go get -u github.com/joyent/docker-machine-driver-triton
go get -u github.com/TritonDataCenter/docker-machine-driver-triton
```

Then put the driver in a directory filled in your PATH environment variable or run:
Expand Down
Loading