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

Commit

Permalink
fix(updating): use PUT not PATCH when updating an existing Secret (#20)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
silasbw authored Feb 20, 2019
1 parent 183e280 commit 856d8e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/poller.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Poller {
}

this._logger.info(`updating secret ${secretName}`);
return kubeNamespace.secrets(secretName).patch({ body: secretManifest });
return kubeNamespace.secrets(secretName).put({ body: secretManifest });
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/poller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ describe('Poller', () => {

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

await poller._upsertKubernetesSecret(upsertSecretParams);

expect(kubeNamespaceMock.secrets.calledWith('fakeSecretName')).to.be.true;
expect(kubeNamespaceMock.get.called).to.be.true;
expect(kubeNamespaceMock.patch.calledWith({
expect(kubeNamespaceMock.put.calledWith({
body: {
apiVersion: 'v1',
kind: 'Secret',
Expand Down

0 comments on commit 856d8e0

Please sign in to comment.