util

package
v0.5.1-b2f1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubeNamespace          = "kube-system"
	ApiGatewayNamespace    = "api-gateway-system"
	IngressNginxNamespace  = "ingress-nginx"
	ArgoNamespace          = "argocd"
	HyperregistryNamespace = "hyperregistry"
	OpenSearchNamespace    = "kube-logging"
)
View Source
const (
	// defunct
	// MultiApiServerServiceSelectorKey   = "hypercloud4"
	// MultiApiServerServiceSelectorValue = "multi-api-server"
	IngressNginxName       = "ingress-nginx-controller"
	MonitoringIngressRoute = "monitoring-ingressroute"
)
View Source
const (
	ProviderAws     = "AWS"

	ProviderVsphere     = "VSPHERE"

	ProviderUnknown = "Unknown"
)
View Source
const (
	ClmSecretTypeKubeconfig = "kubeconfig"
	ClmSecretTypeArgo       = "argocd"
	ClmSecretTypeSAToken    = "token"
)
View Source
const (
	ArgoApiGroup                  = "argocd.argoproj.io"
	ArgoServiceAccount            = "argocd-manager"
	ArgoServiceAccountTokenSecret = "argocd-manager-token"
	ArgoClusterRole               = "argocd-manager-role"
	ArgoClusterRoleBinding        = "argocd-manager-role-binding"
	ArgoSecretTypeCluster         = "cluster"
	ArgoSecretTypeGit             = "repo"
	ArgoAppTypeAppOfApp           = "app-of-apps"
	ArgoIngressName               = "argocd-server-ingress"
)
View Source
const (
	AnnotationKeyOwner   = "owner"
	AnnotationKeyCreator = "creator"

	AnnotationKeyArgoClusterSecret = "argocd.argoproj.io/cluster.secret"
	AnnotationKeyArgoManagedBy     = "managed-by"
	AnnotationKeyArgoSyncWave      = "argocd.argoproj.io/sync-wave"

	AnnotationKeyTraefikServerTransport = "traefik.ingress.kubernetes.io/service.serverstransport"
	AnnotationKeyTraefikEntrypoints     = "traefik.ingress.kubernetes.io/router.entrypoints"
	AnnotationKeyTraefikMiddlewares     = "traefik.ingress.kubernetes.io/router.middlewares"
	AnnotationKeyTraefikServerScheme    = "traefik.ingress.kubernetes.io/service.serversscheme"
)
View Source
const (
	LabelKeyHypercloudIngress = "ingress.tmaxcloud.org/name"

	LabelKeyClmSecretType = "cluster.tmax.io/clm-secret-type"

	LabelKeyArgoSecretType  = "argocd.argoproj.io/secret-type"
	LabelKeyCapiClusterName = "cluster.x-k8s.io/cluster-name"

	// LabelKeyArgoTargetCluster = "cluster.tmax.io/cluster"
	LabelKeyArgoTargetCluster = "cluster"
	LabelKeyArgoAppType       = "appType"
	LabelKeyArgoAppInstance   = "app.kubernetes.io/instance"
)
View Source
const (
	ArgoDescriptionGlobalDomain                 = "global domain으로 변경 ex) tmaxcloud.org"
	ArgoDescriptionPrivateRegistry              = "target registry 주소로 변경"
	ArgoDescriptionConsoleSubdomain             = "Console의 Subdomain으로 변경 ex) console"
	ArgoDescriptionHyperAuthSubdomain           = "HyperAuth의 Full domain으로 변경 ex) hyperauth.tmaxcloud.org"
	ArgoDescriptionKibanaSubdomain              = "Kibana의 Subdomain으로 변경 ex) kibana"
	ArgoDescriptionGrafanaOperatorSubdomain     = "Grafana의 Subdomain으로 변경 ex) grafana"
	ArgoDescriptionJaegerSubdomain              = "Jaeger의 Subdomain으로 변경 ex) jaeger"
	ArgoDescriptionKialiSubdomain               = "Kiali의 Subdomain으로 변경 ex) kiali"
	ArgoDescriptionCicdSubdomain                = "Cicd webhook의 Subdomain으로 변경 ex) cicd"
	ArgoDescriptionOpensearchSubdomain          = "Opensearch dashboard의 Subdomain으로 변경 ex) opensearch"
	ArgoDescriptionHyperregistrySubdomain       = "Hyperregistry-core의 Subdomain으로 변경 ex) hyperregistry"
	ArgoDescriptionHyperregistryNotarySubdomain = "Hyperregistry-notary의 Subdomain으로 변경 ex) notary"
	ArgoDescriptionHelmApiServerSubdomain       = "Helm api server의 Subdomain으로 변경 ex) helm"
	ArgoDescriptionHyperregistryStorageClass    = "Hyperregistry가 사용할 StorageClass로 변경(aws의 경우 efs-sc-0, 그외에는 nfs)"
	ArgoDescriptionHyperregistryDBStorageClass  = "Hyperregistry의 DB가 사용할 StorageClass로 변경(aws의 경우 efs-sc-999, 그외에는 nfs)"
	ArgoDescriptionGitRepo                      = "Git repo 주소 입력(gitlab의 경우 마지막에 .git 입력) ex. https://github.com/tmax-cloud/argocd-installer.git"
	ArgoDescriptionGitRevision                  = "Git target revision(branch, tag)를 입력 ex) main"
)
View Source
const (
	HC_DOMAIN          = "HC_DOMAIN"
	AUTH_CLIENT_SECRET = "AUTH_CLIENT_SECRET"
	AUTH_SUBDOMAIN     = "AUTH_SUBDOMAIN"

	// optional 환경 변수
	ARGO_APP_DELETE = "ARGO_APP_DELETE"
	OIDC_CLIENT_SET = "OIDC_CLIENT_SET"
	DEV_MODE        = "DEV_MODE"
)

