Browse Source

Add build files for crd, gm, lc, worker

Signed-off-by: llhuii <liulinghui@huawei.com>
tags/v0.1.0
llhuii 4 years ago
parent
commit
1f03488434
12 changed files with 493 additions and 0 deletions
  1. +8
    -0
      build/crd-samples/neptune/dataset_v1alpha1.yaml
  2. +31
    -0
      build/crd-samples/neptune/jointinferenceservice_v1alpha1.yaml
  3. +7
    -0
      build/crd-samples/neptune/model_v1alpha1.yaml
  4. +56
    -0
      build/crds/neptune/dataset_v1alpha1.yaml
  5. +194
    -0
      build/crds/neptune/jointinferenceservice_v1alpha1.yaml
  6. +57
    -0
      build/crds/neptune/model_v1alpha1.yaml
  7. +20
    -0
      build/gm/Dockerfile
  8. +10
    -0
      build/gm/gm-config.yaml
  9. +61
    -0
      build/gm/rbac/neptune-roles.yaml
  10. +12
    -0
      build/gm/rbac/role_binding.yaml
  11. +24
    -0
      build/lc/Dockerfile
  12. +13
    -0
      build/worker/base_images/tensorflow/tensorflow-1.15.Dockerfile

+ 8
- 0
build/crd-samples/neptune/dataset_v1alpha1.yaml View File

@@ -0,0 +1,8 @@
apiVersion: neptune.io/v1alpha1
kind: Dataset
metadata:
name: "dataset-demo0"
spec:
url: "/code/data/train.txt"
format: "txt"
nodeName: "edge0"

+ 31
- 0
build/crd-samples/neptune/jointinferenceservice_v1alpha1.yaml View File

@@ -0,0 +1,31 @@
apiVersion: neptune.io/v1alpha1
kind: JointInferenceService
metadata:
name: example
spec:
edgeWorker:
model:
name: "small-model"
nodeName: "edge0"
hardExampleAlgorithm:
name: "IBT"
workerSpec:
scriptDir: "/code"
scriptBootFile: "edge_inference.py"
frameworkType: "tensorflow"
frameworkVersion: "1.18"
parameters:
- key: "nms_threshold"
value: "0.6"
cloudWorker:
model:
name: "big-model"
nodeName: "solar-corona-cloud"
workerSpec:
scriptDir: "/code"
scriptBootFile: "cloud_inference.py"
frameworkType: "tensorflow"
frameworkVersion: "1.18"
parameters:
- key: "nms_threshold"
value: "0.6"

+ 7
- 0
build/crd-samples/neptune/model_v1alpha1.yaml View File

@@ -0,0 +1,7 @@
apiVersion: neptune.io/v1alpha1
kind: Model
metadata:
name: model-demo1
spec:
url: "/model/frozen.pb"
format: "ckpt"

+ 56
- 0
build/crds/neptune/dataset_v1alpha1.yaml View File

@@ -0,0 +1,56 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: datasets.neptune.io
spec:
group: neptune.io
names:
kind: Dataset
plural: datasets
scope: Namespaced
versions:
- name: v1alpha1
subresources:
# status enables the status subresource.
status: {}
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required:
- url
- format
properties:
url:
type: string
format:
type: string
nodeName:
type: string
status:
type: object
properties:
numberOfSamples:
type: integer
updateTime:
type: string
format: datatime


additionalPrinterColumns:
- name: NumberOfSamples
type: integer
description: The number of samples in the dataset
jsonPath: ".status.numberOfSamples"
- name: Node
type: string
description: The node name of the dataset
jsonPath: ".spec.nodeName"
- name: spec
type: string
description: The spec of the dataset
jsonPath: ".spec"

+ 194
- 0
build/crds/neptune/jointinferenceservice_v1alpha1.yaml View File

@@ -0,0 +1,194 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: jointinferenceservices.neptune.io
spec:
group: neptune.io
names:
kind: JointInferenceService
plural: jointinferenceservices
shortNames:
- jointinferenceservice
- jis
scope: Namespaced
versions:
- name: v1alpha1
subresources:
# status enables the status subresource.
status: {}
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required:
- edgeWorker
- cloudWorker
properties:
edgeWorker:
type: object
required:
- model
- nodeName
- hardExampleAlgorithm
- workerSpec
properties:
model:
type: object
required:
- name
properties:
name:
type: string
nodeName:
type: string
hardExampleAlgorithm:
type: object
required:
- name
properties:
name:
type: string
parameters:
type: array
items:
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
workerSpec:
type: object
required:
- scriptDir
- scriptBootFile
- frameworkType
- frameworkVersion
properties:
scriptDir:
type: string
scriptBootFile:
type: string
frameworkType:
type: string
frameworkVersion:
type: string
parameters:
type: array
items:
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
cloudWorker:
type: object
required:
- model
- nodeName
- workerSpec
properties:
model:
type: object
required:
- name
properties:
name:
type: string
nodeName:
type: string
workerSpec:
type: object
required:
- scriptDir
- scriptBootFile
- frameworkType
- frameworkVersion
properties:
scriptDir:
type: string
scriptBootFile:
type: string
frameworkType:
type: string
frameworkVersion:
type: string
parameters:
type: array
items:
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
status:
type: object
properties:
conditions:
type: array
items:
type: object
properties:
type:
type: string
status:
type: string
lastHeartbeatTime:
type: string
format: date-time
lastTransitionTime:
type: string
format: date-time
reason:
type: string
message:
type: string
startTime:
type: string
format: date-time
active:
type: integer
failed:
type: integer
metrics:
type: array
items:
type: object
properties:
key:
type: string
value:
type: string


