utils

package
v0.0.0-...-c9dffe9 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package utils provides utils.

Package utils provides utils.

Package utils provides utils.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUserToProject

func AddUserToProject(client *harborcli.HarborAPI, userID string, projectID int32, role int64) error

AddUserToProject 在project中给用户设置权限

func CheckHarborUserExist

func CheckHarborUserExist(client *harborcli.HarborAPI, userID string) (bool, error)

CheckHarborUserExist 判断harbor用户是否被创建

func CheckProjectMemberExist

func CheckProjectMemberExist(client *harborcli.HarborAPI, userID string, projectID int64) (bool, error)

CheckProjectMemberExist 判断用户是否是project的member

func CheckUserReady

func CheckUserReady(ctx context.Context, client *kubernetes.Clientset, userID string) (bool, error)

func CopyArtifact

func CopyArtifact(client *harborcli.HarborAPI, projectName string, destRepo string, src string) error

CopyArtifact copy artifact 到其他repo

func CreateConfigMap

func CreateConfigMap(
	ctx context.Context,
	client *kubernetes.Clientset,
	ns string,
	cm *v1.ConfigMap) (*v1.ConfigMap, error)

func CreateHarborProject

func CreateHarborProject(client *harborcli.HarborAPI, name string, isPublic string, limit *int64) error

CreateHarborProject 创建用户自己的project

func CreateHarborUser

func CreateHarborUser(client *harborcli.HarborAPI, userID string, passwd string, realName string, email string) error

CreateHarborUser 创建harbor用户

func CreateK8sDockerRegistrySecret

func CreateK8sDockerRegistrySecret(
	client *kubernetes.Clientset, ns string, registry string, username string, password string) error

func CreateNamespace

func CreateNamespace(ctx context.Context, client *kubernetes.Clientset, ns string) error

func CreateNetworkPolicy

func CreateNetworkPolicy(ctx context.Context, client *kubernetes.Clientset, ns string) error

CreateNetworkPolicy TODO: check all networking policy

func CreateReplicationPolicy

func CreateReplicationPolicy(client *harborcli.HarborAPI, namespace string, repo string, tag string,
	name string, registryID int64) error

CreateReplicationPolicy 创建replication policy

func CreateUserRoleBindingWithEdit

func CreateUserRoleBindingWithEdit(ctx context.Context, client *kubernetes.Clientset, ns, userID string) error

func DeleteArtifact

func DeleteArtifact(client *harborcli.HarborAPI, projectName string, repo string, reference string) error

DeleteArtifact 删除artifact

func DeleteReplicationPolicy

func DeleteReplicationPolicy(client *harborcli.HarborAPI, policyID int64) error

DeleteReplicationPolicy 删除指定的replication policy

func DeleteRepository

func DeleteRepository(client *harborcli.HarborAPI, projectName string, repo string) error

DeleteRepository 删除project下的repo

func GenerateConfigMap

func GenerateConfigMap(
	name string,
	generateName string,
	labels map[string]string,
	annotations map[string]string,
	data map[string]string) *v1.ConfigMap

func GetChartrepoRepoCharts

func GetChartrepoRepoCharts(client *harborcli.HarborAPI, repo string) ([]*models.ChartInfoEntry, error)

func GetChartrepoRepoChartsName

func GetChartrepoRepoChartsName(client *harborcli.HarborAPI, repo string, name string) (models.ChartVersions, error)

func GetChartrepoRepoChartsNameVersion

func GetChartrepoRepoChartsNameVersion(client *harborcli.HarborAPI, repo string, name string, version string) (*models.ChartVersionDetails, error)

func GetConfigMapList

func GetConfigMapList(client *kubernetes.Clientset, ns string, labelSelector string) (*v1.ConfigMapList, error)

func GetContainerLog

func GetContainerLog(ctx context.Context, client *kubernetes.Clientset, userID string,
	podName string, containerName *string, tailLines *int64) (io.ReadCloser, error)

func GetEnvDefault

