mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
more
This commit is contained in:
@@ -50,6 +50,13 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
options.resource.on('changed', this.#handleChanged);
|
||||
this.#queue = new CoalescingQueued({
|
||||
action: async () => {
|
||||
if (this.exists && !this.isValidSpec) {
|
||||
this.services.log.error(
|
||||
`Invalid spec for ${this.apiVersion}/${this.kind}/${this.namespace}/${this.name}`,
|
||||
this.spec,
|
||||
);
|
||||
return;
|
||||
}
|
||||
console.log('Reconcileing', this.apiVersion, this.kind, this.namespace, this.name);
|
||||
await this.reconcile?.();
|
||||
},
|
||||
@@ -75,19 +82,11 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
}
|
||||
|
||||
public get apiVersion() {
|
||||
const apiVersion = this.resource.apiVersion;
|
||||
if (!apiVersion) {
|
||||
throw new Error('Custom resources needs an apiVersion');
|
||||
}
|
||||
return apiVersion;
|
||||
return this.resource.apiVersion;
|
||||
}
|
||||
|
||||
public get kind() {
|
||||
const kind = this.resource.kind;
|
||||
if (!kind) {
|
||||
throw new Error('Custom resources needs a kind');
|
||||
}
|
||||
return kind;
|
||||
return this.resource.kind;
|
||||
}
|
||||
|
||||
public get metadata() {
|
||||
@@ -107,7 +106,7 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
}
|
||||
|
||||
public get namespace() {
|
||||
const namespace = this.metadata.namespace;
|
||||
const namespace = this.resource.specifier.namespace;
|
||||
if (!namespace) {
|
||||
throw new Error('Custom resources needs a namespace');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user