Documentation ¶
Index ¶
- Constants
- func DeleteLogObject(logBase *LogObject, key string)
- func GetAppKubeName(displayName string, uuid uuid.UUID) string
- func GetReplicaPodName(displayName, podName string, uuid uuid.UUID) (kubeName string, isReplicaPod bool)
- func GetVMINameFromVirtLauncher(podName string) (vmiName string, isVirtLauncher bool)
- func InitLogObject(logBase *LogObject, object *LogObject, objType LogObjectType, objName string, ...)
- func IsHVTypeKube() bool
- func TouchFile(log *LogObject, filename string)
- type Command
- type LockedStringMap
- type LogEventType
- type LogObject
- func EnsureLogObject(logBase *LogObject, objType LogObjectType, objName string, objUUID uuid.UUID, ...) *LogObject
- func LookupLogObject(mapKey string) *LogObject
- func NewLogObject(logBase *LogObject, objType LogObjectType, objName string, objUUID uuid.UUID, ...) *LogObject
- func NewRelationObject(logBase *LogObject, relationObjectType RelationObjectType, ...) *LogObject
- func NewSourceLogObject(logger *logrus.Logger, agentName string, agentPid int) *LogObject
- func (object *LogObject) AddCompositeField(key string, value interface{}) (*LogObject, error)
- func (object *LogObject) AddField(key string, value interface{}) *LogObject
- func (object *LogObject) AddFields(fields map[string]interface{}) *LogObject
- func (object *LogObject) Clone() *LogObject
- func (object *LogObject) CloneAndAddCompositeField(key string, value interface{}) *LogObject
- func (object *LogObject) CloneAndAddField(key string, value interface{}) *LogObject
- func (object *LogObject) CloneAndAddFields(fields map[string]interface{}) *LogObject
- func (object *LogObject) CloneAndMerge(source *LogObject) *LogObject
- func (object *LogObject) Error(args ...interface{})
- func (object *LogObject) Errorf(format string, args ...interface{})
- func (object *LogObject) Errorln(args ...interface{})
- func (object *LogObject) Fatal(args ...interface{})
- func (object *LogObject) Fatalf(format string, args ...interface{})
- func (object *LogObject) Fatalln(args ...interface{})
- func (object *LogObject) Function(args ...interface{})
- func (object *LogObject) Functionf(format string, args ...interface{})
- func (object *LogObject) Functionln(args ...interface{})
- func (object *LogObject) Merge(source *LogObject) *LogObject
- func (object *LogObject) Metric(args ...interface{})
- func (object *LogObject) Metricf(format string, args ...interface{})
- func (object *LogObject) Metricln(args ...interface{})
- func (object *LogObject) Notice(args ...interface{})
- func (object *LogObject) Noticef(format string, args ...interface{})
- func (object *LogObject) Noticeln(args ...interface{})
- func (object *LogObject) Panic(args ...interface{})
- func (object *LogObject) Panicf(format string, args ...interface{})
- func (object *LogObject) Panicln(args ...interface{})
- func (object *LogObject) Trace(args ...interface{})
- func (object *LogObject) Tracef(format string, args ...interface{})
- func (object *LogObject) Traceln(args ...interface{})
- func (object *LogObject) Warn(args ...interface{})
- func (object *LogObject) Warnf(format string, args ...interface{})
- func (object *LogObject) Warning(args ...interface{})
- func (object *LogObject) Warningf(format string, args ...interface{})
- func (object *LogObject) Warningln(args ...interface{})
- func (object *LogObject) Warnln(args ...interface{})
- type LogObjectType
- type LoggableObject
- type LogrusWrapper
- func (w *LogrusWrapper) Debugf(format string, args ...interface{})
- func (w *LogrusWrapper) Errorf(format string, args ...interface{})
- func (w *LogrusWrapper) Fatalf(format string, args ...interface{})
- func (w *LogrusWrapper) Infof(format string, args ...interface{})
- func (w *LogrusWrapper) Panicf(format string, args ...interface{})
- func (w *LogrusWrapper) Tracef(format string, args ...interface{})
- func (w *LogrusWrapper) Warningf(format string, args ...interface{})
- type RelationObjectType
- type StrMapFunc
Constants ¶
const ( // EveVirtTypeFile contains the virtualization type, ie kvm, xen or kubevirt EveVirtTypeFile = "/run/eve-hv-type" // KubeAppNameMaxLen limits the length of the app name for Kubernetes. // This also includes the appended UUID prefix. KubeAppNameMaxLen = 32 // KubeAppNameUUIDSuffixLen : number of characters taken from the app UUID and appended // to the app name for Kubernetes (to avoid name collisions between apps of the same // DisplayName, see GetAppKubeName). KubeAppNameUUIDSuffixLen = 5 // VMIPodNamePrefix : prefix added to name of every pod created to run VM. VMIPodNamePrefix = "virt-launcher-" // InstallOptionEtcdSizeGB grub option at install time. Size of etcd volume in GB. InstallOptionEtcdSizeGB = "eve_install_kubevirt_etcd_sizeGB" // DefaultEtcdSizeGB default for InstallOptionEtcdSizeGB DefaultEtcdSizeGB uint32 = 10 // EtcdVolBlockSizeBytes is the block size for the etcd volume EtcdVolBlockSizeBytes = uint64(4 * 1024) )
const ( // WatchdogFileDir is the dir to add .touch files for watchdog to monitor WatchdogFileDir = "/run/watchdog/file" // WatchdogPidDir is the dir to add .pid files for watchdog to monitor WatchdogPidDir = "/run/watchdog/pid" )
Variables ¶
This section is empty.
Functions ¶
func DeleteLogObject ¶
DeleteLogObject : Delete log object from internal map logBase must be the same object as for calls to EnsureLogObject and NewLogObject
func GetAppKubeName ¶
GetAppKubeName returns name of the application used inside Kubernetes (for Pod or VMI).
func GetReplicaPodName ¶
func GetReplicaPodName(displayName, podName string, uuid uuid.UUID) (kubeName string, isReplicaPod bool)
GetReplicaPodName : get the app name from the pod name for replica pods.
func GetVMINameFromVirtLauncher ¶
GetVMINameFromVirtLauncher : get VMI name from the corresponding Kubevirt launcher pod name for replicaset generated VMI.
func InitLogObject ¶
func InitLogObject(logBase *LogObject, object *LogObject, objType LogObjectType, objName string, objUUID uuid.UUID, key string)
InitLogObject : Initialize an already allocated LogObject
func IsHVTypeKube ¶
func IsHVTypeKube() bool
IsHVTypeKube - return true if the EVE image is kube cluster type.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command holds the necessary data to execute command
func (*Command) CombinedOutput ¶
CombinedOutput runs the command and returns its combined standard output and standard error. Waits for the exec call to finish for `defaultTimeout` after which timeout error is returned
func (*Command) Output ¶
Output runs the command and returns its standard output. Any returned error will usually be of type *ExitError. Waits for the exec call to finish for `defaultTimeout` after which timeout error is returned
func (*Command) WithContext ¶
WithContext set context for command
func (*Command) WithLimitedTimeout ¶
WithLimitedTimeout set custom timeout for command
type LockedStringMap ¶
func NewLockedStringMap ¶
func NewLockedStringMap() *LockedStringMap
func (*LockedStringMap) Delete ¶
func (sm *LockedStringMap) Delete(key string)
func (*LockedStringMap) Load ¶
func (sm *LockedStringMap) Load(key string) (value interface{}, ok bool)
func (*LockedStringMap) Range ¶
func (sm *LockedStringMap) Range(callback StrMapFunc)
func (*LockedStringMap) Store ¶
func (sm *LockedStringMap) Store(key string, value interface{})
type LogEventType ¶
type LogEventType string
LogEventType : Predefined object types
const ( // UnknownType : Invalid event typ UnknownType LogEventType = "" // LogObjectEventType : Used for logging object state when a change happens LogObjectEventType LogEventType = "log" // LogRelationEventType : Used for logging the relations between created objects LogRelationEventType LogEventType = "relation" )
type LogObject ¶
type LogObject struct { Initialized bool Fields map[string]interface{} // contains filtered or unexported fields }
LogObject : Holds all key value pairs to be logged later.
func EnsureLogObject ¶
func EnsureLogObject(logBase *LogObject, objType LogObjectType, objName string, objUUID uuid.UUID, key string) *LogObject
EnsureLogObject : Look for log object with given key or create new if we do not already have one.
func NewLogObject ¶
func NewLogObject(logBase *LogObject, objType LogObjectType, objName string, objUUID uuid.UUID, key string) *LogObject
NewLogObject : objType -> [MANDATORY] volume configuration, app configuration, app status, image etc objName -> App instance name, name of file being downloaded etc objUUID -> UUID of the object if present (App instance UUID) or Zero/uninitialized UUID if not present key -> [MANDATORY] Key used for storing internal data. This should be the same Key that your LoggableObject.Key() would return. LogObject created here and the corresponding LoggableObject are linked using this key.
func NewRelationObject ¶
func NewRelationObject(logBase *LogObject, relationObjectType RelationObjectType, fromObjType LogObjectType, fromObjNameOrKey string, toObjType LogObjectType, toObjNameOrKey string) *LogObject
NewRelationObject : Creates a relation object. Supposed to be ephemeral and not retained for long. Create a new object every time a new relation needs to be expressed. relationObjectType -> add a relation or delete an existing relation fromObjType -> Type of the source point of relation fromObjName -> Name of the source point of relation toObjType -> Type of the destination point of relation toObjName -> Name of the destination point of relation
func NewSourceLogObject ¶
NewSourceLogObject : create an object with agentName and agentPid Since there might be multiple calls to this for the same agent we check for an existing one for the agentName
func (*LogObject) AddCompositeField ¶
AddCompositeField : Add a structure/map to be logged
func (*LogObject) AddFields ¶
AddFields : Values of exiting keys in the object will be overwritten with new values passed
func (*LogObject) CloneAndAddCompositeField ¶
CloneAndAddCompositeField : Add composite structure to a cloned log object
func (*LogObject) CloneAndAddField ¶
CloneAndAddField : Add key value pair to a cloned log object
func (*LogObject) CloneAndAddFields ¶
CloneAndAddFields : Add additional fields to a cloned log object
func (*LogObject) CloneAndMerge ¶
CloneAndMerge : Merge source into a cloned log object
func (*LogObject) Functionln ¶
func (object *LogObject) Functionln(args ...interface{})
Functionln :
func (*LogObject) Merge ¶
Merge : Values of existing fields in destination object will be overwritten with values from source object.
type LogObjectType ¶
type LogObjectType string
LogObjectType :
const ( // UnknownLogType : Invalid log type UnknownLogType LogObjectType = "" // ImageLogType : ImageLogType LogObjectType = "image" // AppInstanceStatusLogType : AppInstanceStatusLogType LogObjectType = "app_instance_status" // AppInstanceConfigLogType : AppInstanceConfigLogType LogObjectType = "app_instance_config" // AppNetworkStatusLogType : AppNetworkStatusLogType LogObjectType = "app_network_status" // AppNetworkConfigLogType : AppNetworkConfigLogType LogObjectType = "app_network_config" // DatastoreConfigLogType : DatastoreConfigLogType LogObjectType = "datastore_config" // DomainConfigLogType : DomainConfigLogType LogObjectType = "domain_config" // DomainStatusLogType : DomainStatusLogType LogObjectType = "domain_status" // DomainMetricLogType : DomainMetricLogType LogObjectType = "domain_metric" // BaseOsConfigLogType : BaseOsConfigLogType LogObjectType = "baseos_config" // BaseOsStatusLogType : BaseOsStatusLogType LogObjectType = "baseos_status" // NodeAgentStatusLogType : NodeAgentStatusLogType LogObjectType = "nodeagent_status" // ZedAgentStatusLogType : ZedAgentStatusLogType LogObjectType = "zedagent_status" // ZbootConfigLogType : ZbootConfigLogType LogObjectType = "zboot_config" // ZbootStatusLogType : ZbootStatusLogType LogObjectType = "zboot_status" // DownloaderConfigLogType : DownloaderConfigLogType LogObjectType = "downloader_config" // DownloaderStatusLogType : DownloaderStatusLogType LogObjectType = "downloader_status" // ResolveConfigLogType : ResolveConfigLogType LogObjectType = "resolve_config" // ResolveStatusLogType : ResolveStatusLogType LogObjectType = "resolve_status" // VerifyImageConfigLogType : VerifyImageConfigLogType LogObjectType = "verifyimage_config" // VerifyImageStatusLogType : VerifyImageStatusLogType LogObjectType = "verifyimage_status" // ContentTreeConfigLogType : ContentTreeConfigLogType LogObjectType = "contenttree_config" // ContentTreeStatusLogType : ContentTreeStatusLogType LogObjectType = "contenttree_status" // DevicePortConfig : object being logged DevicePortConfigLogType LogObjectType = "deviceport_config" // DevicePortConfigList : DevicePortConfigListLogType LogObjectType = "deviceportconfig_list" // DeviceNetworkStatus : DeviceNetworkStatusLogType LogObjectType = "devicenetwork_status" // BlobStatusType: BlobStatusLogType LogObjectType = "blob_status" // VolumeConfigLogType: VolumeConfigLogType LogObjectType = "volume_config" // VolumeStatusLogType: VolumeStatusLogType LogObjectType = "volume_status" // VolumeRefConfigLogType: VolumeRefConfigLogType LogObjectType = "volume_ref_config" // VolumeRefStatusLogType: VolumeRefStatusLogType LogObjectType = "volume_ref_status" // VolumeCreatePendingLogType: VolumeCreatePendingLogType LogObjectType = "volume_create_pending" // VolumeMgrStatusLogType: VolumeMgrStatusLogType LogObjectType = "volumemgr_status" // ServiceInitType: ServiceInitLogType LogObjectType = "service_init" // AppAndImageToHashLogType: AppAndImageToHashLogType LogObjectType = "app_and_image_to_hash" // AppContainerMetricsLogType: AppContainerMetricsLogType LogObjectType = "app_container_metric" // AssignableAdaptersLogType: AssignableAdaptersLogType LogObjectType = "assignable_adapters" // PhysicalIOAdapterListLogType: PhysicalIOAdapterListLogType LogObjectType = "physical_io_adapter_list" // AttestNonceLogType: AttestNonceLogType LogObjectType = "attest_nonce" // AttestQuoteLogType: AttestQuoteLogType LogObjectType = "attest_quote" // VaultStatusLogType: VaultStatusLogType LogObjectType = "vault_status" // CipherBlockStatusLogType: CipherBlockStatusLogType LogObjectType = "cipher_block_status" // CipherContextLogType: CipherContextLogType LogObjectType = "cipher_context" // CipherMetricsLogType: CipherMetricsLogType LogObjectType = "cipher_metric" // ControllerCertLogType: ControllerCertLogType LogObjectType = "controller_cert" // EdgeNodeCertLogType: EdgeNodeCertLogType LogObjectType = "edge_node_cert" // HostMemoryLogType: HostMemoryLogType LogObjectType = "host_memory" // IPFlowLogType: IPFlowLogType LogObjectType = "ip_flow" // VifIPTrigLogType: VifIPTrigLogType LogObjectType = "vif_ip_trig" // OnboardingStatusLogType: OnboardingStatusLogType LogObjectType = "onboarding_status" // NetworkInstanceConfigLogType: NetworkInstanceConfigLogType LogObjectType = "network_instance_config" // NetworkInstanceStatusLogType: NetworkInstanceStatusLogType LogObjectType = "network_instance_status" // NetworkInstanceMetricsLogType: NetworkInstanceMetricsLogType LogObjectType = "network_instance_metrics" // NetworkMetricsLogType: NetworkMetricsLogType LogObjectType = "network_metrics" // WwanConfigLogType: WwanConfigLogType LogObjectType = "wwan_config" // WwanStatusLogType: WwanStatusLogType LogObjectType = "wwan_status" // WwanMetricsLogType: WwanMetricsLogType LogObjectType = "wwan_metrics" // WwanLocationInfoLogType: WwanLocationInfoLogType LogObjectType = "wwan_location_info" // NetworkXObjectConfigLogType: NetworkXObjectConfigLogType LogObjectType = "network_x_object" // UUIDToNumLogType: UUIDToNumLogType LogObjectType = "uuid_to_num" // DiskMetricType: DiskMetricType LogObjectType = "disk_metric" // AppDiskMetricType: AppDiskMetricType LogObjectType = "app_disk_metric" // ProcessMetricLogType: ProcessMetricLogType LogObjectType = "process_metric" // SigUSR1StacksType: SigUSR1StacksType LogObjectType = "sigusr1_stacks" // FatalStacksType: FatalStacksType LogObjectType = "fatal_stacks" // MemoryNotificationType MemoryNotificationType = "memory_notification" // DiskNotificationType DiskNotificationType = "disk_notification" // AppInterfaceToNumLogType AppInterfaceToNumLogType LogObjectType = "app_interface_to_num" // EncryptedVaultKeyFromDeviceLogType: EncryptedVaultKeyFromDeviceLogType LogObjectType = "encrypted_vault_key_from_device" // EncryptedVaultKeyFromControllerLogType: EncryptedVaultKeyFromControllerLogType LogObjectType = "encrypted_vault_key_from_controller" // CachedResolvedIPsLogType: CachedResolvedIPsLogType LogObjectType = "cached_resolved_ips" // AppMACGeneratorLogType : type for AppMACGenerator log entries AppMACGeneratorLogType LogObjectType = "app_mac_generator" )
The following is NOT an extensive list. Intent is to create a reference list for engineers to get an idea of its usage.
type LoggableObject ¶
type LoggableObject interface { LogKey() string LogCreate(logBase *LogObject) LogModify(logBase *LogObject, old interface{}) LogDelete(logBase *LogObject) }
LoggableObject :
type LogrusWrapper ¶
type LogrusWrapper struct {
Log *LogObject
}
LogrusWrapper wraps LogObject to implement the same interface as the widely used Sirupsen/Logrus (see https://github.com/sirupsen/logrus) This may allow to use LogObject in libraries outside of pillar. However, only methods with formatted output are wrapped for now.
func (*LogrusWrapper) Debugf ¶
func (w *LogrusWrapper) Debugf(format string, args ...interface{})
Debugf : formatted log message with info useful for debugging.
func (*LogrusWrapper) Errorf ¶
func (w *LogrusWrapper) Errorf(format string, args ...interface{})
Errorf : formatted log message with an error.
func (*LogrusWrapper) Fatalf ¶
func (w *LogrusWrapper) Fatalf(format string, args ...interface{})
Fatalf : formatted log message with an error, ending with a call to os.Exit() with a non-zero return value.
func (*LogrusWrapper) Infof ¶
func (w *LogrusWrapper) Infof(format string, args ...interface{})
Infof : formatted log message with a general info about what's going on inside the application.
func (*LogrusWrapper) Panicf ¶
func (w *LogrusWrapper) Panicf(format string, args ...interface{})
Panicf : formatted log message with an error, raising a panic.
func (*LogrusWrapper) Tracef ¶
func (w *LogrusWrapper) Tracef(format string, args ...interface{})
Tracef : formatted log message with info useful for finer-grained debugging.
func (*LogrusWrapper) Warningf ¶
func (w *LogrusWrapper) Warningf(format string, args ...interface{})
Warningf : formatted log message with a warning.
type RelationObjectType ¶
type RelationObjectType string
RelationObjectType :
const ( // UnknownRelationType : Invalid relation type UnknownRelationType RelationObjectType = "" // AddRelationType : AddRelationType RelationObjectType = "add_relation" // DeleteRelationType : DeleteRelationType RelationObjectType = "delete_relation" )