-
-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
275 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Kubernetes Installation | ||
|
||
We have different solution to install Homer on Kubernetes Cluster, each solution responds to a specific need. | ||
|
||
|
||
## Table of Contents | ||
|
||
- [Helm Chart](#helm-chart) | ||
- [Controller With CRDs](#controller-crds) | ||
- [Controller With Ingress Annotations](#controller-annotations) | ||
- [Operator](#Operator) | ||
|
||
## Helm Chart | ||
|
||
To deploy Homer in Kubernetes | ||
|
||
Thanks to [@djjudas21](https://github.com/djjudas21) [charts](https://github.com/djjudas21/charts/tree/main/charts/homer): | ||
|
||
### Installation | ||
|
||
```sh | ||
helm repo add djjudas21 https://djjudas21.github.io/charts/ | ||
helm repo update djjudas21 | ||
|
||
# install with all defaults | ||
helm install homer djjudas21/homer | ||
|
||
# install with customisations | ||
wget https://raw.githubusercontent.com/djjudas21/charts/main/charts/homer/values.yaml | ||
# edit values.yaml | ||
helm install homer djjudas21/homer -f values.yaml | ||
``` | ||
|
||
## Controller CRDs | ||
|
||
To deploy Homer in Kubernetes with [Custom Resources Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) to dynamic declaration for Homer Service | ||
|
||
Thanks to [@jplanckeel](https://github.com/jplanckeel) [homer-k8s](https://github.com/bananaops/homer-k8s/tree/main/): | ||
|
||
### Installation | ||
|
||
```sh | ||
helm repo add bananaops https://bananaops.github.io/homer-k8s/ | ||
helm repo update bananaops | ||
|
||
# install with all defaults | ||
helm install homer bananaops/homer-k8s | ||
|
||
# install with customisations | ||
wget https://raw.githubusercontent.com/bananaops/homer-k8s/main/helm/homer-k8s/values.yaml | ||
# edit values.yaml | ||
helm install homer bananaops/homer-k8s -f values.yaml | ||
``` | ||
|
||
### Usage | ||
|
||
- [usage](https://github.com/bananaops/homer-k8s/tree/main/?tab=readme-ov-file#crds-homerservices) | ||
|
||
## Controller Annotations | ||
|
||
To deploy Homer in Kubernetes with controller to check ingress annoation and modify homer configuration | ||
|
||
Thanks to [@paulfantom](https://github.com/paulfantom) [homer-reloader](https://github.com/paulfantom/homer-reloader/tree/main/): | ||
|
||
|
||
## Operator | ||
|
||
To deploy many Homer in Kubernetes with [Custom Resources Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) | ||
|
||
Thanks to [@rajsinghtech](https://github.com/rajsinghtech) [homer-operator](https://github.com/rajsinghtech/homer-operator/tree/main/): | ||
|
||
|
||
### Installation | ||
|
||
```sh | ||
# install with customisations | ||
wget https://raw.githubusercontent.com/rajsinghtech/homer-operator/main/deploy/operator.yaml | ||
# Apply operator file | ||
kubectl apply -f operator.yaml | ||
``` | ||
|
||
### Usage | ||
|
||
- [usage](https://github.com/rajsinghtech/homer-operator?tab=readme-ov-file#usage) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "homer", | ||
"version": "24.04.1", | ||
"version": "24.05.1", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
<template> | ||
<Generic :item="item"> | ||
<template #content> | ||
<p class="title is-4">{{ item.name }}</p> | ||
<p class="subtitle is-6"> | ||
<template v-if="item.subtitle"> | ||
{{ item.subtitle }} | ||
</template> | ||
<template v-else> | ||
{{ details }} | ||
</template> | ||
</p> | ||
</template> | ||
<template #indicator> | ||
<div v-if="status" class="status" :class="status"> | ||
{{ status }} | ||
</div> | ||
</template> | ||
</Generic> | ||
</template> | ||
|
||
<script> | ||
import service from "@/mixins/service.js"; | ||
import Generic from "./Generic.vue"; | ||
export default { | ||
name: "HomeAssistant", | ||
mixins: [service], | ||
props: { | ||
item: Object, | ||
}, | ||
components: { | ||
Generic, | ||
}, | ||
data: () => ({ | ||
status: "", | ||
version: "", | ||
entities: 0, | ||
location_name: "", | ||
separator: " ", | ||
items: ["name", "version"], | ||
}), | ||
computed: { | ||
headers: function () { | ||
return { | ||
'Authorization': `Bearer ${this.item.apikey}`, | ||
'Content-Type': 'application/json', | ||
}; | ||
}, | ||
details: function () { | ||
const details = []; | ||
const items = this.items; | ||
const separator = this.separator; | ||
for (const i in items) { | ||
const key = items[i]; | ||
switch (key) { | ||
case "version": | ||
details.push( | ||
`v${this.version}`, | ||
); | ||
break; | ||
case "name": | ||
details.push( | ||
`${this.location_name}`, | ||
); | ||
break; | ||
case "entities": | ||
details.push( | ||
`${this.entities} entities`, | ||
); | ||
break; | ||
default: | ||
details.push( | ||
`undefined key ${key} `, | ||
); | ||
} | ||
} | ||
return details.join(separator); | ||
}, | ||
}, | ||
created() { | ||
this.fetchServerStatus().then(() => { | ||
if (!this.item.subtitle && this.status !== "dead") { | ||
if (this.item.items) this.items = this.item.items; | ||
if (this.item.separator) this.separator = this.item.separator; | ||
this.fetchServerStats(); | ||
} | ||
}); | ||
}, | ||
methods: { | ||
fetchServerStatus: async function () { | ||
const headers = this.headers; | ||
return this.fetch("/api/", { headers }) | ||
.then((response) => { | ||
if (response && response.message) this.status = "running"; | ||
else throw new Error(); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
this.status = "dead"; | ||
}); | ||
}, | ||
fetchServerStats: async function () { | ||
const headers = this.headers; | ||
this.fetch("/api/config", { headers }) | ||
.then((response) => { | ||
if (response) { | ||
if (response.version) this.version = response.version; | ||
if (response.location_name) this.location_name = response.location_name; | ||
} | ||
else throw new Error(); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
this.status = "dead"; | ||
}); | ||
this.fetch("/api/states", { headers }) | ||
.then((response) => { | ||
if (response) { | ||
this.entities = response.length; | ||
} | ||
else throw new Error(); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
this.status = "dead"; | ||
}); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.status { | ||
font-size: 0.8rem; | ||
color: var(--text-title); | ||
&.running:before { | ||
background-color: #94e185; | ||
border-color: #78d965; | ||
box-shadow: 0 0 5px 1px #94e185; | ||
} | ||
&.dead:before { | ||
background-color: #c9404d; | ||
border-color: #c42c3b; | ||
box-shadow: 0 0 5px 1px #c9404d; | ||
} | ||
&:before { | ||
content: " "; | ||
display: inline-block; | ||
width: 7px; | ||
height: 7px; | ||
margin-right: 10px; | ||
border: 1px solid #000; | ||
border-radius: 7px; | ||
} | ||
} | ||
</style> |