stackutils

package
v0.0.0-...-4560a53 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStackAlreadyExists     = errors.New("A stack already exists with this name")
	ErrWebhookIDAlreadyExists = errors.New("A webhook ID already exists")
)

Functions

func DownloadGitRepository

func DownloadGitRepository(config gittypes.RepoConfig, gitService portainer.GitService, getProjectPath func() string) (string, error)

DownloadGitRepository downloads the target git repository on the disk The first return value represents the commit hash of the downloaded git repository

func GetStackFilePaths

func GetStackFilePaths(stack *portainer.Stack, absolute bool) []string

GetStackFilePaths returns a list of file paths based on stack project path If absolute is false, the path sanitization step will be skipped, which makes the returning paths vulnerable to path traversal attacks. Thus, the followed function using the returning paths are responsible to sanitize the raw paths If absolute is true, the raw paths will be sanitized

func IsGitStack

func IsGitStack(stack *portainer.Stack) bool

IsGitStack checks if the stack is a git stack or not

func IsRelativePathStack

func IsRelativePathStack(stack *portainer.Stack) bool

IsRelativePathStack checks if the stack is a git stack or not

func IsValidStackFile

func IsValidStackFile(stackFileContent []byte, securitySettings *portainer.EndpointSecuritySettings) error

func ResourceControlID

func ResourceControlID(endpointID portainer.EndpointID, name string) string

ResourceControlID returns the stack resource control id

func SanitizeLabel

func SanitizeLabel(value string) string

convert string to valid kubernetes label by replacing invalid characters with periods

func UserIsAdminOrEndpointAdmin

func UserIsAdminOrEndpointAdmin(user *portainer.User, endpointID portainer.EndpointID) (bool, error)

func ValidateStackFiles

func ValidateStackFiles(stack *portainer.Stack, securitySettings *portainer.EndpointSecuritySettings, fileService portainer.FileService) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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