mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
stuff
This commit is contained in:
@@ -89,20 +89,18 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
return this.resource.kind;
|
||||
}
|
||||
|
||||
public get metadata() {
|
||||
public get metadata(): KubernetesObject['metadata'] {
|
||||
const metadata = this.resource.metadata;
|
||||
if (!metadata) {
|
||||
throw new Error('Custom resources needs metadata');
|
||||
}
|
||||
return metadata;
|
||||
return (
|
||||
metadata || {
|
||||
name: this.name,
|
||||
namespace: this.namespace,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public get name() {
|
||||
const name = this.metadata.name;
|
||||
if (!name) {
|
||||
throw new Error('Custom resources needs a name');
|
||||
}
|
||||
return name;
|
||||
return this.resource.specifier.name;
|
||||
}
|
||||
|
||||
public get namespace() {
|
||||
@@ -130,7 +128,7 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
}
|
||||
|
||||
public get isSeen() {
|
||||
return this.metadata.generation === this.status?.observedGeneration;
|
||||
return this.metadata?.generation === this.status?.observedGeneration;
|
||||
}
|
||||
|
||||
public get isValidSpec() {
|
||||
@@ -146,7 +144,7 @@ abstract class CustomResource<TSpec extends ZodObject> extends EventEmitter<Cust
|
||||
return;
|
||||
}
|
||||
await this.patchStatus({
|
||||
observedGeneration: this.metadata.generation,
|
||||
observedGeneration: this.metadata?.generation,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Watcher } from '../watchers/watchers.watcher.ts';
|
||||
import { WatcherService } from '../watchers/watchers.ts';
|
||||
import type { Resource } from '../resources/resources.ts';
|
||||
|
||||
const ISTIO_APP_SELECTOR = 'istio=ingress';
|
||||
const ISTIO_APP_SELECTOR = 'istio=gateway-controller';
|
||||
|
||||
class IstioService {
|
||||
#gatewayResource: ResourceReference<V1Deployment>;
|
||||
|
||||
@@ -33,6 +33,14 @@ class EnsuredSecret<T extends ZodObject> {
|
||||
this.#handleChanged();
|
||||
}
|
||||
|
||||
public get name() {
|
||||
return this.#options.name;
|
||||
}
|
||||
|
||||
public get namespace() {
|
||||
return this.#options.namespace;
|
||||
}
|
||||
|
||||
public get resouce() {
|
||||
return this.#resource;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user