PushSecret fails on creation of Secrets in Delinea SecretServer requiring multiple fields
Describe the bug
[secretserver] PushSecret cannot create a new secret when the template has more than one required field (API_RequiredFieldMissing), while updates work.
When a PushSecret targets a Delinea Secret Server secret that does not exist yet, and the secret
template has more than one required field, creation fails with:
set secret failed: could not write remote ref Password to target secretstore delinea-secret-server-prod:
failed to create secret: 400 Bad Request: {
"errorCode": "API_RequiredFieldMissing",
"message": "Secret field is required"
}This happens even though every data entry targeting the same remoteKey carries a complete
PushSecretMetadata (folderId, secretTemplateId, siteId).
If the same secret is created beforehand (UI or REST API) with all required fields populated, the
identical PushSecret syncs successfully and updates each field individually. So the issue is limited to
the create path.
Suspected cause (unverified): the PushSecret controller calls SecretsClient.PushSecret() once per
data entry. On the create path, the secretserver provider seems to build the create payload from that
single entry only. A create request can therefore never contain more than one field, while Secret Server
validates all required template fields at creation time.
To Reproduce
- In Secret Server, use a template with ≥ 2 required fields, e.g. the built-in "Web Password" template
(ID
9in our instance; required:URL,Username,Password). - Configure a working
ClusterSecretStorefor the secretserver provider (read and update verified working). - Apply:
apiVersion: v1
kind: Secret
metadata:
name: example-secret-password
namespace: ns-external-secrets
type: Opaque
stringData:
Name: "name"
Password: "password"
---
apiVersion: external-secrets.io/v1alpha1
kind: PushSecret
metadata:
name: example-secret-password-2
namespace: ns-external-secrets
spec:
refreshInterval: 1h
secretStoreRefs:
- name: delinea-secret-server-prod
kind: ClusterSecretStore
selector:
secret:
name: example-secret-password
data:
- match:
secretKey: "Password"
remoteRef:
remoteKey: "folderId:1477/test-web-password-2"
property: "Password"
metadata: &meta
apiVersion: kubernetes.external-secrets.io/v1alpha1
kind: PushSecretMetadata
spec:
folderId: 1477
secretTemplateId: 9
siteId: 1
- match:
secretKey: "Name"
remoteRef:
remoteKey: "folderId:1477/test-web-password-2"
property: "URL"
metadata: *meta
- match:
secretKey: "Name"
remoteRef:
remoteKey: "folderId:1477/test-web-password-2"
property: "Username"
metadata: *metakubectl describe pushsecret example-secret-password-2 -n ns-external-secretsshows the error above, repeating on every reconcile.- Create
test-web-password-2manually in folder 1477 with all three required fields (UI, or a singlePOST /api/v1/secretscontaining all three items). This succeeds. - Wait for the next reconcile (or re-apply). The PushSecret now syncs successfully (update path).
Expected behavior
The PushSecret creates the secret with all fields mapped to that remoteKey, or at least fails with an
actionable error naming the missing required fields and explaining how to supply them.
Actual behavior
Every create attempt fails with a generic API_RequiredFieldMissing. The failure is independent of how many
entries carry metadata. The only workaround is pre-creating the secret outside ESO.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context ESO-Version: v2.10.0 SecretServer-Version: 12.2.000007
Source: external-secrets/external-secrets