kube

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 80 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameSpaceRegexString   = "[^a-z0-9.-]"
	DefaultNameRegexString = "^[a-zA-Z0-9-_]{1,50}$"
)
View Source
const (
	DefaultDindReplicas         int                          = 1
	DefaultDindLimitsCPU        int                          = 4000
	DefaultDindLimitsMemory     int                          = 8192
	DefaultDindStorageType      commonmodels.DindStorageType = commonmodels.DindStorageRootfs
	DefaultDindEnablePV         bool                         = false
	DefaultDindStorageClassName string                       = ""
	DefaultDindStorageSizeInGiB int                          = 10
)

Variables

View Source
var ClusterAccessYamlTemplate = `` /* 210-byte string literal not displayed */
View Source
var WorkflowResourceYaml = `` /* 2496-byte string literal not displayed */
View Source
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 ApplySystemImagePullSecrets

func ApplySystemImagePullSecrets(podSpec *corev1.PodSpec)

func ApplyUpdatedAnnotations

func ApplyUpdatedAnnotations(annotations map[string]string) map[string]string

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 CheckIstiodInstalled(ctx context.Context, clientset *kubernetes.Clientset) (bool, error)

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 CreateNamespace(namespace string, customLabels map[string]string, enableIstioInjection bool, kubeClient client.Client) error

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 CreateOrUpdateRSASecret(publicKey, privateKey []byte, kubeClient client.Client) error

func CreateOrUpdateRegistrySecret

func CreateOrUpdateRegistrySecret(namespace string, reg *commonmodels.RegistryNamespace, isDefault bool, kubeClient client.Client) error

func DeleteEnvoyFilter added in v2.3.0

func DeleteEnvoyFilter(ctx context.Context, istioClient versionedclient.Interface, istioNamespace, name string) error

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 EnsureCleanRouteInBase(ctx context.Context, envName, baseNS, vsName string, istioClient versionedclient.Interface) error

func EnsureDefaultK8sServiceInGray added in v2.3.0

func EnsureDefaultK8sServiceInGray(ctx context.Context, baseSvc *corev1.Service, grayNS string, kclient client.Client) error

func EnsureDefaultVirtualServiceInGray added in v2.3.0

func EnsureDefaultVirtualServiceInGray(ctx context.Context, baseSvc *corev1.Service, grayNS, baseNS string, istioClient versionedclient.Interface) error

func EnsureDeleteGrayscaleService

func EnsureDeleteGrayscaleService(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, kclient client.Client, istioClient versionedclient.Interface) error

func EnsureDeleteK8sService

func EnsureDeleteK8sService(ctx context.Context, ns, svcName string, kclient client.Client, systemCreatedOnly bool) error

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 EnsureDeleteZadigService(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, kclient client.Client, istioClient versionedclient.Interface) error

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 EnsureEnvoyFilter(ctx context.Context, istioClient versionedclient.Interface, clusterID, ns, name string, headerKeys []string) error

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 EnsureNamespaceLabels(namespace string, customLabels map[string]string, kubeClient client.Client) error

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 EnsureUpdateZadigSerivce(ctx context.Context, env *commonmodels.Product, svc *corev1.Service, kclient client.Client, istioClient versionedclient.Interface) error

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 EnsureVirtualService(ctx context.Context, kclient client.Client, istioClient versionedclient.Interface, env *commonmodels.Product, svc *corev1.Service, vsName string) error

func EnsureZadigServiceByManifest

func EnsureZadigServiceByManifest(ctx context.Context, productName, namespace, manifest string) error

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 FetchSubEnvs(ctx context.Context, productName, clusterID, baseEnvName string) ([]*commonmodels.Product, error)

func GenRegistrySecretName

func GenRegistrySecretName(reg *commonmodels.RegistryNamespace) (string, error)

func GenVirtualServiceName added in v2.3.0

func GenVirtualServiceName(svc *corev1.Service) string

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

func GetDirtyResources(ns string, kubeClient client.Client) []metav1.Object

