holodeck
Copilot instructions30 starsChanged 7 months agoApache-2.0View on GitHub
This document provides context and guidelines for AI assistants (GitHub Copilot, Cursor, Claude, etc.) working on the Holodeck codebase. Holodeck is a CLI tool for creating and managing GPU-ready cloud test environments. It automates the provisioning of: The Environment CRD (Custom Resource Definition) defines the desired state: - AWS Provider (pkg/provider/aws/): Creates EC2 instances with proper security groups, key pairs, and GPU support. - SSH Provider: Uses existing instances accessible via SSH. The provisioner (pkg/provisioner/) executes shell commands over SSH…
- Reads credentials
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
24 rules. About 0 are common, 9 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Development: Create ephemeral GPU development environments
- Distinctive: line 23
Validation: Test NVIDIA software stack configurations
- Very specific: line 114
Follow standard Go conventions and gofmt
- Very specific: line 115
Use golangci-lint for linting (configured in .golangci.yml if present)
- Very specific: line 118
Use context.Context for cancellation and timeouts
- Very specific: line 134
Use structured logging with the project's logger (internal/logger/):
- Distinctive: line 145
Use testify for assertions when appropriate
- Very specific: line 175
Add tests in pkg/provisioner/templates/mycomponent_test.go
- Very specific: line 182
Add documentation in docs/commands/mycommand.md
- Very specific: line 187
Create package in pkg/provider/myprovider/
- Very specific: line 188
Add provider constant in api/holodeck/v1alpha1/types.go
- Very specific: line 189
Update provider factory in pkg/provider/provider.go
- Distinctive: line 241
Never log sensitive data (SSH keys, AWS credentials)
- Very specific: line 242
Use os.FileMode(0600) for private key files
- Distinctive: line 244
Use secure defaults for security groups (minimal ingress)
- Very specific: line 251
SSH Connection Issues: Ensure security groups allow SSH (port 22) from the machine running Holodeck.
- Distinctive: line 260
Kubernetes Version Skew: Ensure kubelet, kubeadm, and kubectl versions match within the allowed skew policy.
- Very specific: line 267
Check dependencies: Use pkg/provisioner/dependency.go to understand component ordering.
- Very specific: line 270
Test locally first: Use holodeck dryrun to validate YAML without creating resources.
- Very specific: line 273
Update documentation: If adding features, update relevant docs in docs/ directory.
- Distinctive: line 276
Sign commits: All commits must be signed off (DCO):
- Distinctive: line 293
Check existing issues and PRs for context
- Very specific: line 295
Look at examples/ for usage patterns
- Distinctive: line 296
Check test files for expected behavior
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for Holodeck
This document provides context and guidelines for AI assistants (GitHub Copilot, Cursor, Claude, etc.) working on the Holodeck codebase.
Project Overview
Holodeck is a CLI tool for creating and managing GPU-ready cloud test environments. It automates the provisioning of:
- Cloud infrastructure (AWS EC2 instances)
- NVIDIA GPU drivers
- Container runtimes (Docker, containerd, CRI-O)
- NVIDIA Container Toolkit
- Kubernetes clusters (kubeadm, Kind)
Primary Use Cases
- CI/CD Testing: Spin up GPU environments for automated testing
- Development: Create ephemeral GPU development environments
- Validation: Test NVIDIA software stack configurations
Repository Structure
holodeck/
├── api/holodeck/v1alpha1/ # Kubernetes-style API types (Environment CRD)
├── cmd/
│ ├── cli/ # Main CLI application
│ │ ├── create/ # holodeck create command
│ │ ├── delete/ # holodeck delete command
│ │ ├── dryrun/ # holodeck dryrun command
│ │ ├── list/ # holodeck list command
│ │ └── status/ # holodeck status command
│ └── action/ # GitHub Action entrypoint
├── pkg/
│ ├── provider/ # Cloud provider interface and implementations
│ │ └── aws/ # AWS EC2 provider
│ ├── provisioner/ # Software provisioning logic
│ │ └── templates/ # Provisioning templates for each component
│ ├── jyaml/ # YAML utilities with JSON schema support
│ └── utils/ # Shared utilities
├── examples/ # Example environment YAML files
├── docs/ # Documentation
└── tests/ # E2E testsKey Concepts
Environment API
The Environment CRD (Custom Resource Definition) defines the desired state:
apiVersion: holodeck.nvidia.com/v1alpha1
kind: Environment
metadata:
name: my-gpu-env
spec:
provider: aws # or "ssh" for existing instances
auth:
keyName: my-key
username: ubuntu
publicKey: ~/.ssh/id_rsa.pub
privateKey: ~/.ssh/id_rsa
instance:
type: g4dn.xlarge
region: us-west-2
image:
architecture: x86_64
nvidiaDriver:
install: true
branch: "535"
containerRuntime:
install: true
name: containerd
nvidiaContainerToolkit:
install: true
kubernetes:
install: true
Installer: kubeadmProviders
- AWS Provider (
pkg/provider/aws/): Creates EC2 instances with proper security groups, key pairs, and GPU support. - SSH Provider: Uses existing instances accessible via SSH.
Provisioner
The provisioner (pkg/provisioner/) executes shell commands over SSH to install
and configure software. Each component has a template in
pkg/provisioner/templates/:
nv-driver.go- NVIDIA driver installationcontainerd.go,docker.go,crio.go- Container runtimescontainer-toolkit.go- NVIDIA Container Toolkitkubernetes.go- Kubernetes cluster setupkernel.go- Kernel version management
Coding Conventions
Go Style
- Follow standard Go conventions and
gofmt - Use
golangci-lintfor linting (configured in.golangci.ymlif present) - Documentation comments should wrap at 80 characters
- Error messages should be lowercase, no trailing punctuation
- Use
context.Contextfor cancellation and timeouts
Error Handling
// Good: Wrap errors with context
if err != nil {
return fmt.Errorf("failed to create instance: %w", err)
}
// Good: Use structured errors where appropriate
var ErrInstanceNotFound = errors.New("instance not found")Logging
Use structured logging with the project's logger (internal/logger/):
logger.Info("Creating instance", "type", instanceType, "region", region)
logger.Error("Failed to provision", "error", err)Testing
- Unit tests alongside source files:
foo_test.go - E2E tests in
tests/directory - Use testify for assertions when appropriate
- Table-driven tests preferred for multiple cases
func TestCreateInstance(t *testing.T) {
tests := []struct {
name string
spec InstanceSpec
want *Instance
wantErr bool
}{
// test cases...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// ...
})
}
}Common Patterns
Adding a New Provisioner Template
- Create
pkg/provisioner/templates/mycomponent.go - Implement the
Templateinterface - Register in the dependency graph (
pkg/provisioner/dependency.go) - Add tests in
pkg/provisioner/templates/mycomponent_test.go
Adding a New CLI Command
- Create
cmd/cli/mycommand/mycommand.go - Define the command using
urfave/cli - Register in
cmd/cli/main.go - Add documentation in
docs/commands/mycommand.md
Adding a New Provider
- Implement
pkg/provider.Providerinterface - Create package in
pkg/provider/myprovider/ - Add provider constant in
api/holodeck/v1alpha1/types.go - Update provider factory in
pkg/provider/provider.go
Dependencies
Key dependencies to be aware of:
github.com/urfave/cli/v3- CLI frameworkgithub.com/aws/aws-sdk-go-v2- AWS SDKk8s.io/apimachinery- Kubernetes API machinery (for types)github.com/pkg/sftp- SFTP for file transfersgolang.org/x/crypto/ssh- SSH client
Build and Test Commands
# Build the binary
make build
# Run all tests
make test
# Run linter
make lint
# Run E2E tests (requires AWS credentials)
make e2e
# Clean build artifacts
make cleanImportant Files
| File | Purpose |
api/holodeck/v1alpha1/types.go | Environment CRD definition |
pkg/provider/provider.go | Provider interface |
pkg/provisioner/provisioner.go | Main provisioning orchestrator |
pkg/provisioner/dependency.go | Component dependency ordering |
cmd/cli/main.go | CLI entrypoint and command registration |
action.yml | GitHub Action definition |
Security Considerations
- Never log sensitive data (SSH keys, AWS credentials)
- Use
os.FileMode(0600)for private key files - Validate all user inputs from YAML configurations
- Use secure defaults for security groups (minimal ingress)
- SSH connections should use known host verification in production
Common Pitfalls
- SSH Connection Issues: Ensure security groups allow SSH (port 22) from the machine running Holodeck.
- GPU Driver Compatibility: The NVIDIA driver version must be compatible with the kernel version. Check the compatibility matrix.
- AWS Quotas: GPU instances have quota limits. Check Service Quotas in AWS console if instance creation fails.
- Kubernetes Version Skew: Ensure kubelet, kubeadm, and kubectl versions match within the allowed skew policy.
When Making Changes
- Check dependencies: Use
pkg/provisioner/dependency.goto understand component ordering. - Test locally first: Use
holodeck dryrunto validate YAML without creating resources. - Update documentation: If adding features, update relevant docs in
docs/directory. - Sign commits: All commits must be signed off (DCO):
git commit -s -m "feat: add new feature" - Follow conventional commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentationrefactor:- Code refactoringtest:- Test additions/changeschore:- Maintenance tasks
Getting Help
- Check existing issues and PRs for context
- Review
docs/directory for detailed documentation - Look at
examples/for usage patterns - Check test files for expected behavior
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

