Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ SHIMCMD := cc-shim
SHIMPATH := $(PKGLIBEXECDIR)/$(SHIMCMD)

PROXYCMD := cc-proxy
PROXYURL := unix://$(PKGRUNDIR)/proxy.sock
PROXYPATH := $(PKGLIBEXECDIR)/$(PROXYCMD)

# Default number of vCPUs
Expand Down Expand Up @@ -165,7 +164,6 @@ USER_VARS += PKGLIBEXECDIR
USER_VARS += PKGRUNDIR
USER_VARS += PREFIX
USER_VARS += PROXYPATH
USER_VARS += PROXYURL
USER_VARS += QEMUBINDIR
USER_VARS += QEMUCMD
USER_VARS += QEMUPATH
Expand Down Expand Up @@ -219,7 +217,6 @@ var defaultShimPath = "$(SHIMPATH)"

const defaultKernelParams = "$(KERNELPARAMS)"
const defaultMachineType = "$(MACHINETYPE)"
const defaultProxyURL = "$(PROXYURL)"
const defaultRootDirectory = "$(PKGRUNDIR)"
const defaultRuntimeLib = "$(PKGLIBDIR)"
const defaultRuntimeRun = "$(PKGRUNDIR)"
Expand Down Expand Up @@ -288,7 +285,7 @@ $(GENERATED_FILES): %: %.in Makefile VERSION
-e "s|@KERNELPARAMS@|$(KERNELPARAMS)|g" \
-e "s|@LOCALSTATEDIR@|$(LOCALSTATEDIR)|g" \
-e "s|@PKGLIBEXECDIR@|$(PKGLIBEXECDIR)|g" \
-e "s|@PROXYURL@|$(PROXYURL)|g" \
-e "s|@PROXYPATH@|$(PROXYPATH)|g" \
-e "s|@QEMUPATH@|$(QEMUPATH)|g" \
-e "s|@MACHINETYPE@|$(MACHINETYPE)|g" \
-e "s|@SHIMPATH@|$(SHIMPATH)|g" \
Expand Down
12 changes: 8 additions & 4 deletions cc-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type RuntimeConfigInfo struct {
type RuntimeInfo struct {
Version RuntimeVersionInfo
Config RuntimeConfigInfo
Debug bool
}

// RuntimeVersionInfo stores details of the runtime version
Expand All @@ -78,20 +79,23 @@ type HypervisorInfo struct {
MachineType string
Version string
Path string
Debug bool
}

// ProxyInfo stores proxy details
type ProxyInfo struct {
Type string
Version string
URL string
Path string
Debug bool
}

// ShimInfo stores shim details
type ShimInfo struct {
Type string
Version string
Path string
Debug bool
}

// AgentInfo stores agent details
Expand Down Expand Up @@ -202,8 +206,6 @@ func getProxyInfo(config oci.RuntimeConfig) (ProxyInfo, error) {
return ProxyInfo{}, errors.New("cannot determine proxy config")
}

proxyURL := proxyConfig.URL

version, err := getCommandVersion(defaultProxyPath)
if err != nil {
version = unknown
Expand All @@ -212,7 +214,8 @@ func getProxyInfo(config oci.RuntimeConfig) (ProxyInfo, error) {
ccProxy := ProxyInfo{
Type: string(config.ProxyType),
Version: version,
URL: proxyURL,
Path: proxyConfig.Path,
Debug: proxyConfig.Debug,
}

return ccProxy, nil
Expand All @@ -239,6 +242,7 @@ func getShimInfo(config oci.RuntimeConfig) (ShimInfo, error) {
Type: string(config.ShimType),
Version: version,
Path: shimPath,
Debug: shimConfig.Debug,
}

return ccShim, nil
Expand Down
18 changes: 12 additions & 6 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ type hypervisor struct {
}

type proxy struct {
URL string `toml:"url"`
Path string `toml:"path"`
Debug bool `toml:"enable_debug"`
}

type runtime struct {
Expand Down Expand Up @@ -172,12 +173,16 @@ func (h hypervisor) defaultMemSz() uint32 {
return h.DefaultMemSz
}

func (p proxy) url() string {
if p.URL == "" {
return defaultProxyURL
func (p proxy) path() string {
if p.Path == "" {
return defaultProxyPath
}

return p.URL
return p.Path
}

func (p proxy) debug() bool {
return p.Debug
}

func (s shim) path() (string, error) {
Expand Down Expand Up @@ -265,7 +270,8 @@ func updateRuntimeConfig(configPath string, tomlConf tomlConfig, config *oci.Run
switch k {
case ccProxyTableType:
pConfig := vc.CCProxyConfig{
URL: proxy.url(),
Path: proxy.path(),
Debug: proxy.debug(),
}

config.ProxyType = vc.CCProxyType
Expand Down
6 changes: 5 additions & 1 deletion config/configuration.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ disable_block_device_use = @DEFDISABLEBLOCK@
#disable_nesting_checks = true

[proxy.cc]
url = "@PROXYURL@"
path = "@PROXYPATH@"

# If enabled, proxy messages will be sent to the system log
# (default: disabled)
#enable_debug = true

[shim.cc]
path = "@SHIMPATH@"
Expand Down
6 changes: 6 additions & 0 deletions vendor/github.com/containers/virtcontainers/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 43 additions & 18 deletions vendor/github.com/containers/virtcontainers/cc_proxy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/containers/virtcontainers/container.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/containers/virtcontainers/noop_proxy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 31 additions & 6 deletions vendor/github.com/containers/virtcontainers/pod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion vendor/github.com/containers/virtcontainers/proxy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.