kubernetes-sigs / kubernetes-sigs/cluster-inventory-api

Conformance Testing for PlacementDecision API

Open
#61 1 comment 0 reactions 1 assignee Claimed by @Manar-Elhabbal7 View on GitHub
good first issue help wanted sig/multicluster
Dominant language
Go
Stars
96
Forks
23
Avg merge
4h 56m
Merged PRs (30d)
1

Description

## Conformance Testing for PlacementDecision API

The PlacementDecision API (KEP-5313) gives multicluster schedulers a vendor-neutral way to publish their placement results. OCM is already tracking support for it (https://github.com/open-cluster-management-io/ocm/issues/1373), and as more schedulers adopt it, having a conformance suite will help make sure producers and consumers can actually interoperate reliably.

We should follow the same pattern being established for ClusterProfile conformance (and modeled after MCS-API's conformance suite at https://github.com/kubernetes-sigs/mcs-api/tree/master/conformance). Ideally the PlacementDecision tests would live alongside the ClusterProfile tests under a shared `conformance/` directory, with the ability to run either or both.

### What the suite should probably cover

For core conformance: CRUD lifecycle for PlacementDecision objects, validation that `decisions` is required, the MaxItems=100 constraint on `decisions` (rejecting anything over 100), MinItems=0 allowing empty lists, `clusterProfileRef.name` being required in each decision entry, namespace defaulting for `clusterProfileRef.namespace`, namespace-scoping, and verifying there is no status subresource (the object body is the decision).

For extended/optional conformance: the multi-slice label conventions (`multicluster.x-k8s.io/decision-key` for correlating slices, `multicluster.x-k8s.io/decision-index` for ordering, `multicluster.x-k8s.io/placement-key` for linking back to the originating workload), the optional `schedulerName` and `decisions[].reason` fields being correctly stored and retrieved, watch event delivery, and multi-slice correlation where multiple PlacementDecision objects with the same `decision-key` can be listed and filtered together.

### Suggested approach

Reuse the same test harness, report generator, and CLI flags from the ClusterProfile conformance work. The conformance binary should support running ClusterProfile tests, PlacementDecision tests, or both together. Tests should create prerequisite ClusterProfile objects that PlacementDecision entries reference, so we get realistic end-to-end scenarios rather than just schema validation. The suite should be importable as a Go package so scheduler projects can selectively run the producer-side tests in their own CI.

For the conformance report program, PlacementDecision results should be included alongside ClusterProfile results, with the report format distinguishing between "ClusterProfile provider", "ClusterProfile consumer", and "PlacementDecision producer" conformance profiles.

### References

- MCS-API conformance suite: https://github.com/kubernetes-sigs/mcs-api/tree/master/conformance
- MCS-API conformance report program: https://github.com/kubernetes-sigs/mcs-api/issues/138
- Existing integration tests in this repo: `test/integration/placementdecision_test.go`
- PlacementDecision types: `apis/v1alpha1/placementdecision_types.go`
- OCM PlacementDecision tracking: https://github.com/open-cluster-management-io/ocm/issues/1373
- KEP-5313: https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/5313-placement-decision-api/README.md

/sig multicluster

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.