Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ocp_resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ class ApiGroup:
SCHEDULING_K8S_IO = "scheduling.k8s.io"
SECURITY_ISTIO_IO = "security.istio.io"
SECURITY_OPENSHIFT_IO = "security.openshift.io"
SELF_NODE_REMEDIATION_MEDIK8S_IO = "self-node-remediation.medik8s.io"
SNAPSHOT_STORAGE_K8S_IO = "snapshot.storage.k8s.io"
SNAPSHOT_KUBEVIRT_IO = "snapshot.kubevirt.io"
SRIOVNETWORK_OPENSHIFT_IO = "sriovnetwork.openshift.io"
Expand Down
36 changes: 36 additions & 0 deletions ocp_resources/self_node_remediation_templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# API reference: https://github.com/medik8s/self-node-remediation
from typing import Any

from ocp_resources.resource import NamespacedResource


class SelfNodeRemediationTemplate(NamespacedResource):
"""
SelfNodeRemediationTemplate CRD
"""

api_group = NamespacedResource.ApiGroup.SELF_NODE_REMEDIATION_MEDIK8S_IO

def __init__(
self,
remediation_strategy: str = "",
**kwargs: Any,
) -> None:
"""
Create SelfNodeRemediationTemplate object.

Args:
remediation_strategy (str, optional): The remediation method for unhealthy nodes.
"""
super().__init__(
**kwargs,
)
self.remediation_strategy = remediation_strategy

def to_dict(self) -> None:
super().to_dict()
if not self.yaml_file:
_spec = self.res["spec"] = {"template": {"spec": {}}}

if self.remediation_strategy:
_spec["template"]["spec"]["remediationStrategy"] = self.remediation_strategy