Documentation
¶
Overview ¶
Package templates defines the container templates
Index ¶
Constants ¶
const ( // ContainerPortScheme is designed for docker bridge networks where the // communication within a network may use container name as the address. // The scheme indicates the port number used in the container (and // exposed and published when docker run) need to be populated into the // template. For example, if the service running in the container listens to // port 80 and the port has been exposed and published during docker run. // An IpEndpoint address of `ctr-container-port://container-name` indicates // that the address should be replaced with `container-name` and the port // should be replaced with actual port `80`. (Note that within a network, a // container can be referenced by name.) // To use this scheme, the port number in the input IpEndpoint must be 0. ContainerPortScheme = "ctr-container-port" // LocalhostPortScheme is designed for the docker `host` network (where // networking is shared with the host) for containers that have // go/cft-port-discovery implemented. // The schema indicates the host address and port number need to be populated // into the template. As the host address will always be `localhost`. The // current templated container must be in the `host` network. LocalhostPortScheme = "ctr-localhost-port" )
Scheme definitions
const ( DockerCacheServerPort = "43150" DockerCacheServerLogsDir = "/tmp/cacheserver" )
const CrosTestDirPrefix = "cros-test-"
const DockerGcsPublishLogsDir = "/tmp/gcs-publish/"
const DockerGcsPublishPort = "43147"
const DockerGcsPublishServiceAcctsCredsDir = "/tmp/gcs-publish-service-creds/"
const DockerGcsPublishTestArtifactsDir = "/tmp/gcs-publish-test-artifacts/"
const DockerPostProcessLogsDir = "/tmp/post-process/"
const DockerPostProcessLuciContextDir = "/tmp/post-process-luci-context/"
const DockerPostProcessPort = "43151"
const DockerPostProcessServiceAcctsCredsDir = "/tmp/post-process-service-creds/"
const DockerPostProcessTestResultsDir = "/tmp/test/results" // Follows how cros_testexec stores test artifacts
const DockerRdbLuciContextDir = "/tmp/rdb-luci-context/"
const DockerRdbPublishLogsDir = "/tmp/rdb-publish/"
const DockerRdbPublishLuciContextDir = "/tmp/rdb-luci-context/"
const DockerRdbPublishPort = "43149"
const DockerRdbPublishServiceAcctsCredsDir = "/tmp/rdb-publish-service-creds/"
const DockerRdbPublishTestResultsDir = "/tmp/test/results" // Follows how cros_testexec stores test artifacts
const DockerTkoPublishLogsDir = "/tmp/tko-publish/"
const DockerTkoPublishPort = "43148"
const DockerTkoPublishTestArtifactsDir = "/tmp/tko-publish-test-artifacts/"
const HostServiceAcctCredsDir = "/creds/service_accounts"
HostServiceAcctCredsDir is the path on the host where service account credentials are stored. This must be mounted into containers which are making requests to GCP.
const LuciContext = "LUCI_CONTEXT"
Variables ¶
var TemplateUtils = templateUtils{ // contains filtered or unexported fields }
Functions ¶
This section is empty.
Types ¶
type ContainerLookuper ¶
type ContainerLookuper interface {
LookupContainerPortBindings(name string) ([]*api.Container_PortBinding, error)
}
ContainerLookuper provides interface to lookup information for a container
type RequestRouter ¶
type RequestRouter struct{}
RequestRouter is the entry point to template processing.
func (*RequestRouter) Process ¶
func (r *RequestRouter) Process(request *api.StartTemplatedContainerRequest) (*api.StartContainerRequest, error)
type TemplateProcessor ¶
type TemplateProcessor interface {
Process(*api.StartTemplatedContainerRequest) (*api.StartContainerRequest, error)
}
TemplateProcessor converts a container-specific template into a valid generic StartContainerRequest. Besides request conversions, a TemplateProcessor is also aware of a container's dependencies of other containers, whose addresses are determined at runtime. The addresses are provided as IpEndpoint placeholders in a template, and TemplateProcessor use placeholderPopulators to populate actual values.
Source Files
¶
- gce_metadata.go
- placeholder.go
- template.go
- template_cache_server.go
- template_cros_dut.go
- template_cros_fw_provision.go
- template_cros_provision.go
- template_cros_publish_gcs.go
- template_cros_publish_rdb.go
- template_cros_publish_tko.go
- template_cros_testexec.go
- template_cros_vm_provision.go
- template_generic.go
- template_post_process.go
- util.go