Documentation ¶
Overview ¶
Package metadata provides methods to deal with a metadata container server.
In order to imitate the GCE environment to provide credentials and some other project metadata, we run a metadata service container and make it available to build steps as metadata.google.internal, metadata, and the fixed IP 169.254.169.254.
The GCE metadata service is documented here:
https://cloud.google.com/compute/docs/storing-retrieving-metadata
The imitation metadata service we run offers a subset of the true metadata functionality, focused on providing credentials to client libraries.
Index ¶
- func CleanCloudbuildNetwork(r runner.Runner) error
- func CreateCloudbuildNetwork(r runner.Runner, subnet string) error
- func StartCloudServer(r runner.Runner, metadataImage string) error
- func StartLocalServer(r runner.Runner, metadataImage string) error
- type ProjectInfo
- type RealUpdater
- type Token
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanCloudbuildNetwork ¶ added in v0.1.1
CleanCloudbuildNetwork delete the cloudbuild network.
func CreateCloudbuildNetwork ¶ added in v0.1.1
CreateCloudbuildNetwork creates a cloud build network to link the build builds.
func StartCloudServer ¶ added in v0.0.5
StartCloudServer starts the metadata server container for VMs running as part of the container builder service.
This version of Start*Server needs to make iptables rules that we don't want (or need) on a user's local machine.
The container listens on local port 8082, which is where RealUpdater POSTs to.
func StartLocalServer ¶ added in v0.0.5
StartLocalServer starts the metadata server container for VMs running as part of the container builder service.
This version of Start*Server does not update iptables.
The container listens on local port 8082, which is where RealUpdater POSTs to.
Types ¶
type ProjectInfo ¶
type ProjectInfo struct { ProjectID string `json:"project_id"` ProjectNum int64 `json:"project_num"` }
ProjectInfo represents an incoming build request containing the project ID and number to make available as metadata.
type RealUpdater ¶
type RealUpdater struct {
Local bool
}
RealUpdater actually sends POST requests to update spoofed metadata.
func (RealUpdater) SetProjectInfo ¶
func (r RealUpdater) SetProjectInfo(b ProjectInfo) error
SetProjectInfo updates the spoofed metadata server's project information.
func (RealUpdater) SetToken ¶
func (r RealUpdater) SetToken(tok *Token) error
SetToken updates the spoofed metadata server's credentials.