multi-operator bootstrap을 위해 필요한 초기 환경변수 변수 추가시 GetRequiredEnvPreset에 추가해야 함

View Source
const (
	ArgoResourceFinalizers = "resources-finalizer.argocd.argoproj.io"
)
View Source
const (
	HARBOR_SERVICE_SET_OIDC_CONFIG = "/api/v2.0/configurations"
)
View Source
const (
	KubeconfigSuffix = "-kubeconfig"
)

Variables

This section is empty.

Functions

func AddColonToThumbprint

func AddColonToThumbprint(thumbprint string) (string, error)

thumbprint가 colon 없이 들어온다면 colon을 붙인다.

func CheckRequiredEnvPreset

func CheckRequiredEnvPreset() error

func CreateSuffixString

func CreateSuffixString() string

func Delete

func Delete(namespace, cluster string) error

func GetK8sClient

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

func GetProviderName

func GetProviderName(provider string) (string, error)

func GetRemoteK8sClient

func GetRemoteK8sClient(secret *coreV1.Secret) (*kubernetes.Clientset, error)

func GetRemoteK8sClientByKubeConfig

func GetRemoteK8sClientByKubeConfig(kubeConfig []byte) (*kubernetes.Clientset, error)

func GetRemoteK8sTraefikClient

func GetRemoteK8sTraefikClient(secret *coreV1.Secret) (*traefikv1alpha1.TraefikV1alpha1Client, error)

func GetRequiredEnvPreset

func GetRequiredEnvPreset() []string

func Insert

func Insert(clusterManager *clusterV1alpha1.ClusterManager) error

func IsAWSProvider

func IsAWSProvider(provider string) bool

func IsClusterHealthy

func IsClusterHealthy(clientSet *kubernetes.Clientset) bool

func IsOK

func IsOK(check int) bool

func IsTrue

func IsTrue(str string) bool

func IsVsphereProvider

func IsVsphereProvider(provider string) bool

func List

func List(namespace, cluster string) ([]byte, error)

func LowestNonZeroResult

func LowestNonZeroResult(i, j ctrl.Result) ctrl.Result

LowestNonZeroResult compares two reconciliation results and returns the one with lowest requeue time.

func MergeJson

func MergeJson(dest []byte, source []byte) []byte

func SetHyperregistryOIDC

func SetHyperregistryOIDC(config OidcConfig, secret *coreV1.Secret, hostpath string) error

func SetHyperregistryServiceURI

func SetHyperregistryServiceURI(hostpath string, serviceName string, urlParameter map[string]string) string

func URIToSecretName

func URIToSecretName(uriType, uri string) (string, error)

Types

type OidcConfig

type OidcConfig struct {
	AuthMode         string `json:"auth_mode,omitempty"`
	OidcAdminGroup   string `json:"oidc_admin_group,omitempty"`
	OidcAutoOnBoard  bool   `json:"oidc_auto_onboard,omitempty"`
	OidcClientId     string `json:"oidc_client_id,omitempty"`
	OidcClientSecret string `json:"oidc_client_secret,omitempty"`
	OidcEndpoint     string `json:"oidc_endpoint,omitempty"`
	OidcGroupsClaim  string `json:"oidc_groups_claim,omitempty"`
	OidcName         string `json:"oidc_name,omitempty"`
	OidcScope        string `json:"oidc_scope,omitempty"`
	OidcUserClaim    string `json:"oidc_user_claim,omitempty"`
	OidcVerifyCert   bool   `json:"oidc_verify_cert,omitempty"`
}

Jump to

Keyboard shortcuts

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