Documentation ¶
Index ¶
- Constants
- func ArtifactRegistryReaderEmail() string
- func HelmChartObjects(scheme *runtime.Scheme, objs ...client.Object) func(options *helmOptions)
- func HelmChartVersion(version string) func(options *helmOptions)
- func HelmSourceChart(chart string) func(options *helmOptions)
- func ImageInputObjects(scheme *runtime.Scheme, objs ...client.Object) func(options *imageOptions)
- func ImageSourcePackage(sourcePackage string) func(options *imageOptions)
- func ImageVersion(version string) func(options *imageOptions)
- type ArtifactRegistryHelmProvider
- func (a *ArtifactRegistryHelmProvider) Client() HelmClient
- func (a *ArtifactRegistryHelmProvider) DeletePackage(chartName, digest string) error
- func (a *ArtifactRegistryHelmProvider) Login() error
- func (a *ArtifactRegistryHelmProvider) Logout() error
- func (a *ArtifactRegistryHelmProvider) PushPackage(localChartTgzPath string) (*HelmPackage, error)
- func (a *ArtifactRegistryHelmProvider) RepositoryLocalURL() (string, error)
- func (a *ArtifactRegistryHelmProvider) RepositoryRemoteURL() string
- func (a *ArtifactRegistryHelmProvider) Reset() error
- func (a *ArtifactRegistryHelmProvider) Setup() error
- type ArtifactRegistryOCIProvider
- func (a *ArtifactRegistryOCIProvider) Client() CraneClient
- func (a *ArtifactRegistryOCIProvider) DeleteImage(imageName, digest string) error
- func (a *ArtifactRegistryOCIProvider) Login() error
- func (a *ArtifactRegistryOCIProvider) Logout() error
- func (a *ArtifactRegistryOCIProvider) PushImage(imageName, tag, localSourceTgzPath string) (*OCIImage, error)
- func (a *ArtifactRegistryOCIProvider) Reset() error
- func (a *ArtifactRegistryOCIProvider) Setup() error
- type ArtifactRegistryProvider
- func (a *ArtifactRegistryProvider) ImageLocalAddress(imageName string) (string, error)
- func (a *ArtifactRegistryProvider) ImageRemoteAddress(imageName string) string
- func (a *ArtifactRegistryProvider) RegistryRemoteAddress() string
- func (a *ArtifactRegistryProvider) RepositoryPath() string
- func (a *ArtifactRegistryProvider) Teardown() error
- func (a *ArtifactRegistryProvider) Type() string
- type CraneClient
- type GcloudClient
- type HelmChartID
- type HelmClient
- type HelmOption
- type HelmPackage
- type HelmRegistryProvider
- type ImageOption
- type LocalHelmProvider
- func (l *LocalHelmProvider) Client() HelmClient
- func (l *LocalHelmProvider) DeletePackage(chartName, digest string) error
- func (l *LocalHelmProvider) PushPackage(localChartTgzPath string) (*HelmPackage, error)
- func (l *LocalHelmProvider) RepositoryLocalURL() (string, error)
- func (l *LocalHelmProvider) RepositoryLocalURLWithPort(localPort int) string
- func (l *LocalHelmProvider) RepositoryRemoteURL() string
- func (l *LocalHelmProvider) Reset() error
- func (l *LocalHelmProvider) Restore(proxyAddress string) error
- type LocalOCIProvider
- func (l *LocalOCIProvider) Client() CraneClient
- func (l *LocalOCIProvider) DeleteImage(imageName, digest string) error
- func (l *LocalOCIProvider) PushImage(imageName, tag, localSourceTgzPath string) (*OCIImage, error)
- func (l *LocalOCIProvider) Reset() error
- func (l *LocalOCIProvider) Restore(proxyAddress string) error
- type LocalProvider
- func (l *LocalProvider) ImageLocalAddress(imageName string) (string, error)
- func (l *LocalProvider) ImageRemoteAddress(imageName string) string
- func (l *LocalProvider) Login() error
- func (l *LocalProvider) Logout() error
- func (l *LocalProvider) ProxyAddress(localPort int) string
- func (l *LocalProvider) RegistryRemoteAddress() string
- func (l *LocalProvider) RepositoryPath() string
- func (l *LocalProvider) RepositoryRemoteAddress() string
- func (l *LocalProvider) Setup() error
- func (l *LocalProvider) Teardown() error
- func (l *LocalProvider) Type() string
- type OCIImage
- type OCIImageID
- type OCIRegistryProvider
- type ProxiedRegistryProvider
- type RegistryProvider
Constants ¶
const ArtifactRegistryReaderName = "e2e-test-ar-reader"
ArtifactRegistryReaderName is the name of the google service account with permission to read from Artifact Registry.
const DefaultLocation = "us"
DefaultLocation is the default location in which to host Artifact Registry repositories. In this case, `us`, which is a multi-region location.
Variables ¶
This section is empty.
Functions ¶
func ArtifactRegistryReaderEmail ¶
func ArtifactRegistryReaderEmail() string
ArtifactRegistryReaderEmail returns the email of the google service account with permission to read from Artifact Registry.
func HelmChartObjects ¶
HelmChartObjects builds the chart with the specified objects. A scheme must be provided to encode the object.
func HelmChartVersion ¶
func HelmChartVersion(version string) func(options *helmOptions)
HelmChartVersion builds the chart with the specified version.
func HelmSourceChart ¶
func HelmSourceChart(chart string) func(options *helmOptions)
HelmSourceChart builds the chart with the specified source chart. It should be a subfolder under '../testdata/helm-charts'.
func ImageInputObjects ¶
ImageInputObjects builds the image with the specified objects. A scheme must be provided to encode the object.
func ImageSourcePackage ¶
func ImageSourcePackage(sourcePackage string) func(options *imageOptions)
ImageSourcePackage builds the image with the specified package name. It should be a subfolder under '../testdata/'.
func ImageVersion ¶
func ImageVersion(version string) func(options *imageOptions)
ImageVersion builds the image with the specified version.
Types ¶
type ArtifactRegistryHelmProvider ¶
type ArtifactRegistryHelmProvider struct { ArtifactRegistryProvider HelmClient *testshell.HelmClient // contains filtered or unexported fields }
ArtifactRegistryHelmProvider provides methods for interacting with the test registry-server using the helm-sync interface.
func (*ArtifactRegistryHelmProvider) Client ¶
func (a *ArtifactRegistryHelmProvider) Client() HelmClient
Client for executing helm and crane commands.
func (*ArtifactRegistryHelmProvider) DeletePackage ¶
func (a *ArtifactRegistryHelmProvider) DeletePackage(chartName, digest string) error
DeletePackage deletes the helm chart OCI image from the remote registry, including all versions and tags.
func (*ArtifactRegistryHelmProvider) Login ¶
func (a *ArtifactRegistryHelmProvider) Login() error
Login to the registry with the HelmClient
func (*ArtifactRegistryHelmProvider) Logout ¶
func (a *ArtifactRegistryHelmProvider) Logout() error
Logout of the registry with the HelmClient
func (*ArtifactRegistryHelmProvider) PushPackage ¶
func (a *ArtifactRegistryHelmProvider) PushPackage(localChartTgzPath string) (*HelmPackage, error)
PushPackage pushes the local helm chart as an OCI image to the remote registry.
func (*ArtifactRegistryHelmProvider) RepositoryLocalURL ¶
func (a *ArtifactRegistryHelmProvider) RepositoryLocalURL() (string, error)
RepositoryLocalURL is the repositoryLocalAddress prepended with oci:// For pushing with the local helm client.
func (*ArtifactRegistryHelmProvider) RepositoryRemoteURL ¶
func (a *ArtifactRegistryHelmProvider) RepositoryRemoteURL() string
RepositoryRemoteURL is the repositoryRemoteAddress prepended with oci:// For pulling with RSync's `.spec.helm.repo`
func (*ArtifactRegistryHelmProvider) Reset ¶
func (a *ArtifactRegistryHelmProvider) Reset() error
Reset the state of the registry by deleting images pushed during the test.
func (*ArtifactRegistryHelmProvider) Setup ¶
func (a *ArtifactRegistryHelmProvider) Setup() error
Setup performs required setup for the helm AR provider. This requires setting up authentication for the helm CLI.
type ArtifactRegistryOCIProvider ¶
type ArtifactRegistryOCIProvider struct { ArtifactRegistryProvider OCIClient *testshell.OCIClient // contains filtered or unexported fields }
ArtifactRegistryOCIProvider provides methods for interacting with the test registry-server using the oci-sync interface.
func (*ArtifactRegistryOCIProvider) Client ¶
func (a *ArtifactRegistryOCIProvider) Client() CraneClient
Client for executing crane commands.
func (*ArtifactRegistryOCIProvider) DeleteImage ¶
func (a *ArtifactRegistryOCIProvider) DeleteImage(imageName, digest string) error
DeleteImage deletes the OCI image from the remote registry, including all versions and tags.
func (*ArtifactRegistryOCIProvider) Login ¶
func (a *ArtifactRegistryOCIProvider) Login() error
Login to the registry with the crane client
func (*ArtifactRegistryOCIProvider) Logout ¶
func (a *ArtifactRegistryOCIProvider) Logout() error
Logout of the registry with the crane client
func (*ArtifactRegistryOCIProvider) PushImage ¶
func (a *ArtifactRegistryOCIProvider) PushImage(imageName, tag, localSourceTgzPath string) (*OCIImage, error)
PushImage pushes the local tarball as an OCI image to the remote registry.
func (*ArtifactRegistryOCIProvider) Reset ¶
func (a *ArtifactRegistryOCIProvider) Reset() error
Reset the state of the registry by deleting images pushed during the test.
func (*ArtifactRegistryOCIProvider) Setup ¶
func (a *ArtifactRegistryOCIProvider) Setup() error
Setup performs setup
type ArtifactRegistryProvider ¶
type ArtifactRegistryProvider struct {
// contains filtered or unexported fields
}
ArtifactRegistryProvider is the provider type for Google Artifact Registry
func (*ArtifactRegistryProvider) ImageLocalAddress ¶
func (a *ArtifactRegistryProvider) ImageLocalAddress(imageName string) (string, error)
ImageLocalAddress returns the address of the image in the registry for use by local clients, like the helm or crane clients.
func (*ArtifactRegistryProvider) ImageRemoteAddress ¶
func (a *ArtifactRegistryProvider) ImageRemoteAddress(imageName string) string
ImageRemoteAddress returns the address of the image in the registry for use by remote clients, like Kubernetes or Config Sync.
func (*ArtifactRegistryProvider) RegistryRemoteAddress ¶ added in v1.19.1
func (a *ArtifactRegistryProvider) RegistryRemoteAddress() string
RegistryRemoteAddress returns the remote address of the registry.
func (*ArtifactRegistryProvider) RepositoryPath ¶ added in v1.19.1
func (a *ArtifactRegistryProvider) RepositoryPath() string
RepositoryPath returns the name or path of the repository, without the registry or image details.
func (*ArtifactRegistryProvider) Teardown ¶
func (a *ArtifactRegistryProvider) Teardown() error
Teardown preforms teardown This deletes the repository to prevent side effects across executions.
func (*ArtifactRegistryProvider) Type ¶
func (a *ArtifactRegistryProvider) Type() string
Type returns the provider type.
type CraneClient ¶
CraneClient executes commands with crane
type GcloudClient ¶
GcloudClient executes commands with gcloud
type HelmChartID ¶ added in v1.19.1
HelmChartID identifies a helm chart.
func (HelmChartID) String ¶ added in v1.19.1
func (id HelmChartID) String() string
String returns NAME/VERSION.
type HelmClient ¶
type HelmClient interface { Helm(args ...string) ([]byte, error) Crane(args ...string) ([]byte, error) }
HelmClient executes commands with crane or helm
type HelmOption ¶
type HelmOption func(options *helmOptions)
HelmOption is an optional parameter when building a helm chart.
type HelmPackage ¶
type HelmPackage struct { HelmChartID LocalChartTgzPath string Digest string Provider HelmRegistryProvider }
HelmPackage represents a helm package that is pushed to a remote registry by the test scaffolding. It uses git references as version tags to enable straightforward integration with the git e2e tooling and to mimic how a user might leverage git and helm.
func BuildHelmPackage ¶
func BuildHelmPackage(artifactDir string, provider HelmRegistryProvider, rsRef types.NamespacedName, opts ...HelmOption) (*HelmPackage, error)
BuildHelmPackage creates a new helm chart using the RSync NAMESPACE-NAME as the name of the chart. Chart version defaults to "v1.0.0-latest" if not specified. The resulting HelmPackage will only exist locally.
func (*HelmPackage) Delete ¶
func (h *HelmPackage) Delete() error
Delete the image from the remote registry.
type HelmRegistryProvider ¶
type HelmRegistryProvider interface { RegistryProvider // RepositoryRemoteURL is the RepositoryRemoteAddress prepended with oci:// // For pulling with RSync's `.spec.helm.repo` RepositoryRemoteURL() string // PushPackage pushes a local helm chart as an OCI image to the remote registry. PushPackage(localChartTgzPath string) (*HelmPackage, error) // DeletePackage deletes the helm chart OCI image from the remote registry, // including all versions and tags. DeletePackage(imageName, digest string) error // Client for executing helm and crane commands. Client() HelmClient }
HelmRegistryProvider abstracts remote OCI registry providers for use by Helm clients.
func NewHelmProvider ¶
func NewHelmProvider(provider, repoName string, gcloudClient GcloudClient, helmClient *testshell.HelmClient) HelmRegistryProvider
NewHelmProvider creates a RegistryProvider for the specific helm provider type. This enables writing tests that can run against multiple types of registries.
type ImageOption ¶
type ImageOption func(options *imageOptions)
ImageOption is an optional parameter when building an OCI image.
type LocalHelmProvider ¶
type LocalHelmProvider struct { LocalProvider HelmClient *testshell.HelmClient // contains filtered or unexported fields }
LocalHelmProvider provides methods for interacting with the test registry-server using the oci-sync interface.
func (*LocalHelmProvider) Client ¶
func (l *LocalHelmProvider) Client() HelmClient
Client for executing helm and crane commands.
func (*LocalHelmProvider) DeletePackage ¶
func (l *LocalHelmProvider) DeletePackage(chartName, digest string) error
DeletePackage deletes the helm chart OCI image from the remote registry, including all versions and tags.
func (*LocalHelmProvider) PushPackage ¶
func (l *LocalHelmProvider) PushPackage(localChartTgzPath string) (*HelmPackage, error)
PushPackage pushes the local helm chart as an OCI image to the remote registry.
func (*LocalHelmProvider) RepositoryLocalURL ¶
func (l *LocalHelmProvider) RepositoryLocalURL() (string, error)
RepositoryLocalURL is the repositoryLocalAddress prepended with oci:// For pushing with the local helm client.
func (*LocalHelmProvider) RepositoryLocalURLWithPort ¶
func (l *LocalHelmProvider) RepositoryLocalURLWithPort(localPort int) string
RepositoryLocalURLWithPort returns a URL for pushing images to the remote registry. localPort refers to the local port the PortForwarder is listening on. The name parameter is ignored because helm CLI appends the chart name to the image.
func (*LocalHelmProvider) RepositoryRemoteURL ¶
func (l *LocalHelmProvider) RepositoryRemoteURL() string
RepositoryRemoteURL is the repositoryRemoteAddress prepended with oci:// For pulling with RSync's `.spec.helm.repo`
func (*LocalHelmProvider) Reset ¶
func (l *LocalHelmProvider) Reset() error
Reset the state of the registry by deleting images pushed during the test.
func (*LocalHelmProvider) Restore ¶
func (l *LocalHelmProvider) Restore(proxyAddress string) error
Restore the proxy and re-push any previously pushed images.
type LocalOCIProvider ¶
type LocalOCIProvider struct { LocalProvider OCIClient *testshell.OCIClient // contains filtered or unexported fields }
LocalOCIProvider provides methods for interacting with the test registry-server using the oci-sync interface.
func (*LocalOCIProvider) Client ¶
func (l *LocalOCIProvider) Client() CraneClient
Client for executing helm and crane commands.
func (*LocalOCIProvider) DeleteImage ¶
func (l *LocalOCIProvider) DeleteImage(imageName, digest string) error
DeleteImage deletes the OCI image from the remote registry, including all versions and tags.
func (*LocalOCIProvider) PushImage ¶
func (l *LocalOCIProvider) PushImage(imageName, tag, localSourceTgzPath string) (*OCIImage, error)
PushImage pushes the local tarball as an OCI image to the remote registry.
func (*LocalOCIProvider) Reset ¶
func (l *LocalOCIProvider) Reset() error
Reset the state of the registry by deleting images pushed during the test.
func (*LocalOCIProvider) Restore ¶
func (l *LocalOCIProvider) Restore(proxyAddress string) error
Restore the proxy and re-push any previously pushed images.
type LocalProvider ¶
type LocalProvider struct { // PortForwarder is a port forwarder to the in-cluster registry server. // This is used to communicate from the tests to the in-cluster registry server. PortForwarder *portforwarder.PortForwarder // contains filtered or unexported fields }
LocalProvider refers to the test registry-server running on the same test cluster.
func (*LocalProvider) ImageLocalAddress ¶
func (l *LocalProvider) ImageLocalAddress(imageName string) (string, error)
ImageLocalAddress returns the local port forwarded address that proxies to the in-cluster git server. For use from the test framework to push to the registry.
func (*LocalProvider) ImageRemoteAddress ¶
func (l *LocalProvider) ImageRemoteAddress(imageName string) string
ImageRemoteAddress returns the address of the registry service from within the cluster. Fit for use from the *-sync containers inside the cluster.
func (*LocalProvider) Login ¶
func (l *LocalProvider) Login() error
Login to the local registry (no-op)
func (*LocalProvider) Logout ¶
func (l *LocalProvider) Logout() error
Logout of the local registry (no-op)
func (*LocalProvider) ProxyAddress ¶
func (l *LocalProvider) ProxyAddress(localPort int) string
ProxyAddress returns the localhost address of the proxy with the specified port.
func (*LocalProvider) RegistryRemoteAddress ¶ added in v1.19.1
func (l *LocalProvider) RegistryRemoteAddress() string
RegistryRemoteAddress returns the remote address of the registry.
func (*LocalProvider) RepositoryPath ¶ added in v1.19.1
func (l *LocalProvider) RepositoryPath() string
RepositoryPath returns the name or path of the repository, without the registry or image details.
func (*LocalProvider) RepositoryRemoteAddress ¶ added in v1.19.1
func (l *LocalProvider) RepositoryRemoteAddress() string
RepositoryRemoteAddress returns the address of the repository in the registry for use by remote clients, like Kubernetes or Config Sync.
func (*LocalProvider) Setup ¶
func (l *LocalProvider) Setup() error
Setup performs setup for LocalProvider (no-op)
func (*LocalProvider) Teardown ¶
func (l *LocalProvider) Teardown() error
Teardown performs teardown for LocalProvider (no-op)
type OCIImage ¶
type OCIImage struct { LocalSourceTgzPath string Tag string // aka Version Name string Digest string Provider OCIRegistryProvider }
OCIImage represents an OCI image that is pushed to a remote registry by the test scaffolding. It uses git references as version tags to enable straightforward integration with the git e2e tooling and to mimic how a user might leverage git and OCI.
func BuildImage ¶
func BuildImage(artifactDir string, shell *testshell.TestShell, provider OCIRegistryProvider, rsRef types.NamespacedName, opts ...ImageOption) (*OCIImage, error)
BuildImage creates a new OCIImage object and associated tarball using the provided Repository. The contents of the git repository will be bundled into a tarball at the artifactDir. The resulting OCIImage object can be pushed to a remote registry using its Push method.
func (*OCIImage) Delete ¶
Delete the image from the remote registry using the provided registry endpoint.
func (*OCIImage) OCIImageID ¶ added in v1.19.1
func (o *OCIImage) OCIImageID() OCIImageID
OCIImageID returns the ID of the OCI image.
func (*OCIImage) RemoteAddressWithDigest ¶
RemoteAddressWithDigest returns the image address with digest. For pulling with RSync's `.spec.oci.image`
func (*OCIImage) RemoteAddressWithTag ¶
RemoteAddressWithTag returns the image address with version tag. For pulling with RSync's `.spec.oci.image`
type OCIImageID ¶ added in v1.19.1
type OCIImageID struct { // Registry address (optional, default dockerhub) without the repository or // scheme. Registry string // Repository name or path (optional) used for namespacing and hierarchy. Repository string // Name of the image. Name string // Tag of the image (optional, default latest). Tag string // Digest of the image (optional), including the "sha256:"" prefix. Digest string }
OCIImageID represents the minimum information required to pull an OCI image.
func (OCIImageID) Address ¶ added in v1.19.1
func (id OCIImageID) Address() string
Address returns the address of the image [REGISTRY/][REPOSITORY/]NAME[:TAG][@DIGEST], WITHOUT the "oci://" scheme.
func (OCIImageID) String ¶ added in v1.19.1
func (id OCIImageID) String() string
String returns the URL of the image.
func (OCIImageID) URL ¶ added in v1.19.1
func (id OCIImageID) URL() string
URL returns the URL of the image SCHEME://[REGISTRY/][REPOSITORY/]NAME[:TAG][@DIGEST], WITH the "oci://" scheme.
func (OCIImageID) WithoutDigest ¶ added in v1.19.1
func (id OCIImageID) WithoutDigest() OCIImageID
WithoutDigest returns a copy of the OCIImageID without the digest.
func (OCIImageID) WithoutTag ¶ added in v1.19.1
func (id OCIImageID) WithoutTag() OCIImageID
WithoutTag returns a copy of the OCIImageID without the tag.
type OCIRegistryProvider ¶
type OCIRegistryProvider interface { RegistryProvider // RegistryRemoteAddress returns the address of the registry. RegistryRemoteAddress() string // RepositoryPath returns the name or path of the repository, without the // registry or image details. RepositoryPath() string // ImageRemoteAddress returns the address of the image in the registry. // For pulling with RSync's `.spec.oci.image` ImageRemoteAddress(imageName string) string // PushImage pushes a local tarball as an OCI image to the remote registry. PushImage(imageName, tag, localSourceTgzPath string) (*OCIImage, error) // DeleteImage deletes the OCI image from the remote registry, including all // versions and tags. DeleteImage(imageName, digest string) error // Client for executing crane commands. Client() CraneClient }
OCIRegistryProvider abstracts remote OCI registry providers for use by OCI clients.
func NewOCIProvider ¶
func NewOCIProvider(provider, repoName string, gcloudClient GcloudClient, ociClient *testshell.OCIClient) OCIRegistryProvider
NewOCIProvider creates a RegistryProvider for the specific OCI provider type. This enables writing tests that can run against multiple types of registries.
type ProxiedRegistryProvider ¶
type ProxiedRegistryProvider interface { RegistryProvider // ProxyAddress returns the address of the proxy with the specified port. ProxyAddress(localPort int) string // Restore the proxy and re-push any previously pushed images. // // Restore takes the new proxy address to avoid deadlocks trying to ask // PortForwarder.LocalPort(), which blocks until after restore is done. Restore(proxyAddress string) error }
ProxiedRegistryProvider is a registry provider with a proxy that needs to do extra work when the remote server is stopped and started to hide the downtime from the client.
type RegistryProvider ¶
type RegistryProvider interface { Type() string // Setup the RegistryProvider for a new test environment. Setup() error // Teardown the RegistryProvider when stopping a test environment. Teardown() error // Login to the registry with the client Login() error // Logout of the registry with the client Logout() error // Reset the state of the registry by deleting images pushed during the test. Reset() error }
RegistryProvider is an interface for remote OCI registry providers. This base interface is common form both OCIRegistryProvider & HelmRegistryProvider.