Predefined Templating Variables for Kubernetes
The predefined variables can be used in an HTTP request template or in an email template. The policy engine substitutes the value of the variable in the context of the triggering event(s) when it sends the actual request or email.
You require to form the variables using the info class and base name and use these predefined variables in the email and HTML templates. To use this template for notification, see Notification Actions.
Base Names
The base names are used with the corresponding info class fields for predefined variables. For Kubernetes related triggering events, the base name is latestEvent.
Form Variable Names
To form a predefined variable name, combine the base name of the variable with a field of its corresponding info class.
latestEvent with the name,entityTypeDisplayName, and attributes fields of theModernEntityInfo class. This forms the following variable:
${latestEvent.modernEntity.name} (${latestEvent.modernEntity.entityTypeDisplayName})
${latestEvent.modernEntity.attributes}
- entityType: The type of the entity such as CLUSTER, NAMESPACE, DEPLOYMENT or POD.
- entityTypeDisplayName: The display name of the entity type such as Cluster.
- name: The actual name of the entity.
- isLegacyEntity: To determine if the entity is modern (Kubernetes entities) or legacy. For example, when iterating for affected entities, you can use this field.
- attributes: To include the required attributes for the Kubernetes entities in a hierarchical way. These are the supported attributes:
- k8s.cluster.name
- k8s.namespace.name
- k8s.deployment.name
- k8s.daemonset.name
- k8s.cronjob.name
- k8s.statefulset.name
- k8s.replicaset.name
- k8s.container.name
- k8s.resourcequota.name
- k8s.pod.name
- k8s.entity.type
- k8s.workload.type
${latestEvent.modernEntity.name} (${latestEvent.modernEntity.entityTypeDisplayName})
${latestEvent.modernEntity.attributes}
Info Class Fields
- The
ModernEntityInfoclass is used for Kubernetes entities. - The
EntityInfoclass includes theisLegacyEntityfield, which provides the information if the entity is legacy (such as, application, tiers, and nodes) or modern (Kubernetes entities). - The attributes field within the
ModernEntityInfoclass is to determine the details in a hierarchical way. - The long id is applicable only for
EntityInfoclass and not applicable toModernEntity.
class EventInfo {
EventType eventType
String guid
String eventTypeKey
Date eventTime
String displayName
String summaryMessage
String eventMessage
EntityInfo application
EntityInfo tier
EntityInfo node
EntityInfo db
ModernEntityInfo modernEntity;
List<EntityInfo> affectedEntities
boolean healthRuleEvent
EntityInfo anomaly // * Only defined in case of anomaly event
EntityInfo healthRule // * Only defined when healthRuleEvent == true
EntityInfo incident // * Only defined when healthRuleEvent == true
boolean healthRuleViolationEvent
NotificationSeverity severity
ImageInfo severityImage
boolean btPerformanceEvent // * true when eventType matches one of the BT performance event types
String deepLink
}
class ImageInfo {
String name
String fileName
String mimeContentRef
String deepLink
}
class EntityInfo {
EntityType entityType
String entityTypeDisplayName
long id
String name
boolean isLegacyEntity;
Map<String, String> tagValues
}
class ModernEntityInfo extends EntityInfo {
String entityTypeDisplayName;
Map<String, Object> attributes;
}
class ModernEntityInfo {
EntityType entityType;
String entityTypeDisplayName;
String name;
boolean isLegacyEntity;
Map<String, Object> attributes;
}
class ActionInfo extends EntityInfo {
Date triggerTime
}
class PolicyInfo extends EntityInfo {
boolean digest
digestDurationInMins
}
class PolicyInfo {
EntityType entityType
String entityTypeDisplayName
long id
String name
boolean digest
int digestDurationInMins
}
class ActionInfo {
EntityType entityType
String entityTypeDisplayName
String name
Date triggerTime
}
enum NotificationSeverity { INFO, WARN, ERROR }
class NodeTemplateVariables {
private String name;
private long tierId;
private String tierName;
private long machineId;
private String machineName;
private boolean machineAgentPresent;
private String machineAgentVersion;
private boolean appAgentPresent;
private String appAgentVersion;
private String ipAddresses;
private AgentType agentType;
private Map<String, String> tagValues;
}