additionalPrinterColumns:
- name: status
type: string
description: The status of the jointinference service
jsonPath: ".status.conditions[-1].type"
- name: active
type: integer
description: The number of active worker
jsonPath: ".status.active"
- name: failed
type: integer
description: The number of failed worker
jsonPath: ".status.failed"
- name: Age
type: date
jsonPath: .metadata.creationTimestamp

+ 57
- 0
build/crds/neptune/model_v1alpha1.yaml View File

@@ -0,0 +1,57 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: models.neptune.io
spec:
group: neptune.io
names:
kind: Model
plural: models
scope: Namespaced
versions:
- name: v1alpha1
subresources:
# status enables the status subresource.
status: {}
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required:
- url
- format
properties:
url:
type: string
format:
type: string
status:
type: object
properties:
updateTime:
type: string
format: datetime
metrics:
type: array
items:
type: object
properties:
key:
type: string
value:
type: string


additionalPrinterColumns:
- name: updateAGE
type: date
description: The update age
jsonPath: ".status.updateTime"
- name: metrics
type: string
description: The metrics
jsonPath: ".status.metrics"

+ 20
- 0
build/gm/Dockerfile View File

@@ -0,0 +1,20 @@
FROM golang:1.14-alpine3.11 AS builder

ARG GO_LDFLAGS

WORKDIR /code

# copy source
COPY . .

RUN CGO_ENABLED=0 go build -o /usr/local/bin/neptune-gm -ldflags "$GO_LDFLAGS -w -s" \
cmd/neptune-gm/neptune-gm.go


FROM alpine:3.11

COPY --from=builder /usr/local/bin/neptune-gm /usr/local/bin/neptune-gm

COPY build/gm/gm-config.yaml /gm.yaml

CMD ["neptune-gm", "--config", "/gm.yaml"]

+ 10
- 0
build/gm/gm-config.yaml View File

@@ -0,0 +1,10 @@
kubeConfig: /root/.kube/config
master: ""
namespace: default
imageHub:
"tensorflow:1.15": "docker.io/neptune/tensorflow-base-image-to-filled:1.15"
websocket:
address: 0.0.0.0
port: 9000
localController:
server: http://localhost:9100

+ 61
- 0
build/gm/rbac/neptune-roles.yaml View File

@@ -0,0 +1,61 @@
# permissions for end users to edit memcacheds.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: neptune-role
rules:
# list/watch these ai-feature crds
- apiGroups:
- neptune.io
resources:
- datasets
- models
- jointinferenceservices
verbs:
- get
- list
- watch

# update crd status
- apiGroups:
- neptune.io
resources:
- datasets/status
- models/status
- jointinferenceservices/status
verbs:
- get
- update

# current we implement ai features by k8s pods, services
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- get
- list
- watch

- apiGroups:
- ""
resources:
- services
verbs:
- create
- get

- apiGroups:
- ""
resources:
- nodes
verbs:
- get

- apiGroups:
- ""
resources:
- events
verbs:
- create

+ 12
- 0
build/gm/rbac/role_binding.yaml View File

@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: neptune-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: neptune-role
subjects:
- kind: ServiceAccount
name: default
namespace: default

+ 24
- 0
build/lc/Dockerfile View File

@@ -0,0 +1,24 @@
FROM golang:1.14-alpine3.11 AS builder

ARG PROXY

COPY . /code
WORKDIR /code


RUN if [ ! "$PROXY" = "" ]; then sed -i "s@http://dl-cdn.alpinelinux.org@$PROXY@g" /etc/apk/repositories ; fi

RUN apk update
RUN apk add build-base

RUN GOOS=linux go build -o /usr/local/bin/neptune-lc cmd/neptune-lc/neptune-lc.go

FROM alpine:3.11

COPY --from=builder /usr/local/bin/neptune-lc /usr/local/bin/neptune-lc

CMD ["neptune-lc"]





+ 13
- 0
build/worker/base_images/tensorflow/tensorflow-1.15.Dockerfile View File

@@ -0,0 +1,13 @@
FROM tensorflow/tensorflow:1.15.4

RUN apt update \
&& apt install -y libgl1-mesa-glx
COPY ./lib/requirements.txt /home
RUN pip install -r /home/requirements.txt

ENV PYTHONPATH "/home/lib"

WORKDIR /home/work
COPY ./lib /home/lib

ENTRYPOINT ["python"]

Loading…
Cancel
Save