@firestartr/cli 1.53.0-snapshot-12 → 1.53.0-snapshot-13
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/build/index.js
CHANGED
|
@@ -360725,7 +360725,7 @@ function renderFeature(featureName, version, owner, repo, featureOwner, renderPa
|
|
|
360725
360725
|
return features_renderer.render(extractPath, renderedPath, featureOwner, {}, featureArgs);
|
|
360726
360726
|
}
|
|
360727
360727
|
/*
|
|
360728
|
-
* This functionality does the same
|
|
360728
|
+
* This functionality does the same as the above
|
|
360729
360729
|
* without downloading and extracting the feature
|
|
360730
360730
|
*/
|
|
360731
360731
|
function renderFeatureFromPath(extractPath, renderedPath, featureOwner, featureArgs = {}) {
|
|
@@ -360907,7 +360907,7 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
|
|
|
360907
360907
|
// this is the only way currently to make
|
|
360908
360908
|
// work the system and inject our code
|
|
360909
360909
|
// without having to download a feature
|
|
360910
|
-
let MOCK_FEATURES_FN
|
|
360910
|
+
let MOCK_FEATURES_FN;
|
|
360911
360911
|
function MOCK_FEATURES(mock) {
|
|
360912
360912
|
MOCK_FEATURES_FN = mock;
|
|
360913
360913
|
if (mock) {
|
|
@@ -364101,7 +364101,6 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
364101
364101
|
};
|
|
364102
364102
|
// We do this to remove undefined variables from the template
|
|
364103
364103
|
const crTemplate = JSON.parse(JSON.stringify(cr, null, 2));
|
|
364104
|
-
console.log(crTemplate.spec);
|
|
364105
364104
|
return crTemplate;
|
|
364106
364105
|
}
|
|
364107
364106
|
gvk() {
|
|
@@ -368421,6 +368420,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
|
|
|
368421
368420
|
workItem.getItem = () => {
|
|
368422
368421
|
return getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
|
|
368423
368422
|
};
|
|
368423
|
+
workItem.isDeadLetter = false;
|
|
368424
368424
|
workItem.handler = {
|
|
368425
368425
|
finalize: unsetFinalizer,
|
|
368426
368426
|
pluralKind,
|
|
@@ -368751,12 +368751,39 @@ function formatElapsedTimeWithDate(upsertTime) {
|
|
|
368751
368751
|
return `${parts.slice(0, 2).join(', ')} ago`;
|
|
368752
368752
|
}
|
|
368753
368753
|
|
|
368754
|
+
;// CONCATENATED MODULE: ../operator/src/processItemDLH.ts
|
|
368755
|
+
|
|
368756
|
+
|
|
368757
|
+
|
|
368758
|
+
/*
|
|
368759
|
+
* Dead-Letter Handler
|
|
368760
|
+
*
|
|
368761
|
+
* It manages failed WorkItems with an uncontrolled exception
|
|
368762
|
+
* it always closes the WorkItem and tries to put the CR in an ERROR state
|
|
368763
|
+
*/
|
|
368764
|
+
async function deadLetterHandler(workItem) {
|
|
368765
|
+
const { operation } = workItem;
|
|
368766
|
+
const itemPath = workItem.handler.itemPath();
|
|
368767
|
+
workItem.workStatus = WorkStatus.FINISHED;
|
|
368768
|
+
workItem.isDeadLetter = true;
|
|
368769
|
+
// we try to put the CR in a correct state
|
|
368770
|
+
try {
|
|
368771
|
+
await updateTransition(itemPath, operation, 'ERROR', 'True', 'Uncontrolled error (DLH)');
|
|
368772
|
+
await updateTransition(itemPath, operation, 'PROVISIONED', 'False', 'Uncontrolled error (DLH)');
|
|
368773
|
+
await updateTransition(itemPath, operation, 'PROVISIONING', 'False', 'Uncontrolled error (DLH)');
|
|
368774
|
+
}
|
|
368775
|
+
catch (err) {
|
|
368776
|
+
operator_src_logger.error(`Error handling WorkItem in DeadLetter state: ${workItem.handler.itemPath()}: ${err}`);
|
|
368777
|
+
}
|
|
368778
|
+
}
|
|
368779
|
+
|
|
368754
368780
|
;// CONCATENATED MODULE: ../operator/src/processItem.ts
|
|
368755
368781
|
|
|
368756
368782
|
|
|
368757
368783
|
|
|
368758
368784
|
|
|
368759
368785
|
|
|
368786
|
+
|
|
368760
368787
|
const queue = [];
|
|
368761
368788
|
const WEIGHTS = {
|
|
368762
368789
|
RENAMED: 15,
|
|
@@ -368809,6 +368836,7 @@ function getQueueMetrics() {
|
|
|
368809
368836
|
nItemsFinished: queue.filter((workItem) => workItem.workStatus === WorkStatus.FINISHED).length,
|
|
368810
368837
|
nItemsPending: queue.filter((workItem) => workItem.workStatus === WorkStatus.PENDING).length,
|
|
368811
368838
|
nItemsProcessing: queue.filter((workItem) => workItem.workStatus === WorkStatus.PROCESSING).length,
|
|
368839
|
+
nItemsInDeadLetterHandling: queue.filter((workItem) => workItem.isDeadLetter === true).length,
|
|
368812
368840
|
nItemsTypes: {
|
|
368813
368841
|
nothing,
|
|
368814
368842
|
retry,
|
|
@@ -368942,7 +368970,8 @@ async function runWorkItem(workItem) {
|
|
|
368942
368970
|
return;
|
|
368943
368971
|
}
|
|
368944
368972
|
else {
|
|
368945
|
-
operator_src_logger.error(`An error occurred while the processor was handling the '${workItem.operation}' operation for item '${workItem.item.kind}/${workItem.item.metadata.name}' in namespace '${workItem.item.metadata.namespace}'. Current work status is '${workItem.workStatus}'. The error was: '${e}'.`);
|
|
368973
|
+
operator_src_logger.error(`An unmanaged error occurred while the processor was handling the '${workItem.operation}' operation for item '${workItem.item.kind}/${workItem.item.metadata.name}' in namespace '${workItem.item.metadata.namespace}'. Current work status is '${workItem.workStatus}'. The error was: '${e}'.`);
|
|
368974
|
+
await deadLetterHandler(workItem);
|
|
368946
368975
|
console.error(e);
|
|
368947
368976
|
}
|
|
368948
368977
|
return;
|
|
@@ -374232,11 +374261,15 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374232
374261
|
const nWorkItemsPendingCounter = meter.createObservableGauge('firestartr_workitems_pending_total', { description: 'Number of workitems with PENDING status in the queue' });
|
|
374233
374262
|
const nWorkItemsProcessingCounter = meter.createObservableGauge('firestartr_workitems_processing_total', { description: 'Number of workitems with PROCESSING status in the queue' });
|
|
374234
374263
|
const nWorkItemsFinishedCounter = meter.createObservableGauge('firestartr_workitems_finished_total', { description: 'Number of workitems with FINISHED status in the queue' });
|
|
374264
|
+
const nWorkItemsInDeadLetterHandling = meter.createObservableGauge('firestartr_workitems_dead_letter_handling_total', {
|
|
374265
|
+
description: 'Number of workitems of the queue handled by the Dead Letter Handler',
|
|
374266
|
+
});
|
|
374235
374267
|
const queueMetrics = getQueueMetrics();
|
|
374236
374268
|
let total = queueMetrics.nItems;
|
|
374237
374269
|
let pending = queueMetrics.nItemsPending;
|
|
374238
374270
|
let processing = queueMetrics.nItemsProcessing;
|
|
374239
374271
|
let finished = queueMetrics.nItemsFinished;
|
|
374272
|
+
let inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374240
374273
|
nWorkItemsCounter.addCallback((observer) => observer.observe(total, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374241
374274
|
nWorkItemsPendingCounter.addCallback((observer) => observer.observe(pending, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374242
374275
|
nWorkItemsProcessingCounter.addCallback((observer) => observer.observe(processing, {
|
|
@@ -374244,12 +374277,17 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374244
374277
|
...queueMetrics.nItemsTypes,
|
|
374245
374278
|
}));
|
|
374246
374279
|
nWorkItemsFinishedCounter.addCallback((observer) => observer.observe(finished, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374280
|
+
nWorkItemsInDeadLetterHandling.addCallback((observer) => observer.observe(inDeadLetterHandling, {
|
|
374281
|
+
...attributes,
|
|
374282
|
+
...queueMetrics.nItemsTypes,
|
|
374283
|
+
}));
|
|
374247
374284
|
setInterval(() => {
|
|
374248
374285
|
const queueMetrics = getQueueMetrics();
|
|
374249
374286
|
total = queueMetrics.nItems;
|
|
374250
374287
|
pending = queueMetrics.nItemsPending;
|
|
374251
374288
|
processing = queueMetrics.nItemsProcessing;
|
|
374252
374289
|
finished = queueMetrics.nItemsFinished;
|
|
374290
|
+
inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374253
374291
|
}, 1000);
|
|
374254
374292
|
}
|
|
374255
374293
|
async function startMemoryMetrics(meter, attributes) {
|
|
@@ -22,6 +22,7 @@ export type WorkItem = {
|
|
|
22
22
|
onDelete: Function;
|
|
23
23
|
process?: Function;
|
|
24
24
|
upsertTime?: number;
|
|
25
|
+
isDeadLetter?: boolean;
|
|
25
26
|
};
|
|
26
27
|
type HandlerFinalizerFn = (kind: string, namespace: string, item: any | string, finalizer: string) => Promise<any>;
|
|
27
28
|
type HandlerInformPlanFn = (prUrl: string, planText: string) => Promise<void>;
|