@codemowers/oidc-key-manager 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/commands/rotate.js +18 -2
- package/dist/helpers/kube-api-service.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ $ npm install -g @codemowers/oidc-key-manager
|
|
|
14
14
|
$ key-manager COMMAND
|
|
15
15
|
running command...
|
|
16
16
|
$ key-manager (--version)
|
|
17
|
-
@codemowers/oidc-key-manager/0.2.
|
|
17
|
+
@codemowers/oidc-key-manager/0.2.2 linux-x64 node-v16.17.0
|
|
18
18
|
$ key-manager --help [COMMAND]
|
|
19
19
|
USAGE
|
|
20
20
|
$ key-manager COMMAND
|
|
@@ -57,7 +57,7 @@ EXAMPLES
|
|
|
57
57
|
$ key-manager initialize --namespace <kube namespace> --secret <secret name> --recreate
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
_See code: [dist/commands/initialize.ts](https://github.com/codemowers/oidc-key-manager/blob/v0.2.
|
|
60
|
+
_See code: [dist/commands/initialize.ts](https://github.com/codemowers/oidc-key-manager/blob/v0.2.2/dist/commands/initialize.ts)_
|
|
61
61
|
|
|
62
62
|
## `key-manager rotate`
|
|
63
63
|
|
|
@@ -89,5 +89,5 @@ EXAMPLES
|
|
|
89
89
|
$ key-manager rotate
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
_See code: [dist/commands/rotate.ts](https://github.com/codemowers/oidc-key-manager/blob/v0.2.
|
|
92
|
+
_See code: [dist/commands/rotate.ts](https://github.com/codemowers/oidc-key-manager/blob/v0.2.2/dist/commands/rotate.ts)_
|
|
93
93
|
<!-- commandsstop -->
|
package/dist/commands/rotate.js
CHANGED
|
@@ -24,8 +24,16 @@ class Rotate extends core_1.Command {
|
|
|
24
24
|
secret.appendCookieKey(flags['max-number-of-cookie-keys']);
|
|
25
25
|
}
|
|
26
26
|
await kubeApiService.replaceSecret(secret);
|
|
27
|
+
let restarted = false;
|
|
27
28
|
if (flags['restart-deployment']) {
|
|
28
|
-
|
|
29
|
+
try {
|
|
30
|
+
await kubeApiService.restartDeployment(flags['restart-deployment'], flags['restart-deployment-backoff']);
|
|
31
|
+
restarted = true;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
this.log('Restarting deployment failed', error);
|
|
35
|
+
restarted = false;
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
if (flags.both || flags.jwks) {
|
|
31
39
|
secret.rotateJWKs();
|
|
@@ -35,8 +43,16 @@ class Rotate extends core_1.Command {
|
|
|
35
43
|
}
|
|
36
44
|
await kubeApiService.replaceSecret(secret);
|
|
37
45
|
if (flags['restart-deployment']) {
|
|
38
|
-
|
|
46
|
+
try {
|
|
47
|
+
await kubeApiService.restartDeployment(flags['restart-deployment'], flags['restart-deployment-backoff']);
|
|
48
|
+
restarted = true;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.log('Restarting deployment failed, proceeding', error);
|
|
52
|
+
restarted = false;
|
|
53
|
+
}
|
|
39
54
|
}
|
|
55
|
+
this.log('Keys rotated' + (restarted ? '' : ', but deployment not restarted'));
|
|
40
56
|
}
|
|
41
57
|
}
|
|
42
58
|
exports.default = Rotate;
|
|
@@ -49,9 +49,9 @@ class KubeApiService {
|
|
|
49
49
|
const listFn = () => this.appsV1Api.listNamespacedDeployment(this.namespace);
|
|
50
50
|
const informer = (0, client_node_1.makeInformer)(this.kc, `/apis/apps/v1/namespaces/${this.namespace}/deployments/`, listFn);
|
|
51
51
|
informer.on('update', (obj) => {
|
|
52
|
-
var _a;
|
|
52
|
+
var _a, _b;
|
|
53
53
|
const conditions = (_a = obj === null || obj === void 0 ? void 0 : obj.status) === null || _a === void 0 ? void 0 : _a.conditions;
|
|
54
|
-
if (conditions) {
|
|
54
|
+
if (conditions && ((_b = obj === null || obj === void 0 ? void 0 : obj.metadata) === null || _b === void 0 ? void 0 : _b.name) === deploymentName) {
|
|
55
55
|
const progressingCondition = conditions.find((c) => c.type === 'Progressing');
|
|
56
56
|
if ((progressingCondition === null || progressingCondition === void 0 ? void 0 : progressingCondition.reason) === 'NewReplicaSetAvailable') {
|
|
57
57
|
this.command.log('Deployment finished restarting');
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemowers/oidc-key-manager",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "CLI to manage secret keys required by oidc-gateway",
|
|
5
5
|
"author": "Erki Aas",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"eslint-config-oclif-typescript": "^1.0.3",
|
|
36
36
|
"mocha": "^9",
|
|
37
37
|
"oclif": "^3",
|
|
38
|
-
"shx": "^0.3.
|
|
38
|
+
"shx": "^0.3.4",
|
|
39
39
|
"ts-node": "^10.9.1",
|
|
40
40
|
"tslib": "^2.5.0",
|
|
41
41
|
"typescript": "^4.9.5"
|