Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from Adi146/update-kubernetes-asyncio
Browse files Browse the repository at this point in the history
Update kubernetes_asyncio
  • Loading branch information
Adi146 authored Jul 24, 2022
2 parents 0e0b47a + dd307eb commit 8d8e979
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 33 deletions.
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

28 changes: 6 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Following components are supported at the moment:
- Pods

The sensors will be named with this schema: _kind__*namespace*__name_. For example a Pod sensor could be named *sensor.deployment_homeassistant_homeassistant_db*
You can find further details of the component in the attributes of the sensor. If you want to monitor specific details of a sensor you can create a template sensor like that:
You can find further details of the component in the attributes of the sensor. If you want to monitor specific details of a sensor you can create a template sensor like that:

```{{ state_attr('sensor.daemonset_glances_glances', 'spec')["template"]["spec"]["containers"][0]["image"] }}```

Expand All @@ -37,9 +37,9 @@ The integration provides a few service for managing Kubernetes
Set the unschedulable flag of a Node. Attention this will not drain the node!

```
service: kubernetes.set_unschedulable
target:
entity_id: sensor.node_pi02 data:
service: kubernetes.set_unschedulable
target:
entity_id: sensor.node_pi02 data:
unschedulable: true
```

Expand All @@ -48,26 +48,10 @@ unschedulable: true
Sets the image of a Deployment or DaemonSet. This service acts like kubectl set image.

```
service: kubernetes.set_image_deployment
service: kubernetes.set_image_deployment
target:
entity_id: sensor.deployment_homeassistant_homeassistant
data:
data:
container: homeassistant
image: homeassistant/home-assistant:2021.10
```

## Panel and Cards

Additionally the integration provides a basic custom panel for better overview (This is still under development and there will be big changes).
There are also a few custom cards which can be added to your lovelace dashboard.

### k8s-component-details

Provides details of a single Kubernetes component.

```
type: custom:k8s-component-details
entity: sensor.deployment_homeassistant_homeassistant
```

![k8s-component-details.png](/images/component-details-card.png)
4 changes: 0 additions & 4 deletions custom_components/kubernetes/kubernetes_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ async def subscribe_events(self, async_add_entities, list_func, entity_class):
resource = event["object"]
eventType = event["type"]

_LOGGER.warning(
f"{resource.kind} {eventType} {resource.metadata.name}"
)

if eventType == "ADDED" and resource.metadata.uid not in entities:
sensor = entity_class(self, resource)
entities[resource.metadata.uid] = sensor
Expand Down
10 changes: 7 additions & 3 deletions custom_components/kubernetes/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
"name": "kubernetes",
"config_flow": true,
"documentation": "https://github.com/home-assistant/example-custom-config/tree/master/custom_components/example_sensor/",
"codeowners": ["@Adi146"],
"requirements": ["kubernetes_asyncio==18.20.0"],
"codeowners": [
"@Adi146"
],
"requirements": [
"kubernetes_asyncio==23.6.0"
],
"iot_class": "local_polling",
"version": "1.0.0"
}
}
Binary file removed images/component-details-card.png
Binary file not shown.

0 comments on commit 8d8e979

Please sign in to comment.