Skip to content
Permalink
Browse files
expand some operator function (#179)
  • Loading branch information
coderzc committed Feb 9, 2022
1 parent b895b1a commit 02a9361938320c979aef26be529e93430f7f74ca
Showing 27 changed files with 508 additions and 970 deletions.
@@ -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
```

@@ -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
@@ -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))
@@ -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 {

This file was deleted.

This file was deleted.

@@ -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
@@ -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.

@@ -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
@@ -3,9 +3,3 @@ kind: ServiceAccount
metadata:
name: controller-manager
namespace: system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: etcd-operator
namespace: system
@@ -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
)

0 comments on commit 02a9361

Please sign in to comment.