Repository navigation
[bug] k8s constraint ineffective #2304
Description
Activity
- addedneeds-triageNew / reopened / transferred issue that requires triageNew / reopened / transferred issue that requires triage
on Dec 23, 2025 - marked [bug] k8s constraint not enforced by default #2303 as a duplicate of this issue
on Dec 23, 2025 Proposal
- Currently there is no validation webhook that does the k8s constraint validation anyway so let's make this validation part of the controller code which will always run irrespective of
--enable-webhook. - Perform the k8s constraint validation in the ServiceSet controller so:
2a. ClusterDeployment controller creates a ServiceSet.
2b. The ServiceSet controller performs the k8s validation for each ServiceTemplate against the ClusterTemplate used by the CD.
2c. In case of self-management perform the validation based on the k8s version running on the management cluster. Self-management is KSM provider/adapter specific so there can also be another provider specific way to specify k8s version for the management cluster.
2c. The result of validation for each service is put in.status.services[].conditionsof the ServiceSet, which is then fetched by the ClusterDeployment controller and put in the status for the CD.
With this approach the k8s constraint validation becomes the KSM adapter's responsibility (we may or may not want this) but the advantage is that the same process can be used for both CD and MCS. We also need to validate k8s constraint for self-management and self-management of the mothership cluster is a KSM adapter specific implementation already.
@BROngineer @zerospiel What do you think?
- Currently there is no validation webhook that does the k8s constraint validation anyway so let's make this validation part of the controller code which will always run irrespective of
- addedquestion/discussionFurther information is requested / active discussion in progressFurther information is requested / active discussion in progresstriage-okTriaged issue, can be taken into workTriaged issue, can be taken into workand removedneeds-triageNew / reopened / transferred issue that requires triageNew / reopened / transferred issue that requires triage
on Dec 24, 2025 There is the validation (e.g., on the
createevent) for theclusterdeploymentreßourceThe problem with the code is that it had been implemented long before service providers/service sets, and the new ksm functionality has not been implemented in this regard. Thus, virtually no validation.
This particular function is being invoked from 2 places: from the webhook and if the webhook is disabled (that one piece of logic you've experienced).
if len(cd.Spec.ServiceSpec.Services) == 0 || clusterTemplate.Status.KubernetesVersion == "" { return nil // nothing to do }
The
cldobject provided as an example has noservicesduring the creation (though it has one afterwards, and I have to clue where it comes from). If something changes the spec of thecldthen it is obvious why the validation does not work on creation (and as I can see from the given manifests, there were some changes to thecldobject,generationfield equals2). Theupdateevent does not fail such a change because the webhook validation is being invoked only on the change of a referencedclustertemplateobject.The only thing I can suggest is to amend the already existing function in a way to support new resources/logic
ksmhad introduced.With that being said, I see no reason the bug is related to
kcm.- addedksmIssue relates to ksm (K0rdent State Mgmt)Issue relates to ksm (K0rdent State Mgmt)
on Dec 24, 2025
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Description
--enable-webhook=falsebut still successfully deploys the service.Expectation
I expect the k8s validation to fail for both cases whether webhook is enabled or not.
When webhook enabled (default) case
.spec.k8sVersion=v1.32.8:spec.k8sConstraint="<v1.30"so that it fails the ClusterTemplate's k8s version:When webhook is disabled
NOTE: This was observed with
IsDisabledValidationWHset toTrue..spec.k8sVersion=v1.32.8spec.k8sConstraint="<v1.30"so that it fails the ClusterTemplate's k8s version.The ServiceSet is still created:
➜ ~ kubectl -n kcm-system get serviceset NAME CLUSTER MULTICLUSTERSERVER PROVIDER SELF-MANAGEMENT AGE wali-dev-1 wali-dev-1 ksm-projectsveltos 18mThe ServiceSet being created is fine. Perhaps we should fail the validation at ServiceSet level anyway because if we implement this feature for MCS then we will need to handle the k8s constraint validation in the ServiceSet.
❌ We can verify that the nginx service is successfully deployed on the target cluster despite the k8s constraint validation failure:
➜ ~ kubectl -n nginx get pod NAME READY STATUS RESTARTS AGE nginx-ingress-nginx-controller-66fc95fc97-rxjxk 1/1 Running 0 10m