v2

package
v0.0.0-...-e779149 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2022 The KubeSphere Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 The KubeSphere Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 The KubeSphere Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 The KubeSphere Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 The KubeSphere Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// DefaultRegistry is the registry name that will be used if no registry
	// provided and the default is not overridden.
	DefaultRegistry = "index.docker.io"

	// DefaultTag is the tag name that will be used if no tag provided and the
	// default is not overridden.
	DefaultTag = "latest"
)

Variables

This section is empty.

Functions

func Insecure

func Insecure(o *options)

Insecure is an Option that allows image references to be fetched without TLS.

func NewRegistryer

func NewRegistryer(opts ...Option) *registryer

Types

type DockerConfig

type DockerConfig map[string]DockerConfigEntry

DockerConfig represents the config file used by the docker CLI. This config that represents the credentials that should be used when pulling images from specific image repositories.

type DockerConfigEntry

type DockerConfigEntry struct {
	Username string
	Password string
	Email    string
	Auth     string
}

DockerConfigEntry wraps a docker config as a entry

type DockerConfigJSON

type DockerConfigJSON struct {
	Auths DockerConfig `json:"auths"`
	// +optional
	HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"`
}

DockerConfigJSON represents ~/.docker/config.json file info see https://github.com/docker/docker/pull/12009

type ImageConfig

type ImageConfig struct {
	*v1.ConfigFile `json:",inline"`
}

ImageConfig wraps v1.ConfigFile to avoid direct dependency

type Option

type Option func(*options)

Option is a functional option

func WithAuth

func WithAuth(auth authn.Authenticator) Option

WithAuth is a functional option for overriding the default authenticator for remote operations.

func WithContext

func WithContext(ctx context.Context) Option

WithContext is a functional option for setting the context.

func WithPlatform

func WithPlatform(platform *v1.Platform) Option

WithPlatform is an Option to specify the platform.

func WithTransport

func WithTransport(t http.RoundTripper) Option

WithTransport is a functional option for overriding the default transport for remote operations.

type RegistryHelper

type RegistryHelper interface {
	// check if secret has correct credential to authenticate with remote registry
	Auth(secret *corev1.Secret) (bool, error)

	// fetch OCI Image Manifest, specification described as in https://github.com/opencontainers/image-spec/blob/main/manifest.md
	Config(secret *corev1.Secret, image string) (*ImageConfig, error)

	// list all tags of given repository, experimental
	ListRepositoryTags(secret *corev1.Secret, repository string) (RepositoryTags, error)
}

func NewRegistryHelper

func NewRegistryHelper() RegistryHelper

type Registryer

type Registryer interface {
	// list repository tags
	ListRepositoryTags(image string) (RepositoryTags, error)

	// get image config
	Config(image string) (*v1.ConfigFile, error)
}

type RepositoryTags

type RepositoryTags struct {
	Registry   string   `json:"registry"`
	Repository string   `json:"repository"`
	Tags       []string `json:"tags"`
}

type SecretAuthenticator

type SecretAuthenticator interface {
	Options() []Option

	Auth() (bool, error)

	Authorization() (*authn.AuthConfig, error)
}

func NewSecretAuthenticator

func NewSecretAuthenticator(secret *v1.Secret) (SecretAuthenticator, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL