Kuadrant / Kuadrant/dns-operator

Separate API types into submodule to reduce consumer dependencies

Open
#713 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
12
Forks
23
Avg merge
1d 4h
Merged PRs (30d)
14

Description

## Problem

The DNS Operator currently uses a single Go module containing both API definitions and controller implementation. This creates dependency pollution for consumers (kuadrant-operator, coredns plugin) who only need the API types but must import **50+ unnecessary transitive dependencies** including:

- AWS SDK, Azure SDK, Google Cloud SDK
- controller-runtime, external-dns
- prometheus, multicluster-runtime
- Various testing frameworks

**Impact**: Slower builds, larger binaries, broader security surface, and complex dependency management for consuming applications.

## Proposed Solution

Create an API submodule by adding `api/go.mod` within the existing repository, following the [Kubebuilder Sub-Module Layouts](https://book.kubebuilder.io/reference/submodule-layouts) pattern.

### Target Structure

```
dns-operator/
├── go.mod # Controller module (all deps)
├── api/
│ ├── go.mod # API module (minimal deps)
│ └── v1alpha1/
│ ├── dnsrecord_types.go
│ ├── dnshealthcheckprobe_types.go
│ └── ...
```

### API Module Dependencies (Minimal)

```go
// api/go.mod
module github.com/kuadrant/dns-operator/api

require (
k8s.io/apimachinery v0.33.3
sigs.k8s.io/controller-runtime v0.21.0
)
```

Consumers import: `github.com/kuadrant/dns-operator/api/v1alpha1`

**Result**: Consumer dependency count drops from **50+ to ~15 dependencies**

There are things to consider if doing this, such as possible overhead on releases and local development that should be considered. This AI generated report describes some of them [go-module-api-separation-report.md](https://github.com/user-attachments/files/24962044/go-module-api-separation-report.md)

Contributor guide

Open the contributing guide

Research direction

Start by comparing the repository's go.mod with the API definitions under api/v1alpha1, then read the linked Kubebuilder submodule-layout guidance and the module-separation report. Check how kuadrant-operator and the coredns plugin import these types and identify the local-development and release implications. Done means the API can be consumed through github.com/kuadrant/dns-operator/api/v1alpha1 with only the intended minimal dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
build-system, developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.