Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit 856d8e0

Browse files
authored
fix(updating): use PUT not PATCH when updating an existing Secret (#20)
PATCH is going to result in a merge, potentially resulting in a union of the previous Secret's fields and the updated Secret's fields.
1 parent 183e280 commit 856d8e0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/poller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Poller {
9898
}
9999

100100
this._logger.info(`updating secret ${secretName}`);
101-
return kubeNamespace.secrets(secretName).patch({ body: secretManifest });
101+
return kubeNamespace.secrets(secretName).put({ body: secretManifest });
102102
}
103103

104104
/**

lib/poller.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ describe('Poller', () => {
186186

187187
it('updates secret', async () => {
188188
kubeNamespaceMock.get = sinon.stub().resolves({ fakeSecretName: 'fakeSecretString' });
189-
kubeNamespaceMock.patch = sinon.stub().resolves();
189+
kubeNamespaceMock.put = sinon.stub().resolves();
190190

191191
await poller._upsertKubernetesSecret(upsertSecretParams);
192192

193193
expect(kubeNamespaceMock.secrets.calledWith('fakeSecretName')).to.be.true;
194194
expect(kubeNamespaceMock.get.called).to.be.true;
195-
expect(kubeNamespaceMock.patch.calledWith({
195+
expect(kubeNamespaceMock.put.calledWith({
196196
body: {
197197
apiVersion: 'v1',
198198
kind: 'Secret',

0 commit comments

Comments
 (0)