Skip to content

Commit

Permalink
Add latest-update field on custom object status
Browse files Browse the repository at this point in the history
  • Loading branch information
swoehrl-mw committed Jul 6, 2023
1 parent ca0e9d0 commit 391d428
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ jobs:
run: |
VERSION=${GITHUB_REF//refs\/tags\/v}
sed -i 's/0.0.1/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator/Chart.yaml
sed -i 's/0.1.0/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator/Chart.yaml
sed -i 's/dev/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator/values.yaml
sed -i 's/0.0.1/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator-crds/Chart.yaml
sed -i 's/dev/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator-crds/values.yaml
sed -i 's/0.1.0/'"${VERSION}"'/' helm/hybrid-cloud-amqp-operator-crds/Chart.yaml
- name: Publish helm chart
uses: stefanprodan/helm-gh-pages@master
Expand Down
4 changes: 3 additions & 1 deletion hybridcloud/handlers/broker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime, timezone
import kopf
from .routing import amqp_backend
from hybridcloud_core.configuration import config_get
Expand Down Expand Up @@ -65,6 +66,7 @@ def _status(name, namespace, status_obj, status, reason=None, backend=None, endp
status_obj["broker_name"] = broker_name
status_obj["deployment"] = {
"status": status,
"reason": reason
"reason": reason,
"latest-update": datetime.now(tz=timezone.utc).isoformat()
}
patch_namespaced_custom_object_status(k8s.AMQPBroker, namespace, name, status_obj)
4 changes: 3 additions & 1 deletion hybridcloud/handlers/queue.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime, timezone
import kopf
from .routing import amqp_backend
from hybridcloud_core.configuration import config_get
Expand Down Expand Up @@ -101,6 +102,7 @@ def _status(name, namespace, status_obj, status, reason=None, backend=None, brok
status_obj["queue_name"] = queue_name
status_obj["deployment"] = {
"status": status,
"reason": reason
"reason": reason,
"latest-update": datetime.now(tz=timezone.utc).isoformat()
}
patch_namespaced_custom_object_status(k8s.AMQPQueue, namespace, name, status_obj)
4 changes: 3 additions & 1 deletion hybridcloud/handlers/queue_consumer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime, timezone
import kopf
from .routing import amqp_backend
from hybridcloud_core.configuration import config_get
Expand Down Expand Up @@ -97,7 +98,8 @@ def _status(name, namespace, status_obj, status, reason=None, backend=None, brok
status_obj["queue_name"] = queue_name
status_obj["deployment"] = {
"status": status,
"reason": reason
"reason": reason,
"latest-update": datetime.now(tz=timezone.utc).isoformat()
}
patch_namespaced_custom_object_status(k8s.AMQPQueueConsumer, namespace, name, status_obj)

Expand Down
4 changes: 3 additions & 1 deletion hybridcloud/handlers/topic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime, timezone
import kopf
from .routing import amqp_backend
from hybridcloud_core.configuration import config_get
Expand Down Expand Up @@ -101,6 +102,7 @@ def _status(name, namespace, status_obj, status, reason=None, backend=None, brok
status_obj["topic_name"] = topic_name
status_obj["deployment"] = {
"status": status,
"reason": reason
"reason": reason,
"latest-update": datetime.now(tz=timezone.utc).isoformat()
}
patch_namespaced_custom_object_status(k8s.AMQPTopic, namespace, name, status_obj)
4 changes: 3 additions & 1 deletion hybridcloud/handlers/topic_subscription.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime, timezone
import kopf
from .routing import amqp_backend
from hybridcloud_core.configuration import config_get
Expand Down Expand Up @@ -105,7 +106,8 @@ def _status(name, namespace, status_obj, status, reason=None, backend=None, brok
status_obj["subscription_name"] = subscription_name
status_obj["deployment"] = {
"status": status,
"reason": reason
"reason": reason,
"latest-update": datetime.now(tz=timezone.utc).isoformat()
}
patch_namespaced_custom_object_status(k8s.AMQPTopicSubscription, namespace, name, status_obj)

Expand Down

0 comments on commit 391d428

Please sign in to comment.