GetDirtyResources searches for dirty active resources in the given namespace, and return their metadata.

func GetKubeAPIReader

func GetKubeAPIReader(clusterID string) (client.Reader, error)

func GetPredefinedClusterLabels

func GetPredefinedClusterLabels(product, service, envName string) map[string]string

func GetPredefinedLabels

func GetPredefinedLabels(product, service string) map[string]string

func GetRESTConfig

func GetRESTConfig(clusterID string) (*rest.Config, error)

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

func InitializeExternalCluster(hubserverAddr, clusterID string) error

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 MakeSafeLabelValue(value string) string

func ManifestToResource

func ManifestToResource(manifest string) ([]*commonmodels.ServiceResource, error)

func ManifestToUnstructured

func ManifestToUnstructured(manifest string) ([]*unstructured.Unstructured, error)

func MergeImages

func MergeImages(curContainers []*models.Container, images []string) []string

func MergeLabels

func MergeLabels(from, to map[string]string) map[string]string

func ParseSysKeys

func ParseSysKeys(namespace, envName, productName, serviceName, ori string) string

ParseSysKeys 渲染系统变量键值

func RemoveClusterResources

func RemoveClusterResources(hubserverAddr, clusterID string) error

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 SetFieldValueIsNotExist(obj map[string]interface{}, value interface{}, fields ...string) map[string]interface{}

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 EnvoySocketAddress struct {
	Protocol  string `json:"protocol"`
	Address   string `json:"address"`
	PortValue int    `json:"port_value"`
}

type GeneSvcYamlOption

type GeneSvcYamlOption struct {
	ProductName           string
	EnvName               string
	ServiceName           string
	UpdateServiceRevision bool
	VariableYaml          string
	VariableKVs           []*commontypes.RenderVariableKV
	UnInstall             bool
	Containers            []*models.Container
}

type MatchedEnv

type MatchedEnv struct {
	EnvName   string
	Namespace string
}

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
	SharedEnvHandler         SharedEnvHandler
	IstioGrayscaleEnvHandler IstioGrayscaleEnvHandler
	Uninstall                bool
	WaitForUninstall         bool
}

type Service

type Service struct {
	*multicluster.Agent
	// contains filtered or unexported fields
}

func NewService

func NewService(hubServerAddr string) (*Service, error)

func (*Service) CreateCluster

func (s *Service) CreateCluster(cluster *models.K8SCluster, id string, logger *zap.SugaredLogger) (*models.K8SCluster, error)

func (*Service) DeleteCluster

func (s *Service) DeleteCluster(user string, id string, logger *zap.SugaredLogger) error

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) GetYaml

func (s *Service) GetYaml(id, agentImage, aslanURL, hubURI string, useDeployment bool, logger *zap.SugaredLogger) ([]byte, 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

func (s *Service) UpdateUpgradeAgentInfo(id, updateHubagentErrorMsg string) error

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 ShareEnvOp

type ShareEnvOp string
const (
	ShareEnvEnable  ShareEnvOp = "enable"
	ShareEnvDisable ShareEnvOp = "disable"
)

type ShareEnvReady

type ShareEnvReady struct {
	IsReady bool                `json:"is_ready"`
	Checks  ShareEnvReadyChecks `json:"checks"`
}

func (*ShareEnvReady) CheckAndSetReady

func (s *ShareEnvReady) CheckAndSetReady(state ShareEnvOp)

Note: `WorkloadsHaveK8sService` is an optional condition.

type ShareEnvReadyChecks

type ShareEnvReadyChecks struct {
	NamespaceHasIstioLabel  bool `json:"namespace_has_istio_label"`
	VirtualServicesDeployed bool `json:"virtualservice_deployed"`
	PodsHaveIstioProxy      bool `json:"pods_have_istio_proxy"`
	WorkloadsReady          bool `json:"workloads_ready"`
	WorkloadsHaveK8sService bool `json:"workloads_have_k8s_service"`
}

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

type WorkloadResource struct {
	Type string
	Name string
}

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

Jump to

Keyboard shortcuts

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