func GetEnvDefault(env, defaultValue string) string

func GetHarborClient

func GetHarborClient(host string, basepath string, schemes []string) *harborcli.HarborAPI

func GetKubernetesClient

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

func GetPodList

func GetPodList(client *kubernetes.Clientset, labelSelector string, ns string) (*[]v1.Pod, error)

func GetPodStatus

func GetPodStatus(client *kubernetes.Clientset, labelSelector string, ns string) (v1.PodPhase, error)

func GetPolicyExecution

func GetPolicyExecution(client *harborcli.HarborAPI, policyID int64) (*models.ReplicationExecution, error)

GetPolicyExecution 获取指定的replication policy的execution

func GetProjectIDByName

func GetProjectIDByName(client *harborcli.HarborAPI, projectName string) (int32, error)

GetProjectIDByName 通过project的名字获得ID

func GetProjectRepositories

func GetProjectRepositories(client *harborcli.HarborAPI, projectName string, filter *string) ([]*models.Repository, error)

GetProjectRepositories 获取project下的所有repo

func GetProjectRepositoryArtifacts

func GetProjectRepositoryArtifacts(client *harborcli.HarborAPI, projectName string, repoName string) ([]*models.Artifact, error)

GetProjectRepositoryArtifacts 获取repo下面所有的artifacts

func GetRegistries

func GetRegistries(client *harborcli.HarborAPI) ([]*models.Registry, error)

GetRegistries 获取所有的

func GetReplicationExecution

func GetReplicationExecution(client *harborcli.HarborAPI, policyID int64) (*models.ReplicationExecution, error)

GetReplicationExecution 获取指定的replication policy的execution

func GetReplicationPolicies

func GetReplicationPolicies(client *harborcli.HarborAPI) ([]*models.ReplicationPolicy, error)

GetReplicationPolicies 获取所有的replication policy

func GetReplicationPolicyByID

func GetReplicationPolicyByID(client *harborcli.HarborAPI, policyID int64) (*models.ReplicationPolicy, error)

GetReplicationPolicyByID 通过ID获取指定的replication policy

func GetReplicationPolicyIDByName

func GetReplicationPolicyIDByName(client *harborcli.HarborAPI, policyName string) (int64, error)

GetReplicationPolicyIDByName 通过policy的名字获取policy ID

func GetRepository

func GetRepository(client *harborcli.HarborAPI, projectName string, repo string) (*models.Repository, error)

GetRepository 获取project下的所有repo

func GetRuntimeLocation

func GetRuntimeLocation() string

func GetServiceList

func GetServiceList(client *kubernetes.Clientset, labelSelector string, ns string) (*[]v1.Service, error)

func GetSpecifyInvolvedObjectEventList

func GetSpecifyInvolvedObjectEventList(client *kubernetes.Clientset, involvedObjectName string, ns string) (*[]v1.Event, error)

func MarkUserAsReady

func MarkUserAsReady(ctx context.Context, client *kubernetes.Clientset, userID string) error

func PostChartrepoRepoCharts

func PostChartrepoRepoCharts(client *harborcli.HarborAPI, repo string, chart runtime.NamedReadCloser) error

func RandCode

func RandCode(n int) string

func RandStr

func RandStr(strlen int) string

RandStr get random string for policy name

func RunReplicationExecution

func RunReplicationExecution(client *harborcli.HarborAPI, policyID int64) error

RunReplicationExecution 执行指定的replication policy

func StopReplicationExecution

func StopReplicationExecution(client *harborcli.HarborAPI, executionID int64) error

StopReplicationExecution 停止指定policy的execution

func UpdateConfigMap

func UpdateConfigMap(
	ctx context.Context,
	client *kubernetes.Clientset,
	ns string,
	cm *v1.ConfigMap) (*v1.ConfigMap, error)

Types

This section is empty.

Directories

Path Synopsis
Package helm provides utils for helm.
Package helm provides utils for helm.

Jump to

Keyboard shortcuts

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