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.

If an info class comprises multiple fields, select a single field and associate it with the base name. For a list of fields associated with an info class, see Info Class Fields. For example, to use the Kubernetes entity name along with the attributes as a variable in a template, combine the base name, latestEvent with the name,entityTypeDisplayName, and attributes fields of theModernEntityInfo class. This forms the following variable:
CODE
${latestEvent.modernEntity.name} (${latestEvent.modernEntity.entityTypeDisplayName})
${latestEvent.modernEntity.attributes}
These are the available fields for the ModernEntityInfo class:
  • 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
In the EventInfo class, the ModernEntity field is included so that you can use any of the fields mentioned under the class ModernEntityInfo. You can use in the template variables as following:
CODE
${latestEvent.modernEntity.name} (${latestEvent.modernEntity.entityTypeDisplayName})
${latestEvent.modernEntity.attributes}
For more information about using predefined templates, see Form Variable Names and Base Names.

Info Class Fields

The fields mentioned here helps to form the variable that you can use in a template. For more information about info class, see Info Class Fields.
  • The ModernEntityInfo class is used for Kubernetes entities.
  • The EntityInfo class includes the isLegacyEntity field, which provides the information if the entity is legacy (such as, application, tiers, and nodes) or modern (Kubernetes entities).
  • The attributes field within the ModernEntityInfo class is to determine the details in a hierarchical way.
  • The long id is applicable only for EntityInfo class and not applicable to ModernEntity.
CODE
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;
}