util

package
v0.9.0-nightly.20250126 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArgocdInitialAdminSecretName = "argocd-initial-admin-secret"
	ArgocdAdminName              = "admin"
	ArgocdNamespace              = "argocd"
	ArgocdIngressURL             = "%s://argocd.cnoe.localtest.me:%s"
)
View Source
const (
	// hardcoded values from what we have in the yaml installation file.
	GiteaNamespace           = "gitea"
	GiteaAdminSecret         = "gitea-credential"
	GiteaAdminName           = "giteaAdmin"
	GiteaAdminTokenName      = "admin"
	GiteaAdminTokenFieldName = "token"
	// this is the URL accessible outside cluster. resolves to localhost
	GiteaIngressURL = "%s://gitea.cnoe.localtest.me:%s"
	// this is the URL accessible within cluster for ArgoCD to fetch resources.
	// resolves to cluster ip
	GiteaSvcURL = "%s://%s%s:%s%s"
)
View Source
const (
	QueryStringRef        = "ref"
	QueryStringVersion    = "version"
	QueryStringTimeout    = "timeout"
	QueryStringSubmodules = "submodules"

	RepoUrlDelimiter = "//"
	SCPDelimiter     = ":"
	UserDelimiter    = "@"
)

constants from remote target parameters supported by Kustomize https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md

View Source
const (
	StaticPassword = "developer"
)

Variables

This section is empty.

Functions

func ApplyAnnotation added in v0.7.0

func ApplyAnnotation(ctx context.Context, kubeClient client.Client, obj client.Object, annotations map[string]string, opts ...client.PatchOption) error

func ArgocdBaseUrl

func ArgocdBaseUrl(ctx context.Context) (string, error)

func ArgocdInitialAdminSecretObject

func ArgocdInitialAdminSecretObject() corev1.Secret

func CloneRemoteRepoToDir added in v0.5.0

func CloneRemoteRepoToDir(ctx context.Context, remote v1alpha1.RemoteRepositorySpec, depth int, insecureSkipTLS bool, dir, fallbackUrl string) (billy.Filesystem, *git.Repository, error)

func CloneRemoteRepoToMemory added in v0.5.0

func CloneRemoteRepoToMemory(ctx context.Context, remote v1alpha1.RemoteRepositorySpec, depth int, insecureSkipTLS bool) (billy.Filesystem, *git.Repository, error)

func CopyTreeToTree added in v0.5.0

func CopyTreeToTree(srcWT, dstWT billy.Filesystem, srcPath, dstPath string) error

func CopyWTFile added in v0.5.0

func CopyWTFile(srcWT, dstWT billy.Filesystem, srcFile, dstFile string) error

func DetectKindNodeProvider added in v0.8.1

func DetectKindNodeProvider() (cluster.ProviderOption, error)

DetectKindNodeProvider follows the kind CLI convention where: 1. if KIND_EXPERIMENTAL_PROVIDER env var is specified, it uses the value: 2. if env var is not specified, use the first available supported engine. https://github.com/kubernetes-sigs/kind/blob/ac81e7b64e06670132dae3486e64e531953ad58c/pkg/cluster/provider.go#L100-L114

func FirstRemoteURL added in v0.5.0

func FirstRemoteURL(repo *git.Repository) (string, error)

func GeneratePassword added in v0.4.0

func GeneratePassword() (string, error)

func GetCLIStartTimeAnnotationValue added in v0.2.0

func GetCLIStartTimeAnnotationValue(annotations map[string]string) (string, error)

func GetGiteaToken

func GetGiteaToken(ctx context.Context, baseUrl, username, password string) (string, error)

func GetHttpClient added in v0.8.0

func GetHttpClient() *http.Client

func GetLastObservedSyncTimeAnnotationValue added in v0.2.0

func GetLastObservedSyncTimeAnnotationValue(annotations map[string]string) (string, error)

func GetSecretByName

func GetSecretByName(ctx context.Context, kubeClient client.Client, ns, name string) (v1.Secret, error)

func GetWorktreeYamlFiles added in v0.5.0

func GetWorktreeYamlFiles(parent string, wt billy.Filesystem, recurse bool) ([]string, error)

returns all files with yaml or yml suffix from a worktree

func GiteaAdminSecretObject

func GiteaAdminSecretObject() corev1.Secret

func GiteaBaseUrl

func GiteaBaseUrl(ctx context.Context) (string, error)

func IsYamlFile added in v0.5.0

func IsYamlFile(input string) bool

func PatchPasswordSecret

func PatchPasswordSecret(ctx context.Context, kubeClient client.Client, config v1alpha1.BuildCustomizationSpec, ns string, secretName string, username string, pass string) error

func ReadWorktreeFile added in v0.5.0

func ReadWorktreeFile(wt billy.Filesystem, path string) ([]byte, error)

func RepoDir added in v0.5.0

func RepoDir(repoUrl, parent string) string

func RepoUrlHash added in v0.5.0

func RepoUrlHash(repoUrl string) string

func SetCLIStartTimeAnnotationValue added in v0.2.0

func SetCLIStartTimeAnnotationValue(annotations map[string]string, timeStamp string)

func SetLastObservedSyncTimeAnnotationValue added in v0.2.0

func SetLastObservedSyncTimeAnnotationValue(annotations map[string]string, timeStamp string)

func SetPackageLabels

func SetPackageLabels(obj client.Object)

func UpdateSyncAnnotation added in v0.2.0

func UpdateSyncAnnotation(ctx context.Context, kubeClient client.Client, obj client.Object) error

Types

type KustomizeRemote added in v0.5.0

type KustomizeRemote struct {
	Scheme   string
	User     string
	Password string
	Host     string
	Port     string
	RepoPath string

	FilePath string

	Ref        string
	Submodules bool
	Timeout    time.Duration
	// contains filtered or unexported fields
}

func NewKustomizeRemote added in v0.5.0

func NewKustomizeRemote(uri string) (*KustomizeRemote, error)

func (*KustomizeRemote) CloneUrl added in v0.5.0

func (g *KustomizeRemote) CloneUrl() string

func (*KustomizeRemote) Path added in v0.5.0

func (g *KustomizeRemote) Path() string

type RepoMap added in v0.5.0

type RepoMap struct {
	// contains filtered or unexported fields
}

func NewRepoLock added in v0.5.0

func NewRepoLock() *RepoMap

func (*RepoMap) LoadOrStore added in v0.5.0

func (r *RepoMap) LoadOrStore(repoName, dir string) *RepoState

type RepoState added in v0.5.0

type RepoState struct {
	MU  sync.Mutex
	Dir string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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