Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions computer-k8s-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Quick Start

## Install etcd CRD and hugegraph-computer CRD
## Install hugegraph-computer CRD

```bash
kubectl apply -f https://raw.githubusercontent.com/hugegraph/hugegraph-computer/master/computer-k8s-operator/manifest/etcd-operator-crd.v1beta1.yaml
# Kubernetes version >= v1.16
kubectl apply -f https://raw.githubusercontent.com/hugegraph/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1.yaml

# Kubernetes version < v1.16
kubectl apply -f https://raw.githubusercontent.com/hugegraph/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1beta1.yaml
```

Expand All @@ -14,27 +16,23 @@ kubectl apply -f https://raw.githubusercontent.com/hugegraph/hugegraph-computer/
kubectl get crd

NAME CREATED AT
etcdclusters.etcd.database.coreos.com 2021-09-16T08:00:50Z
hugegraphcomputerjobs.hugegraph.baidu.com 2021-09-16T08:01:08Z
```

## Install etcd-operator and hugegraph-computer-operator
## Install hugegraph-computer-operator&etcd-server

```bash
kubectl apply -f https://raw.githubusercontent.com/hugegraph/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-operator.yaml
```

## Wait for operator deployment to complete
## Wait for hugegraph-computer-operator&etcd-server deployment to complete

```bash
kubectl get pod -n hugegraph-computer-operator-system

NAME READY STATUS RESTARTS AGE
hugegraph-computer-operator-controller-manager-58c5545949-jqvzl 1/1 Running 0 15h
hugegraph-computer-operator-etcd-28lm67jxk5 1/1 Running 0 15h
hugegraph-computer-operator-etcd-d42dwrq4ht 1/1 Running 0 15h
hugegraph-computer-operator-etcd-mpcbt5kh2m 1/1 Running 0 15h
hugegraph-computer-operator-etcd-operator-5597f97b4d-lxs98 1/1 Running 0 15h
```

## Submit job
Expand Down
4 changes: 2 additions & 2 deletions computer-k8s-operator/crd-generate/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions={v1,v1beta1}"
# Produce CRDs that work back to Kubernetes 1.20 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions={v1,v1beta1},maxDescLen=0"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ type ComputerJobSpec struct {
SecretPaths map[string]string `json:"secretPaths,omitempty"`

ConfigMapPaths map[string]string `json:"configMapPaths,omitempty"`

//+kubebuilder:validation:Schemaless
//+kubebuilder:pruning:PreserveUnknownFields
// More info: https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates
PodTemplateSpec corev1.PodTemplateSpec `json:"podTemplateSpec,omitempty"`

// More info: https://kubernetes.io/zh/docs/tasks/configure-pod-container/security-context/
SecurityContext corev1.SecurityContext `json:"securityContext,omitempty"`
}

type ComputerJobState struct {
Expand Down
14 changes: 0 additions & 14 deletions computer-k8s-operator/crd-generate/config/etcd/etcd_cluster.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions computer-k8s-operator/crd-generate/config/etcd/etcd_operator.yaml

This file was deleted.

85 changes: 85 additions & 0 deletions computer-k8s-operator/crd-generate/config/etcd/etcd_server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: v1
kind: Service
metadata:
labels:
service.app: hugegraph-computer-operator-etcd
name: etcd
namespace: system
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true'
spec:
ports:
- name: client
port: 2379
protocol: TCP
targetPort: 2379
- name: peer
port: 2380
protocol: TCP
targetPort: 2380
selector:
service.app: hugegraph-computer-operator-etcd
clusterIP: None
type: ClusterIP
sessionAffinity: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: etcd
namespace: system
spec:
replicas: 1
selector:
matchLabels:
service.app: hugegraph-computer-operator-etcd
template:
metadata:
labels:
service.app: hugegraph-computer-operator-etcd
spec:
hostname: hugegraph-computer-operator-etcd-0
subdomain: hugegraph-computer-operator-etcd
containers:
- name: hugegraph-computer-operator-etcd
image: etcd:latest
command:
- /bin/sh
- -ec
- |
HOSTNAME=$(hostname)
etcd --name ${HOSTNAME} \
--data-dir /var/etcd/data \
--initial-advertise-peer-urls http://${HOSTNAME}.hugegraph-computer-operator-etcd.hugegraph-computer-operator-system:2380 \
--listen-peer-urls http://0.0.0.0:2380 \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://${HOSTNAME}.hugegraph-computer-operator-etcd.hugegraph-computer-operator-system:2379 \
--initial-cluster ${HOSTNAME}=http://${HOSTNAME}.hugegraph-computer-operator-etcd.hugegraph-computer-operator-system:2380 \
--initial-cluster-state new
ports:
- name: client
containerPort: 2379
- name: peer
containerPort: 2380
livenessProbe:
exec:
command:
- /bin/sh
- '-ec'
- ETCDCTL_API=3 etcdctl endpoint status
initialDelaySeconds: 10
timeoutSeconds: 10
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- /bin/sh
- '-ec'
- ETCDCTL_API=3 etcdctl endpoint status
initialDelaySeconds: 1
timeoutSeconds: 5
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
resources:
- etcd_operator.yaml
- etcd_cluster.yaml
- etcd_server.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: etcd-operator
newName: quay.io/coreos/etcd-operator
newTag: v0.9.4
- name: etcd
newName: quay.io/coreos/etcd
newTag: v3.5.0
commonLabels:
app.kubernetes.io/name: hugegraph-computer-operator-etcd
app.kubernetes.io/version: v1

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ resources:
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
#- auth_proxy_service.yaml
#- auth_proxy_role.yaml
#- auth_proxy_role_binding.yaml
#- auth_proxy_client_clusterrole.yaml
- etcd_operator_role.yaml
- etcd_operator_role_binding.yaml

commonLabels:
app.kubernetes.io/name: hugegraph-computer-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ kind: ServiceAccount
metadata:
name: controller-manager
namespace: system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: etcd-operator
namespace: system
6 changes: 0 additions & 6 deletions computer-k8s-operator/crd-generate/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ go 1.16

require (
github.com/fabric8io/kubernetes-client/generator v0.0.0-20210604075820-b0890fa05358
github.com/go-logr/logr v0.3.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/client-go v0.20.2
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
sigs.k8s.io/controller-runtime v0.8.3
)

Expand Down
Loading