Skip to content

feat(sliceconfig): add machine-observable status conditions#369

Open
Karman580 wants to merge 1 commit into
kubeslice:masterfrom
Karman580:contribution/improvements
Open

feat(sliceconfig): add machine-observable status conditions#369
Karman580 wants to merge 1 commit into
kubeslice:masterfrom
Karman580:contribution/improvements

Conversation

@Karman580

@Karman580 Karman580 commented May 15, 2026

Copy link
Copy Markdown

Summary

  • Adds Conditions []metav1.Condition to SliceConfigStatus with +listType=map / +listMapKey=type markers for correct strategic-merge-patch behaviour.
  • ReconcileSliceConfig sets four conditions after key provisioning steps and calls a single util.UpdateStatus on successful completion.
  • Adds +kubebuilder:printcolumn for READY so kubectl get sliceconfig shows readiness inline.
  • kubesliceEvents behaviour is unchanged; this change is fully backward compatible.

Motivation

SliceConfigStatus previously exposed only kubesliceEvents[], an append-style audit log with no machine-queryable readiness semantics. A fully provisioned slice and one stalled at step 3 were externally indistinguishable. This blocked kubectl wait --for=condition=Ready, FluxCD/ArgoCD health checks, and Helm --wait on slice provisioning.

Conditions added

Condition Set after
WorkerConfigsProvisioned Step 4 — all WorkerSliceConfig objects created
GatewaysProvisioned Step 5 — all WorkerSliceGateway pairs created
VPNConfigured Step 7 — VpnKeyRotation CR created
Ready All three above are True

For no-network slices, only WorkerConfigsProvisioned and Ready are set (gateways and VPN are not applicable).

Test plan

  • SliceConfig_ConditionsSetOnSuccessfulReconcile — all four conditions are True after a complete network-slice reconcile
  • SliceConfig_ConditionsSetOnNoNetSuccessfulReconcile — only WorkerConfigsProvisioned and Ready are set for NoNet slices
  • SliceConfig_ReadyConditionFalseWhenGatewayFailsStatus() is never called when gateway creation returns an error
  • All 21 existing SliceConfigTestBed cases updated / continue to pass

Migration notes

conditions is omitempty; existing objects without the field remain valid. No CRD migration needed. After merging, run make manifests && make install to apply the updated CRD.

Fixes #368

Add Conditions []metav1.Condition to SliceConfigStatus so that
provisioning state is observable via kubectl wait, FluxCD, ArgoCD,
and Helm post-install hooks.

Four conditions are set by ReconcileSliceConfig:
  - WorkerConfigsProvisioned: after WorkerSliceConfig creation (step 4)
  - GatewaysProvisioned:      after WorkerSliceGateway creation (step 5)
  - VPNConfigured:            after VpnKeyRotation CR creation (step 7)
  - Ready:                    aggregate; True when all above are True

For no-network slices only WorkerConfigsProvisioned and Ready are set
since gateways and VPN are not applicable to that deployment mode.

A single util.UpdateStatus call is made at the end of each successful
reconcile path. Error paths do not write status; the next successful
reconcile sets conditions correctly (level-triggered semantics).

A +kubebuilder:printcolumn marker surfaces READY in kubectl get output.
Existing kubesliceEvents behaviour is unchanged (backward compatible).

Signed-off-by: KARMAN SINGH TALWAR <karmansinghtalwar@KARMANs-MacBook-Pro.local>

@mdryaan mdryaan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Karman580 i have review the PR, the logic is correct condition placement after each step, the NONET path setting only WorkerConfigsProvisioned and Ready, and the single UpdateStatus call at the end are all right.

Two things need fixing

  1. make manifests generate wasn't run after editing sliceconfig_types.go. The CRD YAML is missing the conditions field and the READY printcolumn, and zz_generated.deepcopy.go leaves Conditions shallow-copied. Run make manifests generate and commit both generated files.

  2. clientMock.On("Status").Return(clientMock) panics at runtime in all four tests that call util.UpdateStatus — same root cause as PR #308. Needs a fakeStatusWriter struct, details in the inline comment.

cc @gourishkb @Rahul-D78

// Conditions represent the latest available observations of the SliceConfig's provisioning state.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make manifests generate wasn't run after editing this file. Two generated files are stale:

  • config/crd/bases/controller.kubeslice.io_sliceconfigs.yaml is missing the conditions field and the READY printcolumn — kubectl get sliceconfig won't show READY and kubectl wait --for=condition=Ready won't work until the CRD schema is regenerated and applied.
  • zz_generated.deepcopy.goDeepCopyInto for SliceConfigStatus still only copies KubesliceEvents. The new Conditions slice gets shallow-copied, so the original and the copy share the same underlying array after any DeepCopy() call.

Run make manifests generate and commit both generated files.

}).Once()
workerServiceImportMock.On("CreateMinimalWorkerServiceImport", ctx, sliceConfig.Spec.Clusters, requestObj.Namespace, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
// status condition update at end of reconcile
clientMock.On("Status").Return(clientMock).Once()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same panic issue as in PR #308. *utilMock.Client satisfies client.Client but not client.StatusWriter — in controller-runtime v0.20.4, StatusWriter is SubResourceWriter whose Update takes ...SubResourceUpdateOption, not ...client.UpdateOption. The type assertion inside Status() panics at runtime. All four tests hitting util.UpdateStatus will panic rather than fail cleanly. Needs a fakeStatusWriter struct the same way PR #308 does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SliceConfig: missing status conditions makes provisioning state unobservable for GitOps and automation

2 participants