Skip to content

Commit e6869cb

Browse files
committed
Add resource-specific health checks for standard Kubernetes role and rolebinding resources
Signed-off-by: doxsch <28098153+doxsch@users.noreply.github.com>
1 parent c3ccef8 commit e6869cb

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ This function implements resource-specific health checks for standard Kubernetes
5151
- [ ] NetworkPolicy
5252

5353
### RBAC (rbac.authorization.k8s.io/v1)
54-
- [ ] Role
54+
- [x] Role - Always ready if it exists
5555
- [ ] ClusterRole
56-
- [ ] RoleBinding
56+
- [x] RoleBinding - Always ready if it exists
5757
- [ ] ClusterRoleBinding
5858

5959
### Storage (storage.k8s.io/v1)

healthchecks/registry.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ func init() {
6868
registerPersistentVolumeClaimHealthCheck()
6969
registerPodHealthCheck()
7070
registerReplicaSetHealthCheck()
71+
registerRoleHealthCheck()
72+
registerRoleBindingHealthCheck()
7173
registerSecretHealthCheck()
7274
registerServiceHealthCheck()
7375
registerServiceAccountHealthCheck()

healthchecks/role.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package healthchecks
2+
3+
import (
4+
"k8s.io/apimachinery/pkg/runtime/schema"
5+
)
6+
7+
func registerRolegHealthCheck() {
8+
gvk := schema.GroupVersionKind{
9+
Group: "rbac.authorization.k8s.io",
10+
Version: "v1",
11+
Kind: "Role",
12+
}
13+
RegisterHealthCheck(gvk, alwaysReady)
14+
}

healthchecks/rolebinding.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package healthchecks
2+
3+
import (
4+
"k8s.io/apimachinery/pkg/runtime/schema"
5+
)
6+
7+
func registerRoleBindingHealthCheck() {
8+
gvk := schema.GroupVersionKind{
9+
Group: "rbac.authorization.k8s.io",
10+
Version: "v1",
11+
Kind: "RoleBinding",
12+
}
13+
RegisterHealthCheck(gvk, alwaysReady)
14+
}

0 commit comments

Comments
 (0)