Skip to content

Latest commit

 

History

History
331 lines (326 loc) · 8.16 KB

File metadata and controls

331 lines (326 loc) · 8.16 KB

Environments

create a go-lang environment

  • builder: image for builder
  • image: image for runtime
fission env create --name go \
    --builder fission/go-builder-1.16 \
    --image fission/go-env-1.16 \
    --mincpu 100 --maxcpu 4000 \
    --minmemory 102 --maxmemory 2048 \
    --poolsize 3 \
    --version 3

check the env

please note the resourceVersion of env, the builder is based on a specified resourceVersion

kubectl get environment go -oyaml
apiVersion: fission.io/v1
kind: Environment
metadata:
  name: go
  namespace: default
  resourceVersion: "254706"
spec:
  builder:
    command: build
    container:
      name: ""
      resources: {}
    image: fission/go-builder-1.16
  imagepullsecret: ""
  keeparchive: false
  poolsize: 3
  resources:
    limits:
      cpu: "4"
      memory: 2Gi
    requests:
      cpu: 100m
      memory: 1Gi
  runtime:
    container:
      name: ""
      resources: {}
    image: fission/go-env-1.16
  version: 2

check builder

  • The resourceVersion of environment is part of the builder deployment name
  • A builder pod is composed by env builder, which is to build the source, and fetcher, which is to retrieve code. The two containers share the same sharedVolume
kubectl get deployment go-254706 -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-254706
  namespace: fission-builder
spec:
  replicas: 1
  selector:
    matchLabels:
      envName: go
      envNamespace: fission-builder
      envResourceVersion: "254706"
      owner: buildermgr
  template:
    metadata:
      creationTimestamp: null
      labels:
        envName: go
        envNamespace: fission-builder
        envResourceVersion: "254706"
        owner: buildermgr
    spec:
      containers:
      - command:
        - /builder
        - /packages
        image: fission/go-builder-1.16
        imagePullPolicy: IfNotPresent
        name: builder
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8001
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 2
          successThreshold: 1
          timeoutSeconds: 1
        volumeMounts:
        - mountPath: /packages
          name: userfunc
        - mountPath: /secrets
          name: secrets
        - mountPath: /configs
          name: configmaps
        - mountPath: /etc/podinfo
          name: podinfo
      - command:
        - /fetcher
        - -secret-dir
        - /secrets
        - -cfgmap-dir
        - /configs
        - /packages
        env:
        - name: OTEL_PROPAGATORS
          value: tracecontext,baggage
        - name: OTEL_EXPORTER_OTLP_ENDPOINT
        - name: OTEL_TRACES_SAMPLER
          value: parentbased_traceidratio
        - name: OTEL_TRACES_SAMPLER_ARG
          value: "0.1"
        - name: OTEL_EXPORTER_OTLP_INSECURE
          value: "true"
        image: fission/fetcher:v1.17.0
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 1
        name: fetcher
        readinessProbe:
          failureThreshold: 30
          httpGet:
            path: /readiness-healthz
            port: 8000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 10m
            memory: 16Mi
        volumeMounts:
        - mountPath: /packages
          name: userfunc
        - mountPath: /secrets
          name: secrets
        - mountPath: /configs
          name: configmaps
        - mountPath: /etc/podinfo
          name: podinfo
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: fission-builder
      serviceAccountName: fission-builder
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: userfunc
      - emptyDir: {}
        name: secrets
      - emptyDir: {}
        name: configmaps
      - downwardAPI:
          defaultMode: 420
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
            path: name
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
        name: podinfo

check poolmgr

Same as builder

  • The resourceVersion of environment is part of the poolmgr deployment name
  • A poolmgr pod is composed by env container, which is to run the code, and fetcher, which is to retrieve package. The two containers share the same sharedVolume
kff get deploy poolmgr-go-default-254706
apiVersion: apps/v1
kind: Deployment
metadata:
  name: poolmgr-go-default-254706
  namespace: fission-function
spec:
  replicas: 3
  selector:
    matchLabels:
      environmentName: go
      environmentNamespace: default
      environmentUid: b5b114ae-d0ff-4fdc-8a5d-baa118e560fb
      executorType: poolmgr
      managed: "true"
  template:
    metadata:
      creationTimestamp: null
      labels:
        environmentName: go
        environmentNamespace: default
        environmentUid: b5b114ae-d0ff-4fdc-8a5d-baa118e560fb
        executorType: poolmgr
        managed: "true"
    spec:
      containers:
      - image: fission/go-env-1.16
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/sleep
              - "360"
        name: go
        ports:
        - containerPort: 8000
          name: http-fetcher
          protocol: TCP
        - containerPort: 8888
          name: http-env
          protocol: TCP
        resources:
          limits:
            cpu: "4"
            memory: 2Gi
          requests:
            cpu: 100m
            memory: 1Gi
        volumeMounts:
        - mountPath: /userfunc
          name: userfunc
        - mountPath: /secrets
          name: secrets
        - mountPath: /configs
          name: configmaps
        - mountPath: /etc/podinfo
          name: podinfo
      - command:
        - /fetcher
        - -secret-dir
        - /secrets
        - -cfgmap-dir
        - /configs
        - /userfunc
        env:
        - name: OTEL_EXPORTER_OTLP_INSECURE
          value: "true"
        - name: OTEL_TRACES_SAMPLER
          value: parentbased_traceidratio
        - name: OTEL_PROPAGATORS
          value: tracecontext,baggage
        - name: OTEL_EXPORTER_OTLP_ENDPOINT
        - name: OTEL_TRACES_SAMPLER_ARG
          value: "0.1"
        image: fission/fetcher:v1.17.0
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/sleep
              - "360"
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 1
        name: fetcher
        resources:
          requests:
            cpu: 10m
            memory: 16Mi
        volumeMounts:
        - mountPath: /userfunc
          name: userfunc
        - mountPath: /secrets
          name: secrets
        - mountPath: /configs
          name: configmaps
        - mountPath: /etc/podinfo
          name: podinfo
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: fission-fetcher
      serviceAccountName: fission-fetcher
      terminationGracePeriodSeconds: 360
      volumes:
      - emptyDir: {}
        name: userfunc
      - emptyDir: {}
        name: secrets
      - emptyDir: {}
        name: configmaps
      - downwardAPI:
          defaultMode: 420
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
            path: name
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace
        name: podinfo