utils

package
v0.0.0-...-ae82615 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ticker *time.Ticker

Functions

func Base64Encode

func Base64Encode(str string) string

Base64Encode encodes string to base64.

func BuildDockerImage

func BuildDockerImage(_ChallengeName string, _DockerfilePath string)

func BuildDockerImageCc

func BuildDockerImageCc(_ChallengeName string, _DockerfilePath string)

this func is modified to pass args to dockerfile, so that name of challenge could be identified

func CheckDockerfile

func CheckDockerfile(_DockerfilePath string) bool

func CompareHashWithPassword

func CompareHashWithPassword(hashedPassword, password string) bool

func CopyFromPod

func CopyFromPod(podName string, containerName string, pathInPod string, localFilePath string, ns ...string) error

func CopyIntoPod

func CopyIntoPod(podName string, containerName string, pathInPod string, localFilePath string, ns ...string) error

func CreateDirectoryIfNotExists

func CreateDirectoryIfNotExists(dirPath string) error

func CreateService

func CreateService(clientset *kubernetes.Clientset, serviceName string, namespace string, port int32, targetPort int32, selector map[string]string) error

func DeleteConfigMapAndWait

func DeleteConfigMapAndWait(kubeClientset *kubernetes.Clientset, kubeConfig *rest.Config, configMapName string, configMapNamespace string)

func DeleteDaemonSetAndWait

func DeleteDaemonSetAndWait(kubeClientset *kubernetes.Clientset, kubeConfig *rest.Config, daemonSetName string, daemonSetNamespace string)

func DeploymentConfig

func DeploymentConfig() types.ManifestConfig

func DockerImageExists

func DockerImageExists(imageName string) bool

func EncodePassword

func EncodePassword(password, salt string) string

EncodePassword encodes password using PBKDF2 SHA256 with given salt.

func GenerateCerts

func GenerateCerts(domain string, basePath string) error

func GetKatanaLoadbalancer

func GetKatanaLoadbalancer() string

func GetKatanaRootPath

func GetKatanaRootPath() (string, error)

func GetKubeClient

func GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient returns a kubernetes clientset

func GetKubeConfig

func GetKubeConfig() (*rest.Config, error)

GetKubeConfig returns a kubernetes REST config object

func GetMongoIP

func GetMongoIP() string

func GetNodes

func GetNodes(clientset *kubernetes.Clientset) ([]corev1.Node, error)

func GetPods

func GetPods(lbls map[string]string, ns ...string) ([]corev1.Pod, error)

func GetRemainingTimeBeforeNextTick

func GetRemainingTimeBeforeNextTick() time.Duration

func GetTeamNumber

func GetTeamNumber() int

func GetTeamPodLabels

func GetTeamPodLabels() string

func GetTicker

func GetTicker() *time.Ticker

func HashPassword

func HashPassword(password string) (string, error)

func InitTicker

func InitTicker(duration time.Duration)

func MD5

func MD5(str string) string

MD5 encodes string to hexadecimal of MD5 checksum.

func Podexecutor

func Podexecutor(command []string, kubeClientset *kubernetes.Clientset, kubeConfig *rest.Config, podNamespace string)

func RandomSalt

func RandomSalt() (string, error)

RandomSalt returns randomly generated 10-character string that can be used as the user salt.

func RandomString

func RandomString(n uint) string

func ResetTicker

func ResetTicker(duration time.Duration)

func RunCommand

func RunCommand(cmd string) error

func SHA256

func SHA256(text string) string

func SetTicker

func SetTicker(ticker *time.Ticker)

func StopTicker

func StopTicker()

func Tar

func Tar(src string, writers ...io.Writer) error

func VerifyToken

func VerifyToken(c *fiber.Ctx) bool

func WaitForDeploymentReady

func WaitForDeploymentReady(clientset *kubernetes.Clientset, deploymentName string, namespace string) error

func WaitForLoadBalancerExternalIP

func WaitForLoadBalancerExternalIP(clientset *kubernetes.Clientset, serviceName string, namespace string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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