feat: improve resource reconciliation and observability
This commit is contained in:
+20
-1
@@ -100,6 +100,25 @@ export function createBuildJob(options: BuildJobOptions): KubernetesJob {
|
||||
"kuber.astrxl.dev/build": options.name,
|
||||
...options.labels,
|
||||
};
|
||||
const amd64Toleration = {
|
||||
key: "arch",
|
||||
operator: "Equal",
|
||||
value: "amd64",
|
||||
effect: "NoExecute",
|
||||
};
|
||||
const tolerations = [...(options.tolerations ?? [])];
|
||||
if (
|
||||
options.spec.architecture === "amd64" &&
|
||||
!tolerations.some(
|
||||
(toleration) =>
|
||||
toleration.key === amd64Toleration.key &&
|
||||
toleration.operator === amd64Toleration.operator &&
|
||||
toleration.value === amd64Toleration.value &&
|
||||
toleration.effect === amd64Toleration.effect &&
|
||||
Object.keys(toleration).length === Object.keys(amd64Toleration).length,
|
||||
)
|
||||
)
|
||||
tolerations.push(amd64Toleration);
|
||||
|
||||
return {
|
||||
apiVersion: "batch/v1",
|
||||
@@ -134,7 +153,7 @@ export function createBuildJob(options: BuildJobOptions): KubernetesJob {
|
||||
...options.nodeSelector,
|
||||
"kubernetes.io/arch": options.spec.architecture,
|
||||
},
|
||||
...(options.tolerations ? { tolerations: options.tolerations } : {}),
|
||||
...(tolerations.length ? { tolerations } : {}),
|
||||
securityContext: {
|
||||
runAsNonRoot: true,
|
||||
runAsUser: 1000,
|
||||
|
||||
Reference in New Issue
Block a user