crossplane / crossplane/upjet

CRD Validation Rules for Required Cross-Resource Reference Fields

Open
#325 0 comments 0 reactions 0 assignees View on GitHub
codegen enhancement v2
Dominant language
Go
Stars
481
Forks
131
Avg merge
2d 1h
Merged PRs (30d)
11

Description

### What problem are you facing?

For a cross-resource reference field `spec.forProvider.x, we generate three fields:
1. A name reference field, e.g., `spec.forProvider.xRef`
2. A label selector field, e.g., `spec.forProvider.xSelector`
3. The reference target field `spec.forProvider.x`

Because any of these fields can be specified, upjet currently generates all of them as optional fields.

### How could Upjet help solve your problem?

We had better require at least one of these reference fields via [CRD validation rules](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#validation-rules), if the reference target field is marked as required in the underlying Terraform schema.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by locating generation of cross-resource reference fields and handling of required fields in the Terraform schema. Done means generated CRDs require at least one of the reference fields when the target is required, with validation coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.