{title}
+{title}
++ +
diff --git a/.drone.yml b/.drone.yml index 07f92e0..63b154b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -55,6 +55,7 @@ trigger: - pull_request branch: - main + - update depends_on: - Build @@ -117,6 +118,7 @@ trigger: - pull_request branch: - main + - update depends_on: - Build @@ -127,6 +129,6 @@ volumes: temp: {} --- kind: signature -hmac: bea117f5e4b51c4fc215ae86962a8cfb24993d9e9b7db3498ab5940b10c70d69 +hmac: 83b1ec6458ceddef038000faac2b391d192530ceb681b790ad79c90456f12cca ... diff --git a/.kubernetes/deployment.yml b/.kubernetes/deployment.yml index ff68271..c8613e2 100644 --- a/.kubernetes/deployment.yml +++ b/.kubernetes/deployment.yml @@ -21,32 +21,9 @@ spec: - image: ${IMAGE} imagePullPolicy: IfNotPresent name: infra-map - env: - - name: HOMEASSISTANT_TOKEN - valueFrom: - secretKeyRef: - name: secret-env-values - key: HOMEASSISTANT_TOKEN - - name: HOMEASSISTANT_URL - valueFrom: - secretKeyRef: - name: secret-env-values - key: HOMEASSISTANT_URL - - name: PROXMOX_TOKEN - valueFrom: - secretKeyRef: - name: secret-env-values - key: PROXMOX_TOKEN - - name: PROXMOX_URL - valueFrom: - secretKeyRef: - name: secret-env-values - key: PROXMOX_URL - - name: TRAEFIK_URL - valueFrom: - secretKeyRef: - name: secret-env-values - key: TRAEFIK_URL + envFrom: + - secretRef: + name: secret-env-values resources: limits: cpu: 900m diff --git a/Dockerfile b/Dockerfile index bc8d06e..82d5b10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,4 @@ RUN yarn --production EXPOSE 3000 ENV NODE_ENV=production -CMD [ "node", "build" ] +CMD [ "node", "build/index.js" ] diff --git a/README.md b/README.md index b5b2950..f144204 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,61 @@ -# sv +# infra-map -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). +## Configuration setup -## Creating a project +set the following env variables during runtime or update `.env` file. -If you're seeing this, you've probably already done this step. Congrats! +### Kubernetes + +Required parameters: ```bash -# create a new project in the current directory -npx sv create - -# create a new project in my-app -npx sv create my-app +KUBERNETES_SERVICE_HOST=https://IP_ADDRESS:16443 +KUBERNETES_CA_CART_PATH=kube-ca.crt +KUBERNETES_SA_TOKEN=LKdgk34l... ``` +The `KUBERNETES_SERVICE_HOST` is the api server, [microk8s documentation](https://microk8s.io/docs/services-and-ports#services-binding-to-the-default-host-interface) describes that API server is running at port `16443`. Runtime in a pod this will be set by kubernetes. + +Get ca_cert from the any running pod at: `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`. + +### Proxmox + +Required parameters: + +```bash +PROXMOX_URL=https://apollo.schleppe:8086/api2/json/ +PROXMOX_TOKEN=PVEAPITOKEN=USER@pve!USER=TOKEN_VALUE +``` + +`PROXMOX_TOKEN` should contain the sub-variable `PVEAPITOKEN` that describes a proxmox API token. + +Create api token: + +- Create Users + - user name: infra-map + - realm: pve + - expire: never +- Add API tokens + - user: infra-map@pve + - token ID: infra-map +- Permissions + - add: API Token permissions + - path: / + - api-token: infra-map@pve!infra-map + - role: Administrator + - propagate: true + +## Home Assistant + +Required parameters: + +```bash +HOMEASSISTANT_URL=http://homeassistant.schleppe:8123/api/states +HOMEASSISTANT_TOKEN= +``` + +Follow hass documentation on generating a api token: https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token. + ## Developing Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: diff --git a/package.json b/package.json index c4be258..54983c3 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,9 @@ "dependencies": { "@kubernetes/client-node": "^1.1.0", "@microsoft/fetch-event-source": "^2.0.1", + "@zerodevx/svelte-json-view": "^1.0.11", + "sqlite": "^5.1.1", + "sqlite3": "^5.1.7", "sveltekit-sse": "^0.13.16" } } diff --git a/src/lib/components/ColorInput.svelte b/src/lib/components/ColorInput.svelte new file mode 100644 index 0000000..84ab146 --- /dev/null +++ b/src/lib/components/ColorInput.svelte @@ -0,0 +1,88 @@ + + +
heatlthy: {healthy}
@@ -28,7 +29,7 @@ .card-container { background-color: #cab2aa40; border-radius: 0.5rem; - width: 100%; + width: calc(100% - 1.5rem); padding: 0.75rem; .namespace { @@ -38,8 +39,8 @@ .card-wrapper { display: grid; - grid-template-columns: repeat(3, 1fr); - gap: 2rem; + grid-template-columns: var(--grid-tmpl-cols, repeat(3, 1fr)); + gap: var(--grid-gap, 2rem); } } diff --git a/src/lib/components/Deploy.svelte b/src/lib/components/Deploy.svelte index 02e5cc3..2a33656 100644 --- a/src/lib/components/Deploy.svelte +++ b/src/lib/components/Deploy.svelte @@ -6,11 +6,16 @@ export let deploy: V1Deployment; let { metadata, pods } = deploy; + + const deploymentUrl = `/cluster/deployment/${metadata?.uid}`;| {route.entryPoints} | +{route.name} | +{route.provider} | +{route.rule} | +{route.service} | +{route.status} | +
+