@firestartr/cli 2.0.0 → 2.1.0-snapshot
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
|
@@ -367906,6 +367906,7 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
|
|
|
367906
367906
|
const collection = new ReimportCollection();
|
|
367907
367907
|
const importAnnotation = catalog_common.generic.getFirestartrAnnotation('import');
|
|
367908
367908
|
const reImportAnnotation = catalog_common.generic.getFirestartrAnnotation('needs-re-import');
|
|
367909
|
+
const reconcileAtAnnotation = catalog_common.generic.getFirestartrAnnotation('reconcile-at');
|
|
367909
367910
|
const crsWithDependenciesToAnnotate = [];
|
|
367910
367911
|
// we need to perform a search in all the crsPath
|
|
367911
367912
|
await searchCRs(crsPath, async (cr, filePath) => {
|
|
@@ -367922,6 +367923,10 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
|
|
|
367922
367923
|
}
|
|
367923
367924
|
cr.metadata.annotations[reImportAnnotation] = 'true';
|
|
367924
367925
|
cr.metadata.annotations[importAnnotation] = 'true';
|
|
367926
|
+
// we set an annotion to trigger the update
|
|
367927
|
+
cr.metadata.annotations[reconcileAtAnnotation] = new Date()
|
|
367928
|
+
.toISOString()
|
|
367929
|
+
.replace(/\.\d{3}Z$/, 'Z'); // exact format: 2026-04-19T20:45:00Z
|
|
367925
367930
|
// we write the cr back to the file system
|
|
367926
367931
|
const newContent = catalog_common.io.toYaml(cr);
|
|
367927
367932
|
await promises_default().writeFile(filePath, newContent, 'utf-8');
|
|
@@ -368988,6 +368993,7 @@ function conditionsSorter(conditions) {
|
|
|
368988
368993
|
|
|
368989
368994
|
|
|
368990
368995
|
|
|
368996
|
+
|
|
368991
368997
|
async function upsertInitialStatus(pluralKind, namespace, item) {
|
|
368992
368998
|
item = await getItemByItemPath(`${namespace}/${pluralKind}/${item.metadata.name}`);
|
|
368993
368999
|
if (!('status' in item))
|
|
@@ -369003,6 +369009,11 @@ async function needsProvisioningOnCreateOrUpdate(cr) {
|
|
|
369003
369009
|
operator_src_logger.debug(`The custom resource '${cr.kind}/${cr.metadata.name}' is missing a status and any conditions.`);
|
|
369004
369010
|
return { needs: true, reason: 'CREATED' };
|
|
369005
369011
|
}
|
|
369012
|
+
// there is a force by annotation?
|
|
369013
|
+
if (shouldForceReconcileByAnnotation(cr)) {
|
|
369014
|
+
operator_src_logger.debug(`The custom resource '${cr.kind}/${cr.metadata.name}' has a newer '${catalog_common.generic.getFirestartrAnnotation('reconcile-at')}' annotation than the latest condition update time, so a force-reconcile will be triggered.`);
|
|
369015
|
+
return { needs: true, reason: 'FORCE_RECONCILE_ANNOTATION' };
|
|
369016
|
+
}
|
|
369006
369017
|
// ERROR
|
|
369007
369018
|
const errCond = getConditionByType(cr.status.conditions, 'ERROR');
|
|
369008
369019
|
if (errCond && errCond.status === 'True') {
|
|
@@ -369038,6 +369049,36 @@ async function needsProvisioningOnCreateOrUpdate(cr) {
|
|
|
369038
369049
|
operator_src_logger.debug(`Skipping the provisioning process for custom resource '${cr.kind}/${cr.metadata.name}' because its current state is not handled.`);
|
|
369039
369050
|
return { needs: false };
|
|
369040
369051
|
}
|
|
369052
|
+
function shouldForceReconcileByAnnotation(cr) {
|
|
369053
|
+
const annotationType = catalog_common.generic.getFirestartrAnnotation('reconcile-at');
|
|
369054
|
+
const annotationValue = cr.metadata?.annotations?.[annotationType];
|
|
369055
|
+
if (!annotationValue) {
|
|
369056
|
+
return false;
|
|
369057
|
+
}
|
|
369058
|
+
operator_src_logger.debug(`Found annotation '${annotationType}' with value '${annotationValue}' on ${cr.metadata.name}`);
|
|
369059
|
+
const annotationTime = new Date(annotationValue).getTime();
|
|
369060
|
+
if (isNaN(annotationTime)) {
|
|
369061
|
+
operator_src_logger.warn(`Timestamp is invalid for the annotation ${cr.kind}/${cr.metadata?.name || 'unknown'}: ${annotationValue}`);
|
|
369062
|
+
return false;
|
|
369063
|
+
}
|
|
369064
|
+
// Buscamos el timestamp más reciente de TODAS las conditions
|
|
369065
|
+
let latestConditionTime = 0;
|
|
369066
|
+
for (const condition of cr.status?.conditions || []) {
|
|
369067
|
+
const timeStr = condition.lastUpdateTime || condition.lastTransitionTime;
|
|
369068
|
+
if (timeStr) {
|
|
369069
|
+
const conditionTime = new Date(timeStr).getTime();
|
|
369070
|
+
if (!isNaN(conditionTime) && conditionTime > latestConditionTime) {
|
|
369071
|
+
latestConditionTime = conditionTime;
|
|
369072
|
+
}
|
|
369073
|
+
}
|
|
369074
|
+
}
|
|
369075
|
+
const shouldForce = annotationTime > latestConditionTime;
|
|
369076
|
+
operator_src_logger.debug(shouldForce, `Evaluating force-reconcile for ${cr.metadata.name}: annotation time (${new Date(annotationTime).toISOString()}) vs latest condition time (${new Date(latestConditionTime).toISOString()})`);
|
|
369077
|
+
if (shouldForce) {
|
|
369078
|
+
operator_src_logger.info(`force-reconcile activated for ${cr.metadata.name} → annotation (${annotationValue}) is newer than latest condition time (${new Date(latestConditionTime).toISOString()})`);
|
|
369079
|
+
}
|
|
369080
|
+
return shouldForce;
|
|
369081
|
+
}
|
|
369041
369082
|
async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime, message, status) {
|
|
369042
369083
|
operator_src_logger.info(`The item at '${itemPath}' transitioned to a new SYNCHRONIZED condition of '${status}'. The reason for the change is '${reason}' with the message: '${message}'.`);
|
|
369043
369084
|
const k8sItem = await getItemByItemPath(itemPath);
|
|
@@ -379414,7 +379455,7 @@ const crs_analyzerSubcommand = {
|
|
|
379414
379455
|
};
|
|
379415
379456
|
|
|
379416
379457
|
;// CONCATENATED MODULE: ./package.json
|
|
379417
|
-
const package_namespaceObject = {"i8":"2.
|
|
379458
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.1.0-snapshot"}');
|
|
379418
379459
|
;// CONCATENATED MODULE: ../../package.json
|
|
379419
379460
|
const package_namespaceObject_1 = {"i8":"2.0.0"};
|
|
379420
379461
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -4,6 +4,7 @@ export type NeedsCreationOrUpdate = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function upsertInitialStatus(pluralKind: string, namespace: string, item: any): Promise<void>;
|
|
6
6
|
export declare function needsProvisioningOnCreateOrUpdate(cr: any): Promise<NeedsCreationOrUpdate>;
|
|
7
|
+
export declare function shouldForceReconcileByAnnotation(cr: any): boolean;
|
|
7
8
|
export declare function updateSyncTransition(itemPath: string, reason: string, lastSyncTime: string, nextSyncTime: string, message: string, status: string): Promise<void>;
|
|
8
9
|
export declare function writePrioritizedStatus(kind: string, namespace: string, item: any): Promise<void>;
|
|
9
10
|
export declare function updateTransition(itemPath: string, reason: string, type: string, statusValue: string, message?: string, updateStatusOnly?: boolean): Promise<void>;
|