Complete residential site build with Docker Compose & Gitea Actions deployment

This commit is contained in:
CalebLewallen
2026-05-13 17:31:20 -04:00
parent f9c4e13a50
commit 3c22823f72
19354 changed files with 2097331 additions and 0 deletions
@@ -0,0 +1,74 @@
import { SingleYAMLDocument } from '../parser/yamlParser07';
/**
* Retrieve schema by auto-detecting the Kubernetes GroupVersionKind (GVK) from the document.
* If there is no definition for the GVK in the main kubernetes schema,
* the schema is then retrieved from the CRD catalog.
* Public for testing purpose, not part of the API.
* @param doc
* @param crdCatalogURI The URL of the CRD catalog to retrieve the schema from
* @param kubernetesSchema The main kubernetes schema, if it includes a definition for the GVK it will be used
*/
export function autoDetectKubernetesSchemaFromDocument(doc, crdCatalogURI, kubernetesSchema) {
const res = getGroupVersionKindFromDocument(doc);
if (!res) {
return undefined;
}
const { group, version, kind } = res;
if (!group || !version || !kind) {
return undefined;
}
const k8sSchema = kubernetesSchema.schema;
const kubernetesBuildIns = (k8sSchema.oneOf || [])
.map((s) => {
if (typeof s === 'boolean') {
return undefined;
}
return s._$ref || s.$ref;
})
.filter((ref) => ref)
.map((ref) => ref.replace('_definitions.json#/definitions/', '').toLowerCase());
const groupWithoutK8sIO = group.replace('.k8s.io', '');
const k8sTypeName = `io.k8s.api.${groupWithoutK8sIO.toLowerCase()}.${version.toLowerCase()}.${kind.toLowerCase()}`;
if (kubernetesBuildIns.includes(k8sTypeName)) {
return undefined;
}
if (k8sTypeName.includes('openshift.io')) {
return `${crdCatalogURI}/openshift/v4.15-strict/${kind.toLowerCase()}_${group.toLowerCase()}_${version.toLowerCase()}.json`;
}
const schemaURL = `${crdCatalogURI}/${group.toLowerCase()}/${kind.toLowerCase()}_${version.toLowerCase()}.json`;
return schemaURL;
}
/**
* Retrieve the group, version and kind from the document.
* Public for testing purpose, not part of the API.
* @param doc
*/
export function getGroupVersionKindFromDocument(doc) {
if (doc instanceof SingleYAMLDocument) {
try {
const rootJSON = doc.root.internalNode.toJSON();
if (!rootJSON) {
return undefined;
}
const groupVersion = rootJSON['apiVersion'];
if (!groupVersion) {
return undefined;
}
const [group, version] = groupVersion.split('/');
if (!group || !version) {
return undefined;
}
const kind = rootJSON['kind'];
if (!kind) {
return undefined;
}
return { group, version, kind };
}
catch (error) {
console.error('Error parsing YAML document:', error);
return undefined;
}
}
return undefined;
}
//# sourceMappingURL=crdUtil.js.map