Documentation ¶
Index ¶
Constants ¶
View Source
const ( Name = "profile" Usage = "Collects fat image information and generates a fat container report" Alias = "p" )
Variables ¶
View Source
var CLI = &cli.Command{ Name: Name, Aliases: []string{Alias}, Usage: Usage, Flags: append([]cli.Flag{ command.Cflag(command.FlagTarget), command.Cflag(command.FlagPull), command.Cflag(command.FlagDockerConfigPath), command.Cflag(command.FlagRegistryAccount), command.Cflag(command.FlagRegistrySecret), command.Cflag(command.FlagShowPullLogs), command.Cflag(command.FlagComposeFile), command.Cflag(command.FlagTargetComposeSvc), command.Cflag(command.FlagComposeSvcStartWait), command.Cflag(command.FlagTargetComposeSvcImage), command.Cflag(command.FlagComposeSvcNoPorts), command.Cflag(command.FlagDepExcludeComposeSvcAll), command.Cflag(command.FlagDepIncludeComposeSvc), command.Cflag(command.FlagDepExcludeComposeSvc), command.Cflag(command.FlagDepIncludeComposeSvcDeps), command.Cflag(command.FlagDepIncludeTargetComposeSvcDeps), command.Cflag(command.FlagComposeNet), command.Cflag(command.FlagComposeEnvNoHost), command.Cflag(command.FlagComposeEnvFile), command.Cflag(command.FlagComposeProjectName), command.Cflag(command.FlagComposeWorkdir), command.Cflag(command.FlagPublishPort), command.Cflag(command.FlagPublishExposedPorts), command.Cflag(command.FlagHostExec), command.Cflag(command.FlagHostExecFile), command.Cflag(command.FlagRunTargetAsUser), command.Cflag(command.FlagShowContainerLogs), command.Cflag(command.FlagEnableMondelLogs), command.Cflag(command.FlagCopyMetaArtifacts), command.Cflag(command.FlagRemoveFileArtifacts), command.Cflag(command.FlagExec), command.Cflag(command.FlagExecFile), command.Cflag(command.FlagCRORuntime), command.Cflag(command.FlagCROHostConfigFile), command.Cflag(command.FlagCROSysctl), command.Cflag(command.FlagCROShmSize), command.Cflag(command.FlagUser), command.Cflag(command.FlagEntrypoint), command.Cflag(command.FlagCmd), command.Cflag(command.FlagWorkdir), command.Cflag(command.FlagEnv), command.Cflag(command.FlagEnvFile), command.Cflag(command.FlagLabel), command.Cflag(command.FlagVolume), command.Cflag(command.FlagLink), command.Cflag(command.FlagEtcHostsMap), command.Cflag(command.FlagContainerDNS), command.Cflag(command.FlagContainerDNSSearch), command.Cflag(command.FlagNetwork), command.Cflag(command.FlagHostname), command.Cflag(command.FlagExpose), command.Cflag(command.FlagMount), command.Cflag(command.FlagContinueAfter), command.Cflag(command.FlagUseLocalMounts), command.Cflag(command.FlagUseSensorVolume), command.Cflag(command.FlagSensorIPCEndpoint), command.Cflag(command.FlagSensorIPCMode), }, command.HTTPProbeFlags()...), Action: func(ctx *cli.Context) error { gcvalues := command.GlobalFlagValues(ctx) xc := app.NewExecutionContext( Name, gcvalues.QuietCLIMode, gcvalues.OutputFormat) targetRef := ctx.String(command.FlagTarget) if targetRef == "" { if ctx.Args().Len() < 1 { xc.Out.Error("param.target", "missing target image ID/name") cli.ShowCommandHelp(ctx, Name) return nil } else { targetRef = ctx.Args().First() } } crOpts, err := command.GetContainerRunOptions(ctx) if err != nil { xc.Out.Error("param.error.container.run.options", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } doPull := ctx.Bool(command.FlagPull) dockerConfigPath := ctx.String(command.FlagDockerConfigPath) registryAccount := ctx.String(command.FlagRegistryAccount) registrySecret := ctx.String(command.FlagRegistrySecret) doShowPullLogs := ctx.Bool(command.FlagShowPullLogs) doRmFileArtifacts := ctx.Bool(command.FlagRemoveFileArtifacts) doCopyMetaArtifacts := ctx.String(command.FlagCopyMetaArtifacts) portBindings, err := command.ParsePortBindings(ctx.StringSlice(command.FlagPublishPort)) if err != nil { xc.Out.Error("param.publish.port", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } doPublishExposedPorts := ctx.Bool(command.FlagPublishExposedPorts) httpProbeOpts := command.GetHTTPProbeOptions(xc, ctx, false) continueAfter, err := command.GetContinueAfter(ctx) if err != nil { xc.Out.Error("param.error.continue.after", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } if !httpProbeOpts.Do && continueAfter.Mode == "probe" { continueAfter.Mode = "enter" xc.Out.Info("enter", ovars{ "message": "changing continue-after from probe to enter because http-probe is disabled", }) } hostExecProbes := ctx.StringSlice(command.FlagHostExec) moreHostExecProbes, err := command.ParseHTTPProbeExecFile(ctx.String(command.FlagHostExecFile)) if err != nil { xc.Out.Error("param.host.exec.file", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } if len(moreHostExecProbes) > 0 { hostExecProbes = append(hostExecProbes, moreHostExecProbes...) } if strings.Contains(continueAfter.Mode, config.CAMHostExec) && len(hostExecProbes) == 0 { if continueAfter.Mode == config.CAMHostExec { continueAfter.Mode = config.CAMEnter xc.Out.Info("host-exec", ovars{ "message": "changing continue-after from host-exec to enter because there are no host-exec commands", }) } else { continueAfter.Mode = command.RemoveContinueAfterMode(continueAfter.Mode, config.CAMHostExec) xc.Out.Info("host-exec", ovars{ "message": "removing host-exec continue-after mode because there are no host-exec commands", }) } } if len(hostExecProbes) > 0 { if !strings.Contains(continueAfter.Mode, config.CAMHostExec) { if continueAfter.Mode == "" { continueAfter.Mode = config.CAMHostExec } else { continueAfter.Mode = fmt.Sprintf("%s&%s", continueAfter.Mode, config.CAMHostExec) } xc.Out.Info("exec", ovars{ "message": fmt.Sprintf("updating continue-after mode to %s", continueAfter.Mode), }) } } doRunTargetAsUser := ctx.Bool(command.FlagRunTargetAsUser) doShowContainerLogs := ctx.Bool(command.FlagShowContainerLogs) doEnableMondel := ctx.Bool(command.FlagEnableMondelLogs) overrides, err := command.GetContainerOverrides(xc, ctx) if err != nil { xc.Out.Error("param.error.container.overrides", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } volumeMounts, err := command.ParseVolumeMounts(ctx.StringSlice(command.FlagMount)) if err != nil { xc.Out.Error("param.error.mount", err.Error()) xc.Out.State("exited", ovars{ "exit.code": -1, }) xc.Exit(-1) } doUseLocalMounts := ctx.Bool(command.FlagUseLocalMounts) doUseSensorVolume := ctx.String(command.FlagUseSensorVolume) commandReport := ctx.String(command.FlagCommandReport) if commandReport == "off" { commandReport = "" } OnCommand( xc, gcvalues, targetRef, doPull, dockerConfigPath, registryAccount, registrySecret, doShowPullLogs, crOpts, httpProbeOpts, portBindings, doPublishExposedPorts, hostExecProbes, doRmFileArtifacts, doCopyMetaArtifacts, doRunTargetAsUser, doShowContainerLogs, doEnableMondel, overrides, ctx.StringSlice(command.FlagLink), ctx.StringSlice(command.FlagEtcHostsMap), ctx.StringSlice(command.FlagContainerDNS), ctx.StringSlice(command.FlagContainerDNSSearch), volumeMounts, doUseLocalMounts, doUseSensorVolume, continueAfter, ctx.String(command.FlagSensorIPCEndpoint), ctx.String(command.FlagSensorIPCMode), ctx.String(command.FlagLogLevel), ctx.String(command.FlagLogFormat)) return nil }, }
View Source
var CommandFlagSuggestions = &command.FlagSuggestions{ Names: []prompt.Suggest{ {Text: command.FullFlagName(command.FlagTarget), Description: command.FlagTargetUsage}, {Text: command.FullFlagName(command.FlagPull), Description: command.FlagPullUsage}, {Text: command.FullFlagName(command.FlagShowPullLogs), Description: command.FlagShowPullLogsUsage}, {Text: command.FullFlagName(command.FlagShowContainerLogs), Description: command.FlagShowContainerLogsUsage}, {Text: command.FullFlagName(command.FlagEnableMondelLogs), Description: command.FlagEnableMondelLogsUsage}, {Text: command.FullFlagName(command.FlagCRORuntime), Description: command.FlagCRORuntimeUsage}, {Text: command.FullFlagName(command.FlagCROHostConfigFile), Description: command.FlagCROHostConfigFileUsage}, {Text: command.FullFlagName(command.FlagCROSysctl), Description: command.FlagCROSysctlUsage}, {Text: command.FullFlagName(command.FlagCROShmSize), Description: command.FlagCROShmSizeUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeOff), Description: command.FlagHTTPProbeOffUsage}, {Text: command.FullFlagName(command.FlagHTTPProbe), Description: command.FlagHTTPProbeUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeClientTimeout), Description: command.FlagHTTPProbeClientTimeoutUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeClientTimeoutCrawl), Description: command.FlagHTTPProbeClientTimeoutCrawlUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeCmd), Description: command.FlagHTTPProbeCmdUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeCmdUpload), Description: command.FlagHTTPProbeCmdUploadUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeCmdFile), Description: command.FlagHTTPProbeCmdFileUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeStartWait), Description: command.FlagHTTPProbeStartWaitUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeRetryOff), Description: command.FlagHTTPProbeRetryOffUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeRetryCount), Description: command.FlagHTTPProbeRetryCountUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeRetryWait), Description: command.FlagHTTPProbeRetryWaitUsage}, {Text: command.FullFlagName(command.FlagHTTPProbePorts), Description: command.FlagHTTPProbePortsUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeFull), Description: command.FlagHTTPProbeFullUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeExitOnFailure), Description: command.FlagHTTPProbeExitOnFailureUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeExitOnFailureCount), Description: command.FlagHTTPProbeExitOnFailureCountUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeFailOnStatus5xx), Description: command.FlagHTTPProbeFailOnStatus5xxUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeConcurrency), Description: command.FlagHTTPProbeConcurrencyUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeCrawl), Description: command.FlagHTTPProbeCrawlUsage}, {Text: command.FullFlagName(command.FlagHTTPCrawlMaxDepth), Description: command.FlagHTTPCrawlMaxDepthUsage}, {Text: command.FullFlagName(command.FlagHTTPCrawlMaxPageCount), Description: command.FlagHTTPCrawlMaxPageCountUsage}, {Text: command.FullFlagName(command.FlagHTTPCrawlConcurrency), Description: command.FlagHTTPCrawlConcurrencyUsage}, {Text: command.FullFlagName(command.FlagHTTPMaxConcurrentCrawlers), Description: command.FlagHTTPMaxConcurrentCrawlersUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeAPISpec), Description: command.FlagHTTPProbeAPISpecUsage}, {Text: command.FullFlagName(command.FlagHTTPProbeAPISpecFile), Description: command.FlagHTTPProbeAPISpecFileUsage}, {Text: command.FullFlagName(command.FlagPublishPort), Description: command.FlagPublishPortUsage}, {Text: command.FullFlagName(command.FlagPublishExposedPorts), Description: command.FlagPublishExposedPortsUsage}, {Text: command.FullFlagName(command.FlagHostExec), Description: command.FlagHostExecUsage}, {Text: command.FullFlagName(command.FlagHostExecFile), Description: command.FlagHostExecFileUsage}, {Text: command.FullFlagName(command.FlagRunTargetAsUser), Description: command.FlagRunTargetAsUserUsage}, {Text: command.FullFlagName(command.FlagCopyMetaArtifacts), Description: command.FlagCopyMetaArtifactsUsage}, {Text: command.FullFlagName(command.FlagRemoveFileArtifacts), Description: command.FlagRemoveFileArtifactsUsage}, {Text: command.FullFlagName(command.FlagUser), Description: command.FlagUserUsage}, {Text: command.FullFlagName(command.FlagEntrypoint), Description: command.FlagEntrypointUsage}, {Text: command.FullFlagName(command.FlagCmd), Description: command.FlagCmdUsage}, {Text: command.FullFlagName(command.FlagWorkdir), Description: command.FlagWorkdirUsage}, {Text: command.FullFlagName(command.FlagEnv), Description: command.FlagEnvUsage}, {Text: command.FullFlagName(command.FlagEnvFile), Description: command.FlagEnvFileUsage}, {Text: command.FullFlagName(command.FlagLabel), Description: command.FlagLabelUsage}, {Text: command.FullFlagName(command.FlagVolume), Description: command.FlagVolumeUsage}, {Text: command.FullFlagName(command.FlagLink), Description: command.FlagLinkUsage}, {Text: command.FullFlagName(command.FlagEtcHostsMap), Description: command.FlagEtcHostsMapUsage}, {Text: command.FullFlagName(command.FlagContainerDNS), Description: command.FlagContainerDNSUsage}, {Text: command.FullFlagName(command.FlagContainerDNSSearch), Description: command.FlagContainerDNSSearchUsage}, {Text: command.FullFlagName(command.FlagNetwork), Description: command.FlagNetworkUsage}, {Text: command.FullFlagName(command.FlagHostname), Description: command.FlagHostnameUsage}, {Text: command.FullFlagName(command.FlagExpose), Description: command.FlagExposeUsage}, {Text: command.FullFlagName(command.FlagMount), Description: command.FlagMountUsage}, {Text: command.FullFlagName(command.FlagContinueAfter), Description: command.FlagContinueAfterUsage}, {Text: command.FullFlagName(command.FlagUseLocalMounts), Description: command.FlagUseLocalMountsUsage}, {Text: command.FullFlagName(command.FlagUseSensorVolume), Description: command.FlagUseSensorVolumeUsage}, {Text: command.FullFlagName(command.FlagSensorIPCMode), Description: command.FlagSensorIPCModeUsage}, {Text: command.FullFlagName(command.FlagSensorIPCEndpoint), Description: command.FlagSensorIPCEndpointUsage}, }, Values: map[string]command.CompleteValue{ command.FullFlagName(command.FlagPull): command.CompleteTBool, command.FullFlagName(command.FlagShowPullLogs): command.CompleteBool, command.FullFlagName(command.FlagTarget): command.CompleteImage, command.FullFlagName(command.FlagShowContainerLogs): command.CompleteBool, command.FullFlagName(command.FlagEnableMondelLogs): command.CompleteBool, command.FullFlagName(command.FlagPublishExposedPorts): command.CompleteBool, command.FullFlagName(command.FlagHTTPProbeOff): command.CompleteBool, command.FullFlagName(command.FlagHTTPProbe): command.CompleteTBool, command.FullFlagName(command.FlagHTTPProbeCmdFile): command.CompleteFile, command.FullFlagName(command.FlagHTTPProbeFull): command.CompleteTBool, command.FullFlagName(command.FlagHTTPProbeExitOnFailure): command.CompleteTBool, command.FullFlagName(command.FlagHTTPProbeFailOnStatus5xx): command.CompleteBool, command.FullFlagName(command.FlagHTTPProbeCrawl): command.CompleteTBool, command.FullFlagName(command.FlagHTTPProbeAPISpecFile): command.CompleteFile, command.FullFlagName(command.FlagHTTPProbeRetryOff): command.CompleteBool, command.FullFlagName(command.FlagHostExecFile): command.CompleteFile, command.FullFlagName(command.FlagRunTargetAsUser): command.CompleteTBool, command.FullFlagName(command.FlagRemoveFileArtifacts): command.CompleteBool, command.FullFlagName(command.FlagNetwork): command.CompleteNetwork, command.FullFlagName(command.FlagContinueAfter): command.CompleteContinueAfter, command.FullFlagName(command.FlagUseLocalMounts): command.CompleteBool, command.FullFlagName(command.FlagUseSensorVolume): command.CompleteVolume, command.FullFlagName(command.FlagCROHostConfigFile): command.CompleteFile, command.FullFlagName(command.FlagSensorIPCMode): command.CompleteIPCMode, }, }
View Source
var CommandSuggestion = prompt.Suggest{ Text: Name, Description: Usage, }
Functions ¶
func OnCommand ¶
func OnCommand( xc *app.ExecutionContext, gparams *command.GenericParams, targetRef string, doPull bool, dockerConfigPath string, registryAccount string, registrySecret string, doShowPullLogs bool, crOpts *config.ContainerRunOptions, httpProbeOpts config.HTTPProbeOptions, portBindings map[docker.Port][]docker.PortBinding, doPublishExposedPorts bool, hostExecProbes []string, doRmFileArtifacts bool, copyMetaArtifactsLocation string, doRunTargetAsUser bool, doShowContainerLogs bool, doEnableMondel bool, overrides *config.ContainerOverrides, links []string, etcHostsMaps []string, dnsServers []string, dnsSearchDomains []string, explicitVolumeMounts map[string]config.VolumeMount, doUseLocalMounts bool, doUseSensorVolume string, continueAfter *config.ContinueAfter, sensorIPCEndpoint string, sensorIPCMode string, logLevel string, logFormat string)
OnCommand implements the 'profile' command
func RegisterCommand ¶
func RegisterCommand()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.