BUG: driftExclusions fails when removing `/spec/replicas` even though the target field exists
Problem Description
In Sveltos v1.0.0, when using driftExclusions to exclude /spec/replicas, the following error occurs during the JSON Patch remove operation even though spec.replicas clearly exists in the target Deployment:
error in remove for path: '/spec/replicas': Unable to remove nonexistent key: replicas: missing value
Reproduction Steps
Apply the following ClusterProfile:
apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterProfile
metadata:
name: envoy-gateway-installation
spec:
stopMatchingBehavior: LeavePolicies
clusterSelector:
matchLabels:
test: enabled
syncMode: ContinuousWithDriftDetection
reloader: true
extraLabels:
appthrust.io/managed-by: appthrust
helmCharts:
- repositoryURL: oci://docker.io/envoyproxy
repositoryName: gateway-helm
chartName: gateway-helm
chartVersion: 1.5.0
releaseName: eg
releaseNamespace: envoy-gateway-system
helmChartAction: Install
options:
upgradeOptions:
upgradeCRDs: true
cleanupOnFail: true
force: true
wait: true
waitForJobs: true
atomic: true
values: |
global:
imageRegistry: mirror.gcr.io
config:
envoyGateway:
provider:
kubernetes:
deploy:
type: GatewayNamespace
driftExclusions:
- paths:
- "/spec/replicas"
target:
kind: Deployment
group: apps
version: v1
ClusterSummary status:
status:
dependencies: All dependencies deployed
deployedGVKs:
- deployedGroupVersionKind:
- EnvoyProxy.v1alpha1.gateway.envoyproxy.io
- GatewayClass.v1.gateway.networking.k8s.io
featureID: Resources
featureSummaries:
- featureID: Resources
hash: 0FJNJ0uz698mlQspm2yolsCJ+J5gFyCIz7koNH3q4sg=
lastAppliedTime: "2025-08-15T01:45:23Z"
status: Provisioned
- consecutiveFailures: 35
failureMessage: 'error in remove for path: ''/spec/replicas'': Unable to remove
nonexistent key: replicas: missing value'
featureID: Helm
hash: DiQnDMhsM48DfGZPtugDjgua55w8GUy5MVDIX42zSw0=
lastAppliedTime: "2025-08-15T07:23:38Z"
status: Provisioning
helmReleaseSummaries:
- releaseName: eg
releaseNamespace: envoy-gateway-system
status: Managing
valuesHash: GceliXddB/MpARyHwuan9j6oKC6nXKxL/flePoQVL/g=
What I tried:
cat << 'EOF' > test-values.yaml
global:
imageRegistry: mirror.gcr.io
config:
envoyGateway:
provider:
kubernetes:
deploy:
type: GatewayNamespace
EOF
# Created test-values.yaml based on ClusterProfile values,
# then confirmed helm template output with the following command
helm template eg oci://docker.io/envoyproxy/gateway-helm \
--version 1.5.0 \
--namespace envoy-gateway-system \
-f test-values.yaml \
| yq 'select(.kind=="Deployment" and .metadata.name=="envoy-gateway") | .spec.replicas'
Pulled: docker.io/envoyproxy/gateway-helm:1.5.0
Digest: sha256:8709b9d579882983c11b9d7475f537ce63bb2201bdf8ac96a70048bb64c0f9ac
1
In reality, envoy-gateway is running properly (see attached screenshot), and the blame result also shows that spec.replicas: 1 exists.
System Information
CLUSTERAPI VERSION: v1.10.3
SVELTOS VERSION: v1.0.0
KUBERNETES VERSION: v1.33.2
Logs
error in remove for path: '/spec/replicas': Unable to remove nonexistent key: replicas: missing value
Additional Information
- The
helm templateoutput includesspec.replicas: 1. - The live Deployment on the actual cluster also has
spec.replicas: 1.
Thanks @kahirokunn
The error is coming from using
extraLabels:
appthrust.io/managed-by: appthrust
extraLabels and extraAnnotations are deprecated.
I will keep this open but the fix wont be available on v1.0.1
This method is the one returning the error
Okay Thx😭