Skip to content

Instantly share code, notes, and snippets.

@erikbotta
Created April 11, 2019 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikbotta/64730f90168d1f5b69dddedb89915ed3 to your computer and use it in GitHub Desktop.
Save erikbotta/64730f90168d1f5b69dddedb89915ed3 to your computer and use it in GitHub Desktop.
kind: Service
apiVersion: v1
metadata:
name: couchbase
namespace: default
spec:
clusterIP: None
selector:
app: couchbase
sessionAffinity: None
type: ClusterIP
ports:
- name: port8091
protocol: TCP
port: 8091
targetPort: 8091
- name: port8092
protocol: TCP
port: 8092
targetPort: 8092
- name: port8093
protocol: TCP
port: 8093
targetPort: 8093
- name: port8094
protocol: TCP
port: 8094
targetPort: 8094
- name: port8095
protocol: TCP
port: 8095
targetPort: 8095
- name: port8096
protocol: TCP
port: 8096
targetPort: 8096
- name: port11210
protocol: TCP
port: 11210
targetPort: 11210
- name: port11211
protocol: TCP
port: 11211
targetPort: 11211
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
name: couchbase-ui
labels:
app: couchbase-ui
spec:
ports:
- port: 8091
name: couchbase
- port: 8092
name: xdcr-1
- port: 11210
name: xdcr-2
selector:
app: couchbase
sessionAffinity: ClientIP
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: syncgw-service
spec:
ports:
- name: port4984
port: 4984
targetPort: 4984
- name: port4985
port: 4985
targetPort: 4985
selector:
app: syncgw
type: LoadBalancer
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: couchbase
spec:
serviceName: "couchbase"
replicas: 3
template:
metadata:
labels:
app: couchbase
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- couchbase
topologyKey: "kubernetes.io/hostname"
terminationGracePeriodSeconds: 0
containers:
- name: couchbase
image: foo.azurecr.io/couchbase-worker:v1.6
ports:
- containerPort: 8091
volumeMounts:
- name: couchbase-data
mountPath: /opt/couchbase/var
env:
- name: COUCHBASE_MASTER
value: "couchbase-0.couchbase.default.svc.cluster.local"
- name: AUTO_REBALANCE
value: "false"
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: couchbase-admin-passwd
key: passwd
volumeClaimTemplates:
- metadata:
name: couchbase-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "managed-premium"
resources:
requests:
storage: 250Gi
apiVersion: v1
kind: Service
metadata:
name: syncgw-service
spec:
ports:
- name: port4984
port: 4984
targetPort: 4984
- name: port4985
port: 4985
targetPort: 4985
selector:
app: syncgw
type: LoadBalancer
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: syncgw
spec:
serviceName: "syncgw"
replicas: 3
template:
metadata:
labels:
app: syncgw
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- syncgw
topologyKey: "kubernetes.io/hostname"
terminationGracePeriodSeconds: 0
containers:
- name: syncgw
volumeMounts:
- name: syncgw-config
mountPath: /etc/sync_gateway
- name: syncgw-data
mountPath: /opt/couchbase-sync-gateway/data
image: couchbase/sync-gateway:2.1.2-community
ports:
- name: port4984
containerPort: 4984
- name: port4985
containerPort: 4985
volumes:
- name: syncgw-config
configMap:
name: syncgw-config
items:
- key: config.json
path: config.json
- name: syncgw-data
persistentVolumeClaim:
claimName: syncgw-data
volumeClaimTemplates:
- metadata:
name: syncgw-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "managed-premium"
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: syncgw-config
namespace: default
data:
config.json: |
{
"log": [
"*"
],
"interface": ":4984",
"adminInterface": ":4985",
"databases": {
"wallet": {
"server": "couchbase-0.couchbase.default.svc.cluster.local:8091",
"bucket": "test",
"username": "user",
"password": "foo",
"enable_shared_bucket_access": true,
"import_docs": "continuous",
"users": {
"GUEST": {
"disabled": true
}
},
"sync": `
function (doc, oldDoc) {
// check if document was removed from server or via SDK
if (isRemoved()) {
return;
}
if (isDeleted()) {
requireUser(oldDoc.reservedOwnerId);
return;
}
if (!doc.reservedOwnerId) {
throw({forbidden: 'Missing required properties'});
}
if (oldDoc == null) {
requireUser(doc.reservedOwnerId);
} else {
requireUser(oldDoc.reservedOwnerId);
}
channel(doc.reservedOwnerId);
// this is when document is removed via SDK or directly on server
function isRemoved() {
return( isDeleted() && oldDoc == null);
}
function isDeleted() {
return (doc._deleted == true);
}
}`,
"num_index_replicas": 0
}
},
"CORS": {
"Origin": [
"http://localhost:8080", "http://127.0.0.1:8080"
],
"LoginOrigin": [
"http://localhost:8080", "http://127.0.0.1:8080"
],
"Headers": [
"Content-Type", "Accept", "Authorization"
],
"MaxAge": 33
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment