Documentation
¶
Index ¶
- Constants
- func ByteCountIEC(b int64) string
- func CreateNamespace(ctx context.Context, kubeClient client.Client, name string, ...) error
- func CreateOrUpdate(ctx context.Context, cli client.Client, obj client.Object) (controllerutil.OperationResult, error)
- func CreateOrUpdateNamespace(ctx context.Context, kubeClient client.Client, name string, ...) error
- func EscapeResourceNameToLabelValue(resourceName string) string
- func FilterObjectsByFieldSelector(objects []runtime.Object, fieldSelector fields.Selector) []runtime.Object
- func GetBoxDrawingString(up bool, down bool, left bool, right bool, padLeft int, padRight int) string
- func GetCertificateCommonNameAndOrganizationsFromConfig(cfg *rest.Config) (string, []string)
- func GetCertificateSubject(certificate []byte) (*pkix.Name, error)
- func GetFilenameFromLocalOrRemote(path string) (string, error)
- func GetNamespace(ctx context.Context, kubeClient client.Client, name string) (*corev1.Namespace, error)
- func GetPodsLogs(ctx context.Context, config *rest.Config, containerName string, ...) error
- func GetServiceAccountSubjectFromConfig(cfg *rest.Config) string
- func GetTokenSubject(token string) (string, error)
- func GetUserInfoFromConfig(cfg *rest.Config) *authv1.UserInfo
- func IgnoreVPrefix(s string) string
- func IsCUEFile(path string) bool
- func IsCUETestFile(path string) bool
- func IsClusterScope(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (bool, error)
- func IsEmptyDir(path string) (bool, error)
- func IsJSONYAMLorCUEFile(path string) bool
- func IsValidURL(strURL string) bool
- func JoinURL(baseURL, subPath string) (string, error)
- func ParseAPIServerEndpoint(server string) (string, error)
- func PatchNamespace(ctx context.Context, kubeClient client.Client, ns *corev1.Namespace, ...) error
- func ReadRemoteOrLocalPath(pathOrURL string, saveLocal bool) ([]byte, error)
- func Sanitize(s string) string
- func StrictUnmarshal(bs []byte, dest interface{}) error
- func UpdateNamespace(ctx context.Context, kubeClient client.Client, name string, ...) error
- type Content
- type FileData
- type FilterFunc
- type GiteeContent
- type GithubContent
- type GitlabContent
- type LocalContent
- type MutateOption
- type OssContent
Constants ¶
const CUETestFileSuffix = "_test.cue"
CUETestFileSuffix marks a CUE file as definition tests, run by `vela def test`.
const TypeGitee = "gitee"
TypeGitee represents gitee
const TypeGithub = "github"
TypeGithub represents github
const TypeGitlab = "gitlab"
TypeGitlab represents gitlab
const TypeLocal = "local"
TypeLocal represents github
const TypeOss = "oss"
TypeOss represent oss
const TypeUnknown = "unknown"
TypeUnknown represents parse failed
Variables ¶
This section is empty.
Functions ¶
func ByteCountIEC ¶ added in v1.3.0
ByteCountIEC convert number of bytes into readable string borrowed from https://yourbasic.org/golang/formatting-byte-size-to-human-readable-format/
func CreateNamespace ¶ added in v1.2.0
func CreateNamespace(ctx context.Context, kubeClient client.Client, name string, options ...MutateOption) error
CreateNamespace will create a namespace with mutate option
func CreateOrUpdate ¶ added in v1.4.0
func CreateOrUpdate(ctx context.Context, cli client.Client, obj client.Object) (controllerutil.OperationResult, error)
CreateOrUpdate creates obj, or replaces the live object's content with it. The live object is reset before obj is written over it, so lists come out exactly as given instead of merged into the elements already there. Metadata is kept as an update would keep it: what the API server owns, labels and annotations merged with obj's, and finalizers and owner references unless obj sets its own; an empty, non-nil list clears them.
func CreateOrUpdateNamespace ¶ added in v1.2.0
func CreateOrUpdateNamespace(ctx context.Context, kubeClient client.Client, name string, options ...MutateOption) error
CreateOrUpdateNamespace will create a namespace if not exist, it will also update a namespace if exists It will report an error if the labels conflict while it will override the annotations
func EscapeResourceNameToLabelValue ¶ added in v1.5.0
EscapeResourceNameToLabelValue parse characters in resource name to label valid name
func FilterObjectsByFieldSelector ¶ added in v1.7.0
func FilterObjectsByFieldSelector(objects []runtime.Object, fieldSelector fields.Selector) []runtime.Object
FilterObjectsByFieldSelector supports all field queries per type
func GetBoxDrawingString ¶ added in v1.3.1
func GetBoxDrawingString(up bool, down bool, left bool, right bool, padLeft int, padRight int) string
GetBoxDrawingString get line drawing string, see https://en.wikipedia.org/wiki/Box-drawing_character nolint:gocyclo
func GetCertificateCommonNameAndOrganizationsFromConfig ¶ added in v1.4.0
GetCertificateCommonNameAndOrganizationsFromConfig extract CommonName and Organizations from Certificate
func GetCertificateSubject ¶ added in v1.4.0
GetCertificateSubject extract Subject from Certificate
func GetFilenameFromLocalOrRemote ¶ added in v1.5.0
GetFilenameFromLocalOrRemote returns the filename of a local path or a URL. It doesn't guarantee that the file or URL actually exists.
func GetNamespace ¶ added in v1.4.0
func GetNamespace(ctx context.Context, kubeClient client.Client, name string) (*corev1.Namespace, error)
GetNamespace will return a namespace with mutate option
func GetPodsLogs ¶ added in v1.6.0
func GetPodsLogs(ctx context.Context, config *rest.Config, containerName string, selectPods []*querytypes.PodBase, tmpl string, logC chan<- string, tailLines *int64) error
GetPodsLogs get logs from pods
func GetServiceAccountSubjectFromConfig ¶ added in v1.4.0
GetServiceAccountSubjectFromConfig extract ServiceAccountName subject from token
func GetTokenSubject ¶ added in v1.4.0
GetTokenSubject extract the subject field from the jwt token
func GetUserInfoFromConfig ¶ added in v1.4.0
GetUserInfoFromConfig extract UserInfo from KubeConfig
func IgnoreVPrefix ¶ added in v1.9.7
IgnoreVPrefix removes the leading "v" from a string
func IsCUETestFile ¶
IsCUETestFile reports whether path is a CUE definition test file. Tools that read definitions from a directory skip these, as the cue loader does.
func IsClusterScope ¶ added in v1.5.6
func IsClusterScope(gvk schema.GroupVersionKind, mapper meta.RESTMapper) (bool, error)
IsClusterScope check if the gvk is cluster scoped
func IsEmptyDir ¶ added in v1.5.0
IsEmptyDir checks if a given path is an empty directory
func IsJSONYAMLorCUEFile ¶ added in v1.5.0
IsJSONYAMLorCUEFile check if the path is a json or yaml file
func IsValidURL ¶ added in v1.2.3
IsValidURL checks whether the given string is a valid URL or not
func ParseAPIServerEndpoint ¶ added in v1.1.9
ParseAPIServerEndpoint automatically construct the full url of APIServer It will patch port and scheme if not exists
func PatchNamespace ¶ added in v1.7.3
func PatchNamespace(ctx context.Context, kubeClient client.Client, ns *corev1.Namespace, options ...MutateOption) error
PatchNamespace will patch a namespace
func ReadRemoteOrLocalPath ¶ added in v1.5.0
ReadRemoteOrLocalPath will read a path remote or locally
func StrictUnmarshal ¶ added in v1.3.0
StrictUnmarshal unmarshal target structure and disallow unknown fields
func UpdateNamespace ¶ added in v1.2.0
func UpdateNamespace(ctx context.Context, kubeClient client.Client, name string, options ...MutateOption) error
UpdateNamespace will update a namespace with mutate option
Types ¶
type Content ¶ added in v1.2.0
type Content struct {
OssContent
GithubContent
GiteeContent
GitlabContent
LocalContent
}
Content contains different type of content needed when building Registry
type FileData ¶ added in v1.4.0
FileData data of a file at the path
func LoadDataFromPath ¶ added in v1.4.0
func LoadDataFromPath(ctx context.Context, path string, pathFilter func(string) bool) ([]FileData, error)
LoadDataFromPath load FileData from path If path is an url, fetch the data from the url If path is a file, fetch the data from the file If path is a dir, fetch the data from all the files inside the dir that passes the pathFilter
type FilterFunc ¶ added in v1.7.0
FilterFunc return true if object contains field selector
type GiteeContent ¶ added in v1.3.0
type GiteeContent struct {
Owner string `json:"gitee_owner"`
Repo string `json:"gitee_repo"`
Path string `json:"gitee_path"`
Ref string `json:"gitee_ref"`
}
GiteeContent for cap center
type GithubContent ¶ added in v1.2.0
type GithubContent struct {
Owner string `json:"owner"`
Repo string `json:"repo"`
Path string `json:"path"`
Ref string `json:"ref"`
}
GithubContent for cap center
type GitlabContent ¶ added in v1.4.0
type GitlabContent struct {
Host string `json:"gitlab_host"`
Owner string `json:"gitlab_owner"`
Repo string `json:"gitlab_repo"`
Path string `json:"gitlab_path"`
Ref string `json:"gitlab_ref"`
PId int `json:"gitlab_pid"`
}
GitlabContent for cap center
type LocalContent ¶ added in v1.2.0
type LocalContent struct {
AbsDir string `json:"abs_dir"`
}
LocalContent for local registry
type MutateOption ¶ added in v1.2.0
MutateOption defines the function pattern for mutate
func MergeNoConflictLabels ¶ added in v1.2.0
func MergeNoConflictLabels(labels map[string]string) MutateOption
MergeNoConflictLabels will merge the existing labels with the labels passed in, it will report conflicts if exists
func MergeOverrideAnnotations ¶ added in v1.2.0
func MergeOverrideAnnotations(annotations map[string]string) MutateOption
MergeOverrideAnnotations will merge the existing annotations and override by the annotations passed in
func MergeOverrideLabels ¶ added in v1.2.0
func MergeOverrideLabels(labels map[string]string) MutateOption
MergeOverrideLabels will merge the existing labels and override by the labels passed in
type OssContent ¶ added in v1.2.0
OssContent for oss registry
Directories
¶
| Path | Synopsis |
|---|---|
|
Package kubeconfig reports whether a Kubernetes client configuration can be resolved, without terminating the process when it cannot.
|
Package kubeconfig reports whether a Kubernetes client configuration can be resolved, without terminating the process when it cannot. |
|
Package requiredcrds verifies at startup that the CRDs vela-core depends on are served by the cluster.
|
Package requiredcrds verifies at startup that the CRDs vela-core depends on are served by the cluster. |
|
Package servingcert keeps a self-signed CA and a serving cert for an in-cluster Service in a Secret, and renews them.
|
Package servingcert keeps a self-signed CA and a serving cert for an in-cluster Service in a Secret, and renews them. |