Documentation
¶
Index ¶
- Constants
- func AddAptSource(sourceType, repoURL, suite string, components []string) error
- func ArchAlias(arch string) string
- func Base64decode(s string) (string, error)
- func CharsetConverts(charset string, data []byte, c Charset) (string, error)
- func CheckUrl(val string) bool
- func ContainsUppercase(s string) bool
- func CopyEmbed(assets http.FileSystem, embeddedDir, dst string) error
- func CreateDir(path string) error
- func DeleteFile(path string) error
- func ExtractIP(host string) ([]string, error)
- func ExtractIPAddress(addr string) string
- func FileMD5(path string) (string, error)
- func FormatBoolToInt(b bool) int
- func FormatBytes(bytes int64) string
- func GbkToUtf8(data []byte) ([]byte, error)
- func GenerateEncryptedPassword(length int) (string, string, error)
- func GenerateNumberWithProbability(p float64) int
- func GeneratePassword(length int) (string, error)
- func GetArgs(argsMap map[string]string, args []string) ([]string, map[string]string)
- func GetBufIOReaderOfTerminalInput() (*bufio.Reader, error)
- func GetDiskSpace(path string) (total uint64, free uint64, err error)
- func GetDrives() []string
- func GetHttpStatus(url string) (int, error)
- func GetMyExternalIPAddr() string
- func Home() (string, error)
- func Indent(n int, text string) string
- func InitConfig(kubeConfig *rest.Config, namespace string) (*action.Configuration, *cli.EnvSettings, error)
- func InstallCharts(ctx context.Context, actionConfig *action.Configuration, ...) error
- func IsExist(path string) bool
- func IsSymLink(path string) (bool, error)
- func IsValidDomain(domain string) bool
- func IsValidIP(ip string) bool
- func KubeVersionAlias(version string) (string, string)
- func LocalMd5Sum(src string) string
- func MD5(str string) string
- func Mkdir(dirName string) error
- func ParseInt(s string) int
- func ParseOlaresVersionString(versionString string) (*semver.Version, error)
- func Random() int
- func ReleaseName(appname, owner string) string
- func RemoteIp(req *http.Request) string
- func RemoveAnsiCodes(input string) string
- func Render(tmpl *template.Template, variables map[string]interface{}) (string, error)
- func ResetTmpDir(runtime connector.Runtime) error
- func RollbackCharts(cfg *action.Configuration, releaseName string) error
- func Round(val float64, precision int) float64
- func ToYAML(v interface{}) string
- func UninstallCharts(cfg *action.Configuration, releaseName string) error
- func UpgradeCharts(ctx context.Context, actionConfig *action.Configuration, ...) error
- func Utf16ToUtf8(data []byte) string
- func ValidateUserName(username string) error
- func WorkDir() (string, error)
- type AptSource
- type Charset
- type CommandExecute
- type CommandExecutor
- type Config
- type Data
- type DefaultCommandExecutor
- type GB18030
- type GPU
- type ISO8859
- type NvidiaGpuInfo
- type PowerShellCommandExecutor
- type Windows1252
Constants ¶
const ( CharsetWindows1252 = "windows-1252" CharsetISO88591 = "ISO-8859-1" CharsetGB18030 = "GB-18030" )
const ( XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-IP" XClientIP = "x-client-ip" )
Variables ¶
This section is empty.
Functions ¶
func AddAptSource ¶
AddAptSource adds apt source or components to existing apt sources It reads /etc/apt/sources.list and any *.list files under /etc/apt/sources.list.d If a matching source exists, it merges the new components with existing ones If no matching source exists, it adds a new source line to /etc/apt/sources.list
func Base64decode ¶
func ContainsUppercase ¶
func DeleteFile ¶
func ExtractIPAddress ¶
func FormatBoolToInt ¶
func FormatBytes ¶
func GeneratePassword ¶
func GetHttpStatus ¶
func GetMyExternalIPAddr ¶
func GetMyExternalIPAddr() string
GetMyExternalIPAddr get my network outgoing ip address
func InitConfig ¶
func InitConfig(kubeConfig *rest.Config, namespace string) (*action.Configuration, *cli.EnvSettings, error)
InitConfig initializes the configuration for executing actions.
func InstallCharts ¶
func InstallCharts(ctx context.Context, actionConfig *action.Configuration, settings *cli.EnvSettings, appName, chartsName, repoURL, namespace string, vals map[string]interface{}) error
InstallCharts installs helm chart using action config and environment settings.
func IsValidDomain ¶
func KubeVersionAlias ¶
func LocalMd5Sum ¶
func ReleaseName ¶
ReleaseName returns application release name.
func RemoveAnsiCodes ¶
func ResetTmpDir ¶
func RollbackCharts ¶
func RollbackCharts(cfg *action.Configuration, releaseName string) error
RollbackCharts rollback helm chart using action config.
func Round ¶
Round returns the result of rounding 'val' according to the specified 'precision' precision (the number of digits after the decimal point)。 and precision can be negative number or zero
func UninstallCharts ¶
func UninstallCharts(cfg *action.Configuration, releaseName string) error
UninstallCharts upgrades helm chart using action config.
func UpgradeCharts ¶
func UpgradeCharts(ctx context.Context, actionConfig *action.Configuration, settings *cli.EnvSettings, appName, chartName, repoURL, namespace string, vals map[string]interface{}, reuseValue bool) error
UpgradeCharts upgrades helm chart using action config and environment settings.
func Utf16ToUtf8 ¶
func ValidateUserName ¶
Types ¶
type AptSource ¶
type AptSource struct { Type string // deb or deb-src Options []string // options in square brackets (e.g., [arch=amd64,trusted=yes]) URL string // repository URL Suite string // distribution suite (e.g., trixie, bullseye) Components []string // components (e.g., main, contrib, non-free) }
AptSource represents an apt source entry
type CommandExecute ¶
type CommandExecutor ¶
type CommandExecutor struct {
// contains filtered or unexported fields
}
func NewCommandExecutor ¶
func NewCommandExecutor(name, prefix string, args []string, printOutput, printLine bool) *CommandExecutor
type Config ¶
type Config struct { ActionCfg *action.Configuration Settings *cli.EnvSettings }
Config helm client config.
type DefaultCommandExecutor ¶
func (*DefaultCommandExecutor) Exec ¶
func (d *DefaultCommandExecutor) Exec() (string, error)
func (*DefaultCommandExecutor) Run ¶
func (d *DefaultCommandExecutor) Run() (string, error)
type GPU ¶
type GPU struct { ID string `xml:"id,attr" json:"id"` ProductName string `xml:"product_name" json:"product_name"` ProductBrand string `xml:"product_brand" json:"product_brand"` ProductArchitecture string `xml:"product_architecture" json:"product_architecture"` DisplayMode string `xml:"display_mode" json:"display_mode"` DisplayActive string `xml:"display_active" json:"display_active"` // PersistenceMode string `xml:"persistence_mode" json:"persistence_mode"` // mig_mode // mig_devices // AccountingMode string `xml:"accounting_mode" json:"accounting_mode"` // AccountingModeBufferSize string `xml:"accounting_mode_buffer_size" json:"accounting_mode_buffer_size"` // CurrentDm string `xml:"driver_model>current_dm" json:"current_dm"` // PendingDm string `xml:"driver_model>pending_dm" json:"pending_dm"` // Serial string `xml:"serial" json:"serial"` UUID string `xml:"uuid" json:"uuid"` // MinorNumber string `xml:"minor_number" json:"minor_number"` VbiosVersion string `xml:"vbios_version" json:"vbios_version"` MultigpuBoard string `xml:"multigpu_board" json:"multigpu_board"` BoardID string `xml:"board_id" json:"board_id"` // gpu_part_number // gpu_module_id // ImgVersion string `xml:"inforom_version>img_version" json:"img_version"` // OemObject string `xml:"inforom_version>oem_object" json:"oem_object"` // EccObject string `xml:"inforom_version>ecc_object" json:"ecc_object"` // PwrObject string `xml:"inforom_version>pwr_object" json:"pwr_object"` // CurrentGom string `xml:"gpu_operation_mode>current_gom" json:"current_gom"` // PendingGom string `xml:"gpu_operation_mode>pending_gom" json:"pending_gom"` // gsp_firmware_version // gpu_virtualization_mode // ibmnpu PciBus string `xml:"pci>pci_bus" json:"pci_bus"` PciDevice string `xml:"pci>pci_device" json:"pci_device"` PciDomain string `xml:"pci>pci_domain" json:"pci_domain"` PciDeviceID string `xml:"pci>pci_device_id" json:"pci_device_id"` PciBusID string `xml:"pci>pci_bus_id" json:"pci_bus_id"` PciSubSystemID string `xml:"pci>pci_sub_system_id" json:"pci_sub_system_id"` MaxLinkGen string `xml:"pci>pci_gpu_link_info>pcie_gen>max_link_gen" json:"max_link_gen"` CurrentLinkGen string `xml:"pci>pci_gpu_link_info>pcie_gen>current_link_gen" json:"current_link_gen"` MaxLinkWidth string `xml:"pci>pci_gpu_link_info>link_widths>max_link_width" json:"max_link_width"` CurrentLinkWidth string `xml:"pci>pci_gpu_link_info>link_widths>current_link_width" json:"current_link_width"` // BridgeChipType string `xml:"pci>pci_bridge_chip>bridge_chip_type" json:"bridge_chip_type"` // BridgeChipFw string `xml:"pci>pci_bridge_chip>bridge_chip_fw" json:"bridge_chip_fw"` // ReplayCounter string `xml:"pci>replay_counter" json:"replay_counter"` // replay_rollover_counter PciTxUtil string `xml:"pci>tx_util" json:"pci_tx_util"` PciRxUtil string `xml:"pci>rx_util" json:"pci_rx_util"` FanSpeed string `xml:"fan_speed" json:"fan_speed"` PerformanceState string `xml:"performance_state" json:"performance_state"` ClocksThrottleReasonGpuIdle string `xml:"clocks_throttle_reasons>clocks_throttle_reason_gpu_idle" json:"clocks_throttle_reason_gpu_idle"` ClocksThrottleReasonApplicationsClocksSetting string `` /* 138-byte string literal not displayed */ ClocksThrottleReasonSwPowerCap string `xml:"clocks_throttle_reasons>clocks_throttle_reason_sw_power_cap" json:"clocks_throttle_reason_sw_power_cap"` ClocksThrottleReasonHwSlowdown string `xml:"clocks_throttle_reasons>clocks_throttle_reason_hw_slowdown" json:"clocks_throttle_reason_hw_slowdown"` ClocksThrottleReasonHwThermalSlowdown string `xml:"clocks_throttle_reasons>clocks_throttle_reason_hw_thermal_slowdown" json:"clocks_throttle_reason_hw_thermal_slowdown"` ClocksThrottleReasonHwPowerBrakeSlowdown string `` /* 130-byte string literal not displayed */ ClocksThrottleReasonSyncBoost string `xml:"clocks_throttle_reasons>clocks_throttle_reason_sync_boost" json:"clocks_throttle_reason_sync_boost"` ClocksThrottleReasonSwThermalSlowdown string `xml:"clocks_throttle_reasons>clocks_throttle_reason_sw_thermal_slowdown" json:"clocks_throttle_reason_sw_thermal_slowdown"` ClocksThrottleReasonDisplayClocksSetting string `` /* 128-byte string literal not displayed */ // ClocksThrottleReasonUnknown string `xml:"clocks_throttle_reasons>clocks_throttle_reason_unknown" json:"clocks_throttle_reason_unknown"` FbMemoryUsageTotal string `xml:"fb_memory_usage>total" json:"fb_memory_usage_total"` FbMemoryUsageReserved string `xml:"fb_memory_usage>reserved" json:"fb_memory_usage_reserved"` FbMemoryUsageUsed string `xml:"fb_memory_usage>used" json:"fb_memory_usage_used"` FbMemoryUsageFree string `xml:"fb_memory_usage>free" json:"fb_memory_usage_free"` Bar1Total string `xml:"bar1_memory_usage>total" json:"bar1_total"` Bar1Used string `xml:"bar1_memory_usage>used" json:"bar1_used"` Bar1Free string `xml:"bar1_memory_usage>free" json:"bar1_free"` ComputeMode string `xml:"compute_mode" json:"compute_mode"` GpuUtil string `xml:"utilization>gpu_util" json:"gpu_util"` MemoryUtil string `xml:"utilization>memory_util" json:"memory_util"` EncoderUtil string `xml:"utilization>encoder_util" json:"encoder_util"` DecoderUtil string `xml:"utilization>decoder_util" json:"decoder_util"` // encoder_stats // fbc_stats // CurrentEcc string `xml:"ecc_mode>current_ecc" json:"current_ecc"` // PendingEcc string `xml:"ecc_mode>pending_ecc" json:"pending_ecc"` // DeviceMemory string `xml:"ecc_errors>volatile>single_bit>device_memory" json:"device_memory"` // L1Cache string `xml:"ecc_errors>volatile>single_bit>l1_cache" json:"l_1_cache"` // TotalSingleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>single_bit>total" json:"total_single_bit_volatile_ecc_errors_gpu"` // TextureMemory string `xml:"ecc_errors>volatile>single_bit>texture_memory" json:"texture_memory"` // RegisterFile string `xml:"ecc_errors>volatile>single_bit>register_file" json:"register_file"` // L2Cache string `xml:"ecc_errors>volatile>single_bit>l2_cache" json:"l_2_cache"` // TextureMemoryDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>texture_memory" json:"texture_memory_double_bit_volatile_ecc_errors_gpu"` // DeviceMemoryDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>device_memory" json:"device_memory_double_bit_volatile_ecc_errors_gpu"` // RegisterFileDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>register_file" json:"register_file_double_bit_volatile_ecc_errors_gpu"` // TotalDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>total" json:"total_double_bit_volatile_ecc_errors_gpu"` // L2CacheDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>l2_cache" json:"l_2_cache_double_bit_volatile_ecc_errors_gpu"` // L1CacheDoubleBitVolatileEccErrorsGpu string `xml:"ecc_errors>volatile>double_bit>l1_cache" json:"l_1_cache_double_bit_volatile_ecc_errors_gpu"` // L2CacheSingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>l2_cache" json:"l_2_cache_single_bit_aggregate_ecc_errors_gpu"` // L1CacheSingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>l1_cache" json:"l_1_cache_single_bit_aggregate_ecc_errors_gpu"` // TextureMemorySingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>texture_memory" json:"texture_memory_single_bit_aggregate_ecc_errors_gpu"` // RegisterFileSingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>register_file" json:"register_file_single_bit_aggregate_ecc_errors_gpu"` // DeviceMemorySingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>device_memory" json:"device_memory_single_bit_aggregate_ecc_errors_gpu"` // TotalSingleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>single_bit>total" json:"total_single_bit_aggregate_ecc_errors_gpu"` // DeviceMemoryDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>device_memory" json:"device_memory_double_bit_aggregate_ecc_errors_gpu"` // TotalDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>total" json:"total_double_bit_aggregate_ecc_errors_gpu"` // RegisterFileDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>register_file" json:"register_file_double_bit_aggregate_ecc_errors_gpu"` // L2CacheDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>l2_cache" json:"l_2_cache_double_bit_aggregate_ecc_errors_gpu"` // L1CacheDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>l1_cache" json:"l_1_cache_double_bit_aggregate_ecc_errors_gpu"` // TextureMemoryDoubleBitAggregateEccErrorsGpu string `xml:"ecc_errors>aggregate>double_bit>texture_memory" json:"texture_memory_double_bit_aggregate_ecc_errors_gpu"` // RetiredCount string `xml:"retired_pages>multiple_single_bit_retirement>retired_count" json:"retired_count"` // RetiredPagelist string `xml:"retired_pages>multiple_single_bit_retirement>retired_pagelist" json:"retired_pagelist"` // RetiredCountDoubleBitRetirementRetiredPagesGpu string `xml:"retired_pages>double_bit_retirement>retired_count" json:"retired_count_double_bit_retirement_retired_pages_gpu"` // RetiredPagelistDoubleBitRetirementRetiredPagesGpu string `xml:"retired_pages>double_bit_retirement>retired_pagelist" json:"retired_pagelist_double_bit_retirement_retired_pages_gpu"` // pending_blacklist // PendingRetirement string `xml:"retired_pages>pending_retirement" json:"pending_retirement"` // remapped_rows GpuTemp string `xml:"temperature>gpu_temp" json:"gpu_temp"` GpuTempMaxThreshold string `xml:"temperature>gpu_temp_max_threshold" json:"gpu_temp_max_threshold"` GpuTempSlowThreshold string `xml:"temperature>gpu_temp_slow_threshold" json:"gpu_temp_slow_threshold"` GpuTempMaxGpuThreshold string `xml:"temperature>gpu_temp_max_gpu_threshold" json:"gpu_temp_max_gpu_threshold"` GpuTargetTemp string `xml:"temperature>gpu_target_temperature" json:"gpu_target_temperature"` MemoryTemp string `xml:"temperature>memory_temp" json:"memory_temp"` GpuTempMaxMemThreshold string `xml:"temperature>gpu_temp_max_mem_threshold" json:"gpu_temp_max_mem_threshold"` GpuTargetTempMin string `xml:"supported_gpu_target_temp>gpu_target_temp_min" json:"gpu_target_temp_min"` GpuTargetTempMax string `xml:"supported_gpu_target_temp>gpu_target_temp_max" json:"gpu_target_temp_max"` PowerState string `xml:"gpu_power_readings>power_state" json:"power_state"` PowerManagement string `xml:"gpu_power_readings>power_management" json:"power_management"` PowerDraw string `xml:"gpu_power_readings>power_draw" json:"power_draw"` PowerLimit string `xml:"gpu_power_readings>current_power_limit" json:"power_limit"` DefaultPowerLimit string `xml:"gpu_power_readings>default_power_limit" json:"default_power_limit"` EnforcedPowerLimit string `xml:"gpu_power_readings>requested_power_limit" json:"enforced_power_limit"` MinPowerLimit string `xml:"gpu_power_readings>min_power_limit" json:"min_power_limit"` MaxPowerLimit string `xml:"gpu_power_readings>max_power_limit" json:"max_power_limit"` GraphicsClock string `xml:"clocks>graphics_clock" json:"graphics_clock"` SmClock string `xml:"clocks>sm_clock" json:"sm_clock"` MemClock string `xml:"clocks>mem_clock" json:"mem_clock"` VideoClock string `xml:"clocks>video_clock" json:"video_clock"` // GraphicsClockApplicationsClocksGpu string `xml:"applications_clocks>graphics_clock" json:"graphics_clock_applications_clocks_gpu"` // MemClockApplicationsClocksGpu string `xml:"applications_clocks>mem_clock" json:"mem_clock_applications_clocks_gpu"` // GraphicsClockDefaultApplicationsClocksGpu string `xml:"default_applications_clocks>graphics_clock" json:"graphics_clock_default_applications_clocks_gpu"` // MemClockDefaultApplicationsClocksGpu string `xml:"default_applications_clocks>mem_clock" json:"mem_clock_default_applications_clocks_gpu"` GraphicsClockMax string `xml:"max_clocks>graphics_clock" json:"graphics_clock_max"` SmClockMax string `xml:"max_clocks>sm_clock" json:"sm_clock_max"` MemClockMax string `xml:"max_clocks>mem_clock" json:"mem_clock_max"` VideoClockMax string `xml:"max_clocks>video_clock" json:"video_clock_max"` }
type NvidiaGpuInfo ¶
type NvidiaGpuInfo struct { Timestamp string `xml:"timestamp" json:"timestamp"` DriverVersion string `xml:"driver_version" json:"driver_version"` CudaVersion string `xml:"cuda_version" json:"cuda_version"` AttachedGpus string `xml:"attached_gpus" json:"attached_gpus"` GPUS []GPU `xml:"gpu" json:"gpus"` }
func ExecNvidiaSmi ¶
func ExecNvidiaSmi(execRuntime connector.Runtime) (gpuInfo *NvidiaGpuInfo, installed bool, err error)
type PowerShellCommandExecutor ¶
func (*PowerShellCommandExecutor) Run ¶
func (p *PowerShellCommandExecutor) Run() (string, error)
type Windows1252 ¶
type Windows1252 struct {
// contains filtered or unexported fields
}
func (*Windows1252) Gb2312 ¶
func (c *Windows1252) Gb2312() (string, error)
func (*Windows1252) Utf8 ¶
func (c *Windows1252) Utf8() (string, error)