Documentation ¶
Index ¶
- Constants
- Variables
- func ApplySystemImagePullSecrets(podSpec *corev1.PodSpec)
- func ApplyUpdatedAnnotations(annotations map[string]string) map[string]string
- func CalculateContainer(productSvc *commonmodels.ProductService, curUsedSvc *commonmodels.Service, ...) []*models.Container
- func CheckIstiodInstalled(ctx context.Context, clientset *kubernetes.Clientset) (bool, error)
- func CheckReleaseInstalledByOtherEnv(releaseNames sets.String, productInfo *commonmodels.Product) error
- func CheckResourceAppliedByOtherEnv(serviceYaml string, productInfo *commonmodels.Product, serviceName string) error
- func CreateNamespace(namespace string, customLabels map[string]string, enableIstioInjection bool, ...) error
- func CreateOrPatchResource(applyParam *ResourceApplyParam, log *zap.SugaredLogger) ([]*unstructured.Unstructured, error)
- func CreateOrUpdateDefaultRegistrySecret(namespace string, reg *commonmodels.RegistryNamespace, ...) error
- func CreateOrUpdateRSASecret(publicKey, privateKey []byte, kubeClient client.Client) error
- func CreateOrUpdateRegistrySecret(namespace string, reg *commonmodels.RegistryNamespace, isDefault bool, ...) error
- func DeleteEnvoyFilter(ctx context.Context, istioClient versionedclient.Interface, ...) error
- func DeleteHelmReleaseFromEnv(userName, requestID string, productInfo *commonmodels.Product, ...) error
- func DeleteHelmServiceFromEnv(userName, requestID string, productInfo *commonmodels.Product, ...) error
- func DeploymentSelectorLabelExists(resourceName, namespace string, informer informers.SharedInformerFactory, ...) bool
- func EnsureCleanRouteInBase(ctx context.Context, envName, baseNS, vsName string, ...) error
- func EnsureDefaultK8sServiceInGray(ctx context.Context, baseSvc *corev1.Service, grayNS string, ...) error
- func EnsureDefaultVirtualServiceInGray(ctx context.Context, baseSvc *corev1.Service, grayNS, baseNS string, ...) error
- func EnsureDeleteGrayscaleService(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, ...) error
- func EnsureDeleteK8sService(ctx context.Context, ns, svcName string, kclient client.Client, ...) error
- func EnsureDeletePreCreatedServices(ctx context.Context, productName, namespace string, ...) error
- func EnsureDeleteZadigService(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, ...) error
- func EnsureDeleteZadigServiceByHelmRelease(ctx context.Context, env *commonmodels.Product, releaseName string, ...) error
- func EnsureDeleteZadigServiceBySvcName(ctx context.Context, env *commonmodels.Product, svcName string, ...) error
- func EnsureEnvoyFilter(ctx context.Context, istioClient versionedclient.Interface, ...) error
- func EnsureFullPathGrayScaleConfig(ctx context.Context, env *commonmodels.Product, kclient client.Client, ...) error
- func EnsureGrayEnvConfig(ctx context.Context, env *commonmodels.Product, kclient client.Client, ...) error
- func EnsureNamespaceLabels(namespace string, customLabels map[string]string, kubeClient client.Client) error
- func EnsureUpdateGrayscaleService(ctx context.Context, env *commonmodels.Product, svcName string, ...) error
- func EnsureUpdateZadigSerivce(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, ...) error
- func EnsureUpdateZadigService(ctx context.Context, env *commonmodels.Product, svcName string, ...) error
- func EnsureVirtualService(ctx context.Context, kclient client.Client, ...) error
- func EnsureZadigServiceByManifest(ctx context.Context, productName, namespace, manifest string) error
- func FetchCurrentAppliedYaml(option *GeneSvcYamlOption) (string, int, error)
- func FetchSelectedWorkloads(namespace string, Resource []*WorkloadResource, kubeclient crClient.Client, ...) ([]*appsv1.Deployment, []*appsv1.StatefulSet, []*batchv1.CronJob, ...)
- func FetchSubEnvs(ctx context.Context, productName, clusterID, baseEnvName string) ([]*commonmodels.Product, error)
- func GenRegistrySecretName(reg *commonmodels.RegistryNamespace) (string, error)
- func GenVirtualServiceName(svc *corev1.Service) string
- func GeneKVFromYaml(yamlContent string) ([]*commonmodels.VariableKV, error)
- func GeneMergedValues(productSvc *commonmodels.ProductService, ...) (string, error)
- func GenerateYamlFromKV(kvs []*commonmodels.VariableKV) (string, error)
- func GetClientset(clusterID string) (kubernetes.Interface, error)
- func GetDirtyResources(ns string, kubeClient client.Client) []metav1.Object
- func GetKubeAPIReader(clusterID string) (client.Reader, error)
- func GetPredefinedClusterLabels(product, service, envName string) map[string]string
- func GetPredefinedLabels(product, service string) map[string]string
- func GetRESTConfig(clusterID string) (*rest.Config, error)
- func GetSelectedPodsInfo(selector labels.Selector, informer informers.SharedInformerFactory, ...) (string, string, []string)
- func GetValidGVK(gvk schema.GroupVersionKind, version *version.Info) schema.GroupVersionKind
- func InitializeExternalCluster(hubserverAddr, clusterID string) error
- func InstallOrUpgradeHelmChartWithValues(param *ReleaseInstallParam, isRetry bool, helmClient *helmtool.HelmClient) error
- func MakeSafeLabelValue(value string) string
- func ManifestToResource(manifest string) ([]*commonmodels.ServiceResource, error)
- func ManifestToUnstructured(manifest string) ([]*unstructured.Unstructured, error)
- func MergeImages(curContainers []*models.Container, images []string) []string
- func MergeLabels(from, to map[string]string) map[string]string
- func ParseSysKeys(namespace, envName, productName, serviceName, ori string) string
- func PrepareHelmServiceData(applyParam *ResourceApplyParam) (*commonmodels.ProductService, *commonmodels.Service, error)
- func RemoveClusterResources(hubserverAddr, clusterID string) error
- func RemoveHelmResource(applyParam *ResourceApplyParam, log *zap.SugaredLogger) error
- func RenderEnvService(prod *commonmodels.Product, serviceRender *template.ServiceRender, ...) (yaml string, err error)
- func RenderEnvServiceWithTempl(prod *commonmodels.Product, serviceRender *template.ServiceRender, ...) (yaml string, err error)
- func RenderServiceYaml(originYaml, productName, serviceName string, svcRender *template.ServiceRender) (string, error)
- func SetFieldValueIsNotExist(obj map[string]interface{}, value interface{}, fields ...string) map[string]interface{}
- func SetIstioGrayscaleConfig(ctx context.Context, envName, productName string, ...) error
- func SetIstioGrayscaleHeaderMatch(ctx context.Context, envMap map[string]*commonmodels.Product, ...) error
- func SetIstioGrayscaleWeight(ctx context.Context, envMap map[string]*commonmodels.Product, ...) error
- func StatefulsetSelectorLabelExists(resourceName, namespace string, informer informers.SharedInformerFactory, ...) bool
- func UninstallRelease(helmClient helmclient.Client, env *commonmodels.Product, releaseName string, ...) error
- func UninstallService(helmClient helmclient.Client, env *commonmodels.Product, ...) error
- func UninstallServiceByName(helmClient helmclient.Client, serviceName string, env *commonmodels.Product, ...) error
- func UnstructuredToResources(unstructured []*unstructured.Unstructured) []*commonmodels.ServiceResource
- func UpgradeHelmRelease(product *commonmodels.Product, productSvc *commonmodels.ProductService, ...) error
- func ValidateClusterRoleYAML(k8sYaml string, logger *zap.SugaredLogger) error
- type EnvoyAddress
- type EnvoyClusterConfigLoadAssignment
- type EnvoyEndpoint
- type EnvoyEndpoints
- type EnvoyLBEndpoints
- type EnvoySocketAddress
- type GeneSvcYamlOption
- type IstioGrayscaleEnvHandler
- type MatchedEnv
- type ReleaseInstallParam
- type ResourceApplyParam
- type Service
- func (s *Service) CreateCluster(cluster *models.K8SCluster, id string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
- func (s *Service) DeleteCluster(user string, id string, logger *zap.SugaredLogger) error
- func (s *Service) GetCluster(id string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
- func (s *Service) GetClusterByToken(token string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
- func (s *Service) GetYaml(id, agentImage, aslanURL, hubURI string, useDeployment bool, ...) ([]byte, error)
- func (s *Service) ListClusters(clusterType string, logger *zap.SugaredLogger) ([]*models.K8SCluster, error)
- func (s *Service) ListConnectedClusters(logger *zap.SugaredLogger) ([]*models.K8SCluster, error)
- func (s *Service) UpdateCluster(id string, cluster *models.K8SCluster, logger *zap.SugaredLogger) (*models.K8SCluster, error)
- func (s *Service) UpdateUpgradeAgentInfo(id, updateHubagentErrorMsg string) error
- type SetIstioGrayscaleConfigRequest
- type ShareEnvOp
- type ShareEnvReady
- type ShareEnvReadyChecks
- type SharedEnvHandler
- type TemplateSchema
- type WorkloadResource
Constants ¶
const ( NameSpaceRegexString = "[^a-z0-9.-]" DefaultNameRegexString = "^[a-zA-Z0-9-_]{1,50}$" )
const ( DefaultDindReplicas int = 1 DefaultDindLimitsCPU int = 4000 DefaultDindLimitsMemory int = 8192 DefaultDindStorageType commonmodels.DindStorageType = commonmodels.DindStorageRootfs DefaultDindEnablePV bool = false DefaultDindStorageClassName string = "" DefaultDindStorageSizeInGiB int = 10 )
Variables ¶
var ( NameSpaceRegex = regexp.MustCompile(NameSpaceRegexString) DefaultNameRegex = regexp.MustCompile(DefaultNameRegexString) )
var ClusterAccessYamlTemplate = `` /* 210-byte string literal not displayed */
var WorkflowResourceYaml = `` /* 2496-byte string literal not displayed */
var YamlTemplateForNamespace = template.Must(template.New("agentYaml").Parse(`
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: koderover-agent-sa
namespace: {{.Namespace}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: koderover-agent-admin-binding
namespace: {{.Namespace}}
subjects:
- kind: ServiceAccount
name: koderover-agent-sa
namespace: {{.Namespace}}
roleRef:
kind: Role
name: koderover-agent-admin-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: koderover-agent-admin-role
namespace: {{.Namespace}}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: workflow-cm-manager
namespace: {{.Namespace}}
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["*"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: workflow-cm-sa
namespace: {{.Namespace}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: workflow-cm-rolebinding
namespace: {{.Namespace}}
subjects:
- kind: ServiceAccount
name: workflow-cm-sa
namespace: {{.Namespace}}
roleRef:
kind: Role
name: workflow-cm-manager
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: Service
metadata:
name: hub-agent
namespace: {{.Namespace}}
labels:
app: koderover-agent-agent
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
app: koderover-agent-agent
---
apiVersion: apps/v1
{{- if .UseDeployment }}
kind: Deployment
{{- else }}
kind: DaemonSet
{{- end }}
metadata:
name: koderover-agent-node-agent
namespace: {{.Namespace}}
spec:
selector:
matchLabels:
app: koderover-agent-agent
template:
metadata:
labels:
app: koderover-agent-agent
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/os
operator: NotIn
values:
- windows
{{- if .UseDeployment }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
{{- end }}
hostNetwork: true
serviceAccountName: koderover-agent-sa
containers:
- name: agent
image: {{.HubAgentImage}}
imagePullPolicy: Always
env:
- name: AGENT_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HUB_AGENT_TOKEN
value: "{{.ClientToken}}"
- name: HUB_SERVER_BASE_ADDR
value: "{{.HubServerBaseAddr}}"
- name: ASLAN_BASE_ADDR
value: "{{.AslanBaseAddr}}"
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 100m
memory: 256Mi
{{- if .UseDeployment }}
replicas: 1
{{- else }}
updateStrategy:
type: RollingUpdate
{{- end }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dind
namespace: {{.Namespace}}
labels:
app.kubernetes.io/component: dind
app.kubernetes.io/name: zadig
spec:
serviceName: dind
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: dind
app.kubernetes.io/name: zadig
template:
metadata:
labels:
app.kubernetes.io/component: dind
app.kubernetes.io/name: zadig
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
containers:
- name: dind
image: {{.DindImage}}
env:
- name: DOCKER_TLS_CERTDIR
value: ""
securityContext:
privileged: true
ports:
- protocol: TCP
containerPort: 2375
resources:
limits:
cpu: "4"
memory: 8Gi
requests:
cpu: 100m
memory: 128Mi
{{- if .DindEnablePV }}
volumeMounts:
- name: zadig-docker
mountPath: /var/lib/docker
volumeClaimTemplates:
- metadata:
name: zadig-docker
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{.DindStorageClassName}}
resources:
requests:
storage: {{.DindStorageSizeInGiB}}Gi
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: dind
namespace: {{.Namespace}}
labels:
app.kubernetes.io/component: dind
app.kubernetes.io/name: zadig
spec:
ports:
- name: dind
protocol: TCP
port: 2375
targetPort: 2375
clusterIP: None
selector:
app.kubernetes.io/component: dind
app.kubernetes.io/name: zadig
`))
Functions ¶
func ApplyUpdatedAnnotations ¶
func CalculateContainer ¶
func CalculateContainer(productSvc *commonmodels.ProductService, curUsedSvc *commonmodels.Service, latestContainers []*models.Container, productInfo *commonmodels.Product) []*models.Container
CalculateContainer calculates containers to be applied into environments for helm and k8s projects if image has no change since last deploy, containers in latest service will be used if image hse been change since lase deploy (eg. workflow), current values will be remained
func CheckIstiodInstalled ¶
func CheckReleaseInstalledByOtherEnv ¶
func CheckReleaseInstalledByOtherEnv(releaseNames sets.String, productInfo *commonmodels.Product) error
func CheckResourceAppliedByOtherEnv ¶
func CheckResourceAppliedByOtherEnv(serviceYaml string, productInfo *commonmodels.Product, serviceName string) error
func CreateNamespace ¶
func CreateOrPatchResource ¶
func CreateOrPatchResource(applyParam *ResourceApplyParam, log *zap.SugaredLogger) ([]*unstructured.Unstructured, error)
CreateOrPatchResource create or patch resources defined in UpdateResourceYaml `CurrentResourceYaml` will be used to determine if some resources will be deleted
func CreateOrUpdateDefaultRegistrySecret ¶
func CreateOrUpdateDefaultRegistrySecret(namespace string, reg *commonmodels.RegistryNamespace, kubeClient client.Client) error
func CreateOrUpdateRSASecret ¶
func CreateOrUpdateRegistrySecret ¶
func CreateOrUpdateRegistrySecret(namespace string, reg *commonmodels.RegistryNamespace, isDefault bool, kubeClient client.Client) error
func DeleteEnvoyFilter ¶ added in v2.3.0
func DeleteHelmReleaseFromEnv ¶
func DeleteHelmReleaseFromEnv(userName, requestID string, productInfo *commonmodels.Product, releaseNames []string, log *zap.SugaredLogger) error
1. Uninstall related resources 2. Delete service info from database
func DeleteHelmServiceFromEnv ¶
func DeleteHelmServiceFromEnv(userName, requestID string, productInfo *commonmodels.Product, serviceNames []string, log *zap.SugaredLogger) error
DeleteHelmServiceFromEnv deletes the service from the environment 1. Uninstall related resources 2. Delete service info from database
func DeploymentSelectorLabelExists ¶
func DeploymentSelectorLabelExists(resourceName, namespace string, informer informers.SharedInformerFactory, log *zap.SugaredLogger) bool
func EnsureCleanRouteInBase ¶ added in v2.3.0
func EnsureDefaultK8sServiceInGray ¶ added in v2.3.0
func EnsureDefaultVirtualServiceInGray ¶ added in v2.3.0
func EnsureDeleteK8sService ¶
func EnsureDeletePreCreatedServices ¶
func EnsureDeletePreCreatedServices(ctx context.Context, productName, namespace string, chartSpec *helmclient.ChartSpec, helmClient *helmtool.HelmClient) error
func EnsureDeleteZadigService ¶ added in v2.3.0
func EnsureDeleteZadigServiceByHelmRelease ¶
func EnsureDeleteZadigServiceByHelmRelease(ctx context.Context, env *commonmodels.Product, releaseName string, helmClient helmclient.Client) error
func EnsureDeleteZadigServiceBySvcName ¶
func EnsureDeleteZadigServiceBySvcName(ctx context.Context, env *commonmodels.Product, svcName string, kclient client.Client, istioClient versionedclient.Interface) error
func EnsureEnvoyFilter ¶ added in v2.3.0
func EnsureFullPathGrayScaleConfig ¶
func EnsureFullPathGrayScaleConfig(ctx context.Context, env *commonmodels.Product, kclient client.Client, istioClient versionedclient.Interface) error
Used when create a gray environment
func EnsureGrayEnvConfig ¶
func EnsureGrayEnvConfig(ctx context.Context, env *commonmodels.Product, kclient client.Client, istioClient versionedclient.Interface) error
func EnsureNamespaceLabels ¶
func EnsureUpdateGrayscaleService ¶
func EnsureUpdateGrayscaleService(ctx context.Context, env *commonmodels.Product, svcName string, kclient client.Client, istioClient versionedclient.Interface) error
Used when add service to env
func EnsureUpdateZadigSerivce ¶ added in v2.3.0
func EnsureUpdateZadigService ¶
func EnsureUpdateZadigService(ctx context.Context, env *commonmodels.Product, svcName string, kclient client.Client, istioClient versionedclient.Interface) error
func EnsureVirtualService ¶ added in v2.3.0
func FetchCurrentAppliedYaml ¶
func FetchCurrentAppliedYaml(option *GeneSvcYamlOption) (string, int, error)
FetchCurrentAppliedYaml generates full yaml of some service currently applied in Zadig and returns the service yaml, currently used service revision
func FetchSelectedWorkloads ¶
func FetchSelectedWorkloads(namespace string, Resource []*WorkloadResource, kubeclient crClient.Client, clientSet *kubernetes.Clientset) ([]*appsv1.Deployment, []*appsv1.StatefulSet, []*batchv1.CronJob, []*batchv1beta1.CronJob, error)
func FetchSubEnvs ¶ added in v2.3.0
func GenRegistrySecretName ¶
func GenRegistrySecretName(reg *commonmodels.RegistryNamespace) (string, error)
func GenVirtualServiceName ¶ added in v2.3.0
func GeneKVFromYaml ¶
func GeneKVFromYaml(yamlContent string) ([]*commonmodels.VariableKV, error)
func GeneMergedValues ¶
func GeneMergedValues(productSvc *commonmodels.ProductService, svcRender *templatemodels.ServiceRender, defaultValues string, images []string, fullValues bool) (string, error)
GeneMergedValues generate values.yaml used to install or upgrade helm chart, like param in after option -f If fullValues is set to true, full values yaml content will be returned, this case is used to preview values when running workflows
func GenerateYamlFromKV ¶
func GenerateYamlFromKV(kvs []*commonmodels.VariableKV) (string, error)
func GetClientset ¶
func GetClientset(clusterID string) (kubernetes.Interface, error)
GetClientset returns a client to interact with APIServer which implements kubernetes.Interface
func GetDirtyResources ¶
GetDirtyResources searches for dirty active resources in the given namespace, and return their metadata.
func GetPredefinedLabels ¶
func GetSelectedPodsInfo ¶
func GetSelectedPodsInfo(selector labels.Selector, informer informers.SharedInformerFactory, currentImages []string, log *zap.SugaredLogger) (string, string, []string)
func GetValidGVK ¶
func GetValidGVK(gvk schema.GroupVersionKind, version *version.Info) schema.GroupVersionKind
in kubernetes 1.21+, CronJobV1BetaGVK is deprecated, so we should use CronJobGVK instead
func InitializeExternalCluster ¶
InitializeExternalCluster initialized the resources in the cluster for zadig to run correctly. if the cluster is of type kubeconfig, we need to create following resource: Namespace: koderover-agent Service: dind StatefulSet: dind
func InstallOrUpgradeHelmChartWithValues ¶
func InstallOrUpgradeHelmChartWithValues(param *ReleaseInstallParam, isRetry bool, helmClient *helmtool.HelmClient) error
func MakeSafeLabelValue ¶
func ManifestToResource ¶
func ManifestToResource(manifest string) ([]*commonmodels.ServiceResource, error)
func ManifestToUnstructured ¶
func ManifestToUnstructured(manifest string) ([]*unstructured.Unstructured, error)
func ParseSysKeys ¶
ParseSysKeys 渲染系统变量键值
func PrepareHelmServiceData ¶
func PrepareHelmServiceData(applyParam *ResourceApplyParam) (*commonmodels.ProductService, *commonmodels.Service, error)
func RemoveClusterResources ¶
RemoveClusterResources Removes all the resources in the koderover-agent namespace along with the namespace itself
func RemoveHelmResource ¶
func RemoveHelmResource(applyParam *ResourceApplyParam, log *zap.SugaredLogger) error
RemoveHelmResource create or patch helm services if service is not deployed ever, it will be added into target environment database will also be updated
func RenderEnvService ¶
func RenderEnvService(prod *commonmodels.Product, serviceRender *template.ServiceRender, service *commonmodels.ProductService) (yaml string, err error)
RenderEnvService renders service with particular revision and service vars in environment
func RenderEnvServiceWithTempl ¶
func RenderEnvServiceWithTempl(prod *commonmodels.Product, serviceRender *template.ServiceRender, service *commonmodels.ProductService, svcTmpl *commonmodels.Service) (yaml string, err error)
func RenderServiceYaml ¶
func RenderServiceYaml(originYaml, productName, serviceName string, svcRender *template.ServiceRender) (string, error)
func SetFieldValueIsNotExist ¶
func SetIstioGrayscaleConfig ¶ added in v2.3.0
func SetIstioGrayscaleConfig(ctx context.Context, envName, productName string, req SetIstioGrayscaleConfigRequest) error
func SetIstioGrayscaleHeaderMatch ¶
func SetIstioGrayscaleHeaderMatch(ctx context.Context, envMap map[string]*commonmodels.Product, headerMatchConfigs []commonmodels.IstioHeaderMatchConfig) error
func SetIstioGrayscaleWeight ¶
func SetIstioGrayscaleWeight(ctx context.Context, envMap map[string]*commonmodels.Product, weightConfigs []commonmodels.IstioWeightConfig) error
func StatefulsetSelectorLabelExists ¶
func StatefulsetSelectorLabelExists(resourceName, namespace string, informer informers.SharedInformerFactory, log *zap.SugaredLogger) bool
func UninstallRelease ¶
func UninstallRelease(helmClient helmclient.Client, env *commonmodels.Product, releaseName string, force bool) error
UninstallService uninstall release deployed by zadig
func UninstallService ¶
func UninstallService(helmClient helmclient.Client, env *commonmodels.Product, revisionSvc *commonmodels.Service, force bool) error
UninstallService uninstall release deployed by zadig
func UninstallServiceByName ¶
func UninstallServiceByName(helmClient helmclient.Client, serviceName string, env *commonmodels.Product, revision int64, force bool) error
func UnstructuredToResources ¶
func UnstructuredToResources(unstructured []*unstructured.Unstructured) []*commonmodels.ServiceResource
func UpgradeHelmRelease ¶
func UpgradeHelmRelease(product *commonmodels.Product, productSvc *commonmodels.ProductService, svcTemp *commonmodels.Service, images []string, timeout int, user string) error
@todo merge with proceedHelmRelease UpgradeHelmRelease upgrades helm release with some specific images
func ValidateClusterRoleYAML ¶
func ValidateClusterRoleYAML(k8sYaml string, logger *zap.SugaredLogger) error
Types ¶
type EnvoyAddress ¶
type EnvoyAddress struct {
SocketAddress EnvoySocketAddress `json:"socket_address"`
}
type EnvoyClusterConfigLoadAssignment ¶
type EnvoyClusterConfigLoadAssignment struct { ClusterName string `json:"cluster_name"` Endpoints []EnvoyLBEndpoints `json:"endpoints"` }
type EnvoyEndpoint ¶
type EnvoyEndpoint struct {
Address EnvoyAddress `json:"address"`
}
type EnvoyEndpoints ¶
type EnvoyEndpoints struct {
Endpoint EnvoyEndpoint `json:"endpoint"`
}
type EnvoyLBEndpoints ¶
type EnvoyLBEndpoints struct {
LBEndpoints []EnvoyEndpoints `json:"lb_endpoints"`
}
type EnvoySocketAddress ¶
type GeneSvcYamlOption ¶
type GeneSvcYamlOption struct { ProductName string EnvName string ServiceName string UpdateServiceRevision bool VariableYaml string VariableKVs []*commontypes.RenderVariableKV UnInstall bool Containers []*models.Container }
type IstioGrayscaleEnvHandler ¶
type IstioGrayscaleEnvHandler func(context.Context, *commonmodels.Product, string, client.Client, versionedclient.Interface) error
type MatchedEnv ¶
type ReleaseInstallParam ¶
type ReleaseInstallParam struct { ProductName string Namespace string ReleaseName string MergedValues string IsChartInstall bool RenderChart *templatemodels.ServiceRender ServiceObj *commonmodels.Service ProdService *commonmodels.ProductService Timeout int DryRun bool Production bool }
type ResourceApplyParam ¶
type ResourceApplyParam struct { ProductInfo *commonmodels.Product ServiceName string ServiceList []string // used for batch operations CurrentResourceYaml string UpdateResourceYaml string // used for helm services Images []string // all images need to be updated, used for helm services VariableYaml string // variables Timeout int // timeout for helm services UpdateServiceRevision bool Informer informers.SharedInformerFactory KubeClient client.Client IstioClient versionedclient.Interface AddZadigLabel bool InjectSecrets bool IstioGrayscaleEnvHandler IstioGrayscaleEnvHandler Uninstall bool WaitForUninstall bool }
type Service ¶
type Service struct { *multicluster.Agent // contains filtered or unexported fields }
func NewService ¶
func (*Service) CreateCluster ¶
func (s *Service) CreateCluster(cluster *models.K8SCluster, id string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
func (*Service) DeleteCluster ¶
func (*Service) GetCluster ¶
func (s *Service) GetCluster(id string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
func (*Service) GetClusterByToken ¶
func (s *Service) GetClusterByToken(token string, logger *zap.SugaredLogger) (*models.K8SCluster, error)
func (*Service) ListClusters ¶
func (s *Service) ListClusters(clusterType string, logger *zap.SugaredLogger) ([]*models.K8SCluster, error)
func (*Service) ListConnectedClusters ¶
func (s *Service) ListConnectedClusters(logger *zap.SugaredLogger) ([]*models.K8SCluster, error)
func (*Service) UpdateCluster ¶
func (s *Service) UpdateCluster(id string, cluster *models.K8SCluster, logger *zap.SugaredLogger) (*models.K8SCluster, error)
func (*Service) UpdateUpgradeAgentInfo ¶
type SetIstioGrayscaleConfigRequest ¶ added in v2.3.0
type SetIstioGrayscaleConfigRequest struct { GrayscaleStrategy commonmodels.GrayscaleStrategyType `bson:"grayscale_strategy" json:"grayscale_strategy"` WeightConfigs []commonmodels.IstioWeightConfig `bson:"weight_configs" json:"weight_configs"` HeaderMatchConfigs []commonmodels.IstioHeaderMatchConfig `bson:"header_match_configs" json:"header_match_configs"` }
type ShareEnvReady ¶
type ShareEnvReady struct {}
func (*ShareEnvReady) CheckAndSetReady ¶
func (s *ShareEnvReady) CheckAndSetReady(state ShareEnvOp)
Note: `WorkloadsHaveK8sService` is an optional condition.
type ShareEnvReadyChecks ¶
type ShareEnvReadyChecks struct {}
type SharedEnvHandler ¶
type SharedEnvHandler func(context.Context, *commonmodels.Product, string, client.Client, versionedclient.Interface) error
type TemplateSchema ¶
type TemplateSchema struct { HubAgentImage string ClientToken string HubServerBaseAddr string Namespace string UseDeployment bool AslanBaseAddr string DindReplicas int DindLimitsCPU string DindLimitsMemory string DindImage string DindEnablePV bool DindStorageClassName string DindStorageSizeInGiB int ScheduleWorkflow bool }
type WorkloadResource ¶
func GenerateRenderedYaml ¶
func GenerateRenderedYaml(option *GeneSvcYamlOption) (string, int, []*WorkloadResource, error)
GenerateRenderedYaml generates full yaml of some service defined in Zadig (images not included) and returns the service yaml, used service revision
func ReplaceWorkloadImages ¶
func ReplaceWorkloadImages(rawYaml string, images []*commonmodels.Container) (string, []*WorkloadResource, error)
ReplaceWorkloadImages replace images in yaml with new images