azure-service-operator
Copilot instructions914 starsChanged 5 months agoMITView on GitHub
ALWAYS follow these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. Azure Service Operator (ASO) v2 is a Kubernetes operator written in Go that manages Azure resources through Kubernetes Custom Resource Definitions (CRDs). The operator uses code generation from Azure OpenAPI specifications to create CRDs for Azure services.
In this repository7 other files it gives its agents.
- .github/instructions/copilot-instructions.mdCopilot instructions
- create-release-notesSkill
- create-releaseSkill
- diagnosing-vcr-failuresSkill
- migrate-group-versioningSkill
- migrate-json-golden-testsSkill
- testing-aso-recordingsSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 88
If you encounter invalid Kustomization: json: cannot unmarshal string errors:
- Distinctive: line 95
If build fails with git describe errors:
- Very specific: line 119
Run code generation after modifying generator or config: ./hack/tools/task controller:generate-types
- Very specific: line 144
Use ./hack/tools/task --list to see all available commands
- Very specific: line 145
Check Taskfile.yml for command definitions and dependencies
- Very specific: line 147
Test outputs go in reports/ directory
≈ “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
Azure Service Operator v2
ALWAYS follow these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
Azure Service Operator (ASO) v2 is a Kubernetes operator written in Go that manages Azure resources through Kubernetes Custom Resource Definitions (CRDs). The operator uses code generation from Azure OpenAPI specifications to create CRDs for Azure services.
Working Effectively
CRITICAL Dependencies and Setup
- ALWAYS allow the install-dependencies script to complete - It installs necessary tools and dependencies for builds and tests. Interrupting it can lead to incomplete setup, build failures, and use of incompatible tool versions.
- NEVER CANCEL builds or tests - Build processes can take 15+ minutes, tests can take 30+ minutes. Set timeout to 90+ minutes for full builds.
- ALWAYS run
git fetch --unshallowfirst if working with a shallow clone - the build system requires full git history. - Go 1.25+ preferred - Check with
go version - Task (taskfile) is the primary build tool - Use
./hack/tools/task --listto see available commands - Kustomize v4.5.7 required - v5+ is incompatible with current configuration format
Bootstrap and Build Process
# CRITICAL: Fix shallow clone issue first
git fetch --unshallow
# Install dependencies (if needed)
.devcontainer/install-dependencies.sh --skip-installed
# CRITICAL: Fix kustomize compatibility if encountering format errors
cd v2/config/crd/generated && ../../../../hack/tools/kustomize edit fix
# Quick validation and code generation (2-4 minutes)
./hack/tools/task quick-checks
# Full CI validation (15-20 minutes) - NEVER CANCEL - Set timeout to 90+ minutes
./hack/tools/task ci
# Individual component builds
./hack/tools/task generator:build # Code generator (~1 minute)
./hack/tools/task controller:build # Controller binary (~5 minutes)
./hack/tools/task asoctl:build # CLI tool (~2 minutes)Testing Commands
# Unit tests (NEVER CANCEL - Set timeout to 60+ minutes)
./hack/tools/task generator:unit-tests # Generator tests (~1 minute)
./hack/tools/task asoctl:unit-tests # CLI tests (~5 minutes)
./hack/tools/task controller:test # Controller tests (~30 minutes)
# Integration tests (NEVER CANCEL - Set timeout to 90+ minutes)
./hack/tools/task controller:test-integration-envtest # Record/replay tests (~20 minutes)
# Lint and format
./hack/tools/task format-code # Format all code
./hack/tools/task controller:lint # Lint controller (~5 minutes)
./hack/tools/task generator:lint # Lint generatorBuild Timing Expectations
- Generator unit tests: < 1 minute
- ASO CLI unit tests: ~5 minutes
- Controller build: ~5 minutes
- Controller unit tests: ~30 minutes - NEVER CANCEL
- Integration tests: ~20 minutes - NEVER CANCEL
- Full CI pipeline: ~45-60 minutes - NEVER CANCEL
- Code generation: ~2-3 minutes
Validation and Manual Testing
ALWAYS validate changes by:
- Run format and basic checks:
./hack/tools/task quick-checks - Build components:
./hack/tools/task controller:build asoctl:build generator:build - Run unit tests:
./hack/tools/task controller:test generator:unit-tests asoctl:unit-tests - Run linting:
./hack/tools/task controller:lint generator:lint
Manual Functionality Testing
# Build and package controller
./hack/tools/task controller:docker-build
# Generate CRDs and configuration
./hack/tools/task controller:run-kustomize
# Test CLI tool
cd v2/cmd/asoctl && go run . --helpCommon Workarounds and Known Issues
Kustomize Version Compatibility
If you encounter invalid Kustomization: json: cannot unmarshal string errors:
cd v2/config/crd/generated
../../../../hack/tools/kustomize edit fixShallow Clone Issues
If build fails with git describe errors:
git fetch --unshallowPython Script Warnings
Python regex syntax warnings in header check script are non-blocking and can be ignored.
Repository Structure and Navigation
Key Directories
v2/- Main ASO v2 codebase (ASO v1 is deprecated)v2/api/- Generated Kubernetes API types for Azure resourcesv2/cmd/controller/- Main controller implementationv2/cmd/asoctl/- CLI tool for ASO managementv2/tools/generator/- Code generator from Azure OpenAPI specsv2/config/- Kubernetes manifests and configurationv2/samples/- Example resource definitionshack/tools/- Build tools and dependencies.devcontainer/- Development container configuration
Generated vs Source Files
- Files ending in
*_gen.goare code-generated - DO NOT edit manually - Customizations go in
customizationssubdirectories - Run code generation after modifying generator or config:
./hack/tools/task controller:generate-types
Language and Technology Stack
- Go 1.24+ - Primary language
- Kubernetes 1.16+ - Target platform
- Controller Runtime - Kubernetes controller framework
- Azure ARM APIs - Source of truth for resource definitions
- Docker - Container builds
- Helm 3 - Package management
- Task - Build automation
- Kustomize v4.5.7 - Kubernetes configuration management
Documentation
- Content for our website is found in
docs/hugo/contentand should be kept up to date. Use Hugo's markdown format for documentation pages. - See
docs/hugo/content/contributing/style-guide.mdfor documentation style guidelines. - Documentation under
docs/hugo/content/referenceis generated - DO NOT edit manually
Key Development Patterns
- Code generation drives API definitions from Azure OpenAPI specs
- Controller follows standard Kubernetes controller pattern with reconciliation loops
- Heavy use of conversion functions between API versions
- ARM resource definitions map to Kubernetes CRDs
- Record/replay testing for Azure integration without live resources
Debugging and Troubleshooting
- Use
./hack/tools/task --listto see all available commands - Check
Taskfile.ymlfor command definitions and dependencies - Build artifacts go in
v2/bin/andv2/out/ - Test outputs go in
reports/directory - Generated code lives in
v2/api/and is regenerated on each build
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.

