Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEP: ServiceGroup StatefulSetGrid Design Specification #26

Closed
duyanghao opened this issue Jan 15, 2021 · 3 comments
Closed

SEP: ServiceGroup StatefulSetGrid Design Specification #26

duyanghao opened this issue Jan 15, 2021 · 3 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@duyanghao
Copy link
Contributor

duyanghao commented Jan 15, 2021

This is my initial design of ServiceGroup StatefulSetGrid as below:

image

StatefulSetGrid custom resource samples below:

apiVersion: superedge.io/v1
kind: StatefulSetGrid
metadata:
  name: statefulsetgrid-demo
  namespace: default
spec:
  gridUniqKey: zone1
  template:
    selector:
      matchLabels:
        appGrid: nginx # has to match .spec.template.metadata.labels
    serviceName: "servicegrid-demo-svc"
    replicas: 3 # by default is 1
    template:
      metadata:
        labels:
          appGrid: nginx # has to match .spec.selector.matchLabels
      spec:
        terminationGracePeriodSeconds: 10
        containers:
        - name: nginx
          image: k8s.gcr.io/nginx-slim:0.8
          ports:
          - containerPort: 80
            name: web
          volumeMounts:
          - name: www
            mountPath: /usr/share/nginx/html
    volumeClaimTemplates:
    - metadata:
        name: www
      spec:
        accessModes: [ "ReadWriteOnce" ]
        storageClassName: "my-storage-class"
        resources:
          requests:
            storage: 1Gi

ServiceGrid stays unchanged and samples below:

apiVersion: superedge.io/v1
kind: ServiceGrid
metadata:
  name: servicegrid-demo
  namespace: default
spec:
  gridUniqKey: zone1
  template:
    selector:
      appGrid: nginx
    ports:
    - port: 80
      name: web
    clusterIP: None                                                       

this design works as follows:

  1. StatefulSetGrid will generate relevant Kubernetes statefulset workload for each of nodeunit as DeploymentGrid does(i.e. {StatefulSetGrid}-{NodeUnit})
  2. StatefulSet headless service will be access by domains constructed by {StatefulSetGrid}-{0..N-1}.{ServiceGrid}-svc. default.svc.cluster.local which corresponds to actual statefulset workload {StatefulSetGrid}-{NodeUnit}-{0..N-1}.{ServiceGrid}-svc.default.svc.cluster.local, aiming to block the difference of nodeunits.
  3. StatefulSet normal clusterIP service access stays unchanged by using achieved service topology.(i.e. {ServiceGrid}-svc)
@duyanghao
Copy link
Contributor Author

@chenkaiyue PTAL.

@chenkaiyue
Copy link
Member

chenkaiyue commented Jan 15, 2021

rewrite plugin in coredns looks fit for this situation;
reload has been opened now in Corefile

@duyanghao
Copy link
Contributor Author

rewrite plugin in coredns looks fit for this situation;
reload has been opened now in Corefile

I recommend using coredns hosts plugins, and configurates it as below:

  Corefile: |
    .:53 {
        errors
        health {
           lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        hosts /data/edge/hosts {
            reload 300ms
            fallthrough
        }
        cache 30
        loop
        reload
        loadbalance
    }

@duyanghao duyanghao changed the title WIP: ServiceGroup StatefulSetGrid Design Specification SEP: ServiceGroup StatefulSetGrid Design Specification Feb 3, 2021
This was referenced Feb 3, 2021
@neweyes neweyes closed this as completed Feb 25, 2021
@neweyes neweyes added the kind/feature Categorizes issue or PR as related to a new feature. label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants