├── .github ├── actions │ ├── docker-build │ │ └── action.yml │ ├── parse-version │ │ └── action.yml │ ├── setup-docker │ │ └── action.yml │ ├── setup-go │ │ └── action.yml │ ├── setup-helm │ │ └── action.yml │ └── setup-helmit │ │ └── action.yml ├── scripts │ └── build-workflows └── workflows │ ├── api-verify.yml │ ├── chart-release.yml │ ├── chart-test.yml │ ├── chart-verify.yml │ ├── check-license.yaml │ ├── cli-release.yml │ ├── cli-verify.yml │ ├── controller-release.yml │ ├── controller-test.yml │ ├── controller-verify.yml │ ├── drivers-etcd-test.yml │ ├── drivers-etcd-verify.yml │ ├── drivers-pod-memory-test.yml │ ├── drivers-pod-memory-verify.yml │ ├── drivers-raft-test.yml │ ├── drivers-raft-verify.yml │ ├── drivers-redis-test.yml │ ├── drivers-redis-verify.yml │ ├── drivers-shared-memory-test.yml │ ├── drivers-shared-memory-verify.yml │ ├── lint.yml │ ├── logging-verify.yml │ ├── protocols-rsm-verify.yml │ ├── runtime-verify.yml │ ├── sidecar-release.yml │ ├── sidecar-test.yml │ ├── sidecar-verify.yml │ ├── stores-pod-memory-release.yml │ ├── stores-pod-memory-test.yml │ ├── stores-pod-memory-verify.yml │ ├── stores-raft-release.yml │ ├── stores-raft-test.yml │ ├── stores-raft-verify.yml │ ├── stores-shared-memory-release.yml │ ├── stores-shared-memory-test.yml │ ├── stores-shared-memory-verify.yml │ ├── test.yml │ └── testing-verify.yml ├── .gitignore ├── .reuse └── dep5 ├── LICENSES └── Apache-2.0.txt ├── Makefile ├── README.md ├── api ├── .github │ └── workflows │ │ └── verify.yml ├── Makefile ├── README.md ├── errors │ ├── errors.go │ └── errors_test.go ├── go.mod ├── go.sum └── runtime │ ├── counter │ └── v1 │ │ ├── counter.go │ │ ├── counter.md │ │ ├── counter.pb.go │ │ ├── counter.proto │ │ ├── counters.md │ │ ├── counters.pb.go │ │ └── counters.proto │ ├── countermap │ └── v1 │ │ ├── countermap.go │ │ ├── countermap.md │ │ ├── countermap.pb.go │ │ ├── countermap.proto │ │ ├── countermaps.md │ │ ├── countermaps.pb.go │ │ └── countermaps.proto │ ├── election │ └── v1 │ │ ├── election.go │ │ ├── election.md │ │ ├── election.pb.go │ │ ├── election.proto │ │ ├── elections.md │ │ ├── elections.pb.go │ │ └── elections.proto │ ├── indexedmap │ └── v1 │ │ ├── indexedmap.go │ │ ├── indexedmap.md │ │ ├── indexedmap.pb.go │ │ ├── indexedmap.proto │ │ ├── indexedmaps.md │ │ ├── indexedmaps.pb.go │ │ └── indexedmaps.proto │ ├── list │ └── v1 │ │ ├── list.go │ │ ├── list.md │ │ ├── list.pb.go │ │ ├── list.proto │ │ ├── lists.md │ │ ├── lists.pb.go │ │ └── lists.proto │ ├── lock │ └── v1 │ │ ├── lock.go │ │ ├── lock.md │ │ ├── lock.pb.go │ │ ├── lock.proto │ │ ├── locks.md │ │ ├── locks.pb.go │ │ └── locks.proto │ ├── map │ └── v1 │ │ ├── map.go │ │ ├── map.md │ │ ├── map.pb.go │ │ ├── map.proto │ │ ├── maps.md │ │ ├── maps.pb.go │ │ └── maps.proto │ ├── multimap │ └── v1 │ │ ├── multimap.go │ │ ├── multimap.md │ │ ├── multimap.pb.go │ │ ├── multimap.proto │ │ ├── multimaps.md │ │ ├── multimaps.pb.go │ │ └── multimaps.proto │ ├── set │ └── v1 │ │ ├── set.go │ │ ├── set.md │ │ ├── set.pb.go │ │ ├── set.proto │ │ ├── sets.md │ │ ├── sets.pb.go │ │ └── sets.proto │ ├── topic │ └── v1 │ │ ├── topic.go │ │ ├── topic.md │ │ ├── topic.pb.go │ │ ├── topic.proto │ │ ├── topics.md │ │ ├── topics.pb.go │ │ └── topics.proto │ ├── v1 │ ├── runtime.md │ ├── runtime.pb.go │ └── runtime.proto │ └── value │ └── v1 │ ├── value.go │ ├── value.md │ ├── value.pb.go │ ├── value.proto │ ├── values.md │ ├── values.pb.go │ └── values.proto ├── chart ├── .github │ └── workflows │ │ ├── release.yml │ │ ├── test.yml │ │ └── verify.yml ├── .helmignore ├── Chart.yaml ├── README.md └── values.yaml ├── cli ├── .github │ └── workflows │ │ ├── release.yml │ │ └── verify.yml ├── Makefile ├── README.md ├── build │ └── Dockerfile ├── cmd │ └── atomix │ │ └── main.go ├── go.mod ├── go.sum └── internal │ ├── atomix │ ├── build │ │ ├── build.go │ │ ├── mod.go │ │ ├── mod_test.go │ │ └── plugin.go │ └── cmd.go │ └── exec │ └── exec.go ├── controller ├── .github │ └── workflows │ │ ├── release.yml │ │ ├── test.yml │ │ └── verify.yml ├── Makefile ├── README.md ├── build │ ├── boilerplate.go.txt │ ├── controller-init │ │ └── Dockerfile │ └── controller │ │ └── Dockerfile ├── chart │ ├── Chart.yaml │ ├── crds │ │ └── atomix.io │ │ │ ├── datastores.yaml │ │ │ └── storageprofiles.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ ├── clusterrole.yaml │ │ ├── clusterrolebinding.yaml │ │ ├── configmap.yaml │ │ ├── deployment.yaml │ │ ├── service.yaml │ │ └── serviceaccount.yaml │ └── values.yaml ├── cmd │ ├── atomix-controller-init │ │ └── main.go │ └── atomix-controller │ │ └── main.go ├── go.mod ├── go.sum ├── pkg │ ├── apis │ │ ├── apis.go │ │ ├── atomix │ │ │ ├── v3beta3 │ │ │ │ ├── datastore.go │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── storageprofile.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── v3beta4 │ │ │ │ ├── datastore.go │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── storageprofile.go │ │ │ │ └── zz_generated.deepcopy.go │ │ ├── v3beta3.go │ │ └── v3beta4.go │ ├── client │ │ └── clientset │ │ │ └── versioned │ │ │ ├── clientset.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ └── atomix │ │ │ ├── v3beta3 │ │ │ ├── atomix_client.go │ │ │ ├── datastore.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_atomix_client.go │ │ │ │ ├── fake_datastore.go │ │ │ │ └── fake_storageprofile.go │ │ │ ├── generated_expansion.go │ │ │ └── storageprofile.go │ │ │ └── v3beta4 │ │ │ ├── atomix_client.go │ │ │ ├── datastore.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_atomix_client.go │ │ │ ├── fake_datastore.go │ │ │ └── fake_storageprofile.go │ │ │ ├── generated_expansion.go │ │ │ └── storageprofile.go │ └── controller │ │ ├── atomix │ │ └── v3beta4 │ │ │ ├── controller.go │ │ │ └── runtime.go │ │ └── util │ │ └── k8s │ │ ├── conversion │ │ ├── converter.go │ │ ├── decode.go │ │ ├── handler.go │ │ └── webhook.go │ │ ├── env.go │ │ ├── leader.go │ │ └── ready.go └── tests │ ├── go.mod │ ├── go.sum │ └── tests.go ├── drivers ├── Makefile ├── README.md ├── etcd │ ├── .github │ │ └── workflows │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── tests │ │ ├── Dockerfile │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go │ └── v3 │ │ ├── driver │ │ ├── conn.go │ │ ├── driver.go │ │ ├── lock │ │ │ └── v1 │ │ │ │ └── client.go │ │ └── map │ │ │ └── v1 │ │ │ └── client.go │ │ └── plugin.go ├── pod-memory │ ├── .github │ │ └── workflows │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── tests │ │ ├── Dockerfile │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go │ └── v1 │ │ ├── driver │ │ ├── conn.go │ │ ├── driver.go │ │ └── node.go │ │ └── plugin.go ├── raft │ ├── .github │ │ └── workflows │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── tests │ │ ├── Dockerfile │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go │ └── v1 │ │ ├── driver │ │ ├── conn.go │ │ └── driver.go │ │ └── plugin.go ├── redis │ ├── .github │ │ └── workflows │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── tests │ │ ├── Dockerfile │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go │ ├── v8 │ │ ├── driver │ │ │ ├── conn.go │ │ │ ├── driver.go │ │ │ └── set │ │ │ │ └── v1 │ │ │ │ └── client.go │ │ └── plugin.go │ └── v9 │ │ ├── driver │ │ ├── conn.go │ │ ├── driver.go │ │ ├── map │ │ │ └── v1 │ │ │ │ └── client.go │ │ └── set │ │ │ └── v1 │ │ │ └── client.go │ │ └── plugin.go └── shared-memory │ ├── .github │ └── workflows │ │ ├── test.yml │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── tests │ ├── Dockerfile │ ├── go.mod │ ├── go.sum │ └── tests.go │ └── v1 │ ├── driver │ ├── conn.go │ └── driver.go │ └── plugin.go ├── examples ├── custom-store.yaml ├── etcd-store.yaml ├── multi-raft-store.yaml ├── multi-store-routing.yaml ├── pod-memory-store.yaml ├── primitive-configuration-rules.yaml ├── profiles │ ├── single-store-v3beta3.yaml │ └── single-store-v3beta4.yaml ├── raft-store.yaml ├── shared-memory-store.yaml └── stores │ ├── README.md │ ├── etcd-store.yaml │ ├── multi-raft-store-v1beta2.yaml │ ├── multi-raft-store-v1beta3.yaml │ ├── pod-memory-store.yaml │ ├── raft-store-v1beta2.yaml │ ├── raft-store-v1beta3.yaml │ ├── raft-stores.yaml │ ├── redis-store.yaml │ └── shared-memory-store.yaml ├── logging ├── .github │ └── workflows │ │ └── verify.yml ├── Makefile ├── README.md ├── config.go ├── field.go ├── go.mod ├── go.sum ├── level.go ├── level_test.go ├── logger.go ├── logger_test.go ├── output.go ├── output_test.go ├── sink.go ├── sink_test.go └── test-data │ └── test-config.yaml ├── protocols ├── Makefile ├── README.md └── rsm │ ├── .github │ └── workflows │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── api │ ├── counter │ │ └── v1 │ │ │ ├── counter.pb.go │ │ │ └── counter.proto │ ├── countermap │ │ └── v1 │ │ │ ├── countermap.pb.go │ │ │ └── countermap.proto │ ├── election │ │ └── v1 │ │ │ ├── election.pb.go │ │ │ └── election.proto │ ├── indexedmap │ │ └── v1 │ │ │ ├── indexedmap.pb.go │ │ │ └── indexedmap.proto │ ├── lock │ │ └── v1 │ │ │ ├── lock.pb.go │ │ │ └── lock.proto │ ├── map │ │ └── v1 │ │ │ ├── map.pb.go │ │ │ └── map.proto │ ├── multimap │ │ └── v1 │ │ │ ├── multimap.pb.go │ │ │ └── multimap.proto │ ├── set │ │ └── v1 │ │ │ ├── set.pb.go │ │ │ └── set.proto │ ├── v1 │ │ ├── config.pb.go │ │ ├── config.proto │ │ ├── headers.pb.go │ │ ├── headers.proto │ │ ├── partition.mock.go │ │ ├── partition.pb.go │ │ ├── partition.proto │ │ ├── primitive.pb.go │ │ ├── primitive.proto │ │ ├── session.mock.go │ │ ├── session.pb.go │ │ ├── session.proto │ │ ├── test.mock.go │ │ ├── test.pb.go │ │ ├── test.proto │ │ └── types.go │ └── value │ │ └── v1 │ │ ├── value.pb.go │ │ └── value.proto │ ├── go.mod │ ├── go.sum │ └── pkg │ ├── client │ ├── client.go │ ├── client_test.go │ ├── counter │ │ └── v1 │ │ │ └── client.go │ ├── countermap │ │ └── v1 │ │ │ └── client.go │ ├── election │ │ └── v1 │ │ │ └── client.go │ ├── errors.go │ ├── indexedmap │ │ └── v1 │ │ │ └── client.go │ ├── lock │ │ └── v1 │ │ │ └── client.go │ ├── map │ │ └── v1 │ │ │ └── client.go │ ├── multimap │ │ └── v1 │ │ │ └── client.go │ ├── options.go │ ├── partition.go │ ├── picker.go │ ├── primitive.go │ ├── protocol.go │ ├── resolver.go │ ├── session.go │ ├── set │ │ └── v1 │ │ │ └── client.go │ └── value │ │ └── v1 │ │ └── client.go │ ├── node │ ├── codec.go │ ├── counter │ │ └── v1 │ │ │ └── server.go │ ├── countermap │ │ └── v1 │ │ │ └── server.go │ ├── election │ │ └── v1 │ │ │ └── server.go │ ├── executor.go │ ├── handler.go │ ├── indexedmap │ │ └── v1 │ │ │ └── server.go │ ├── lock │ │ └── v1 │ │ │ └── server.go │ ├── map │ │ └── v1 │ │ │ └── server.go │ ├── multimap │ │ └── v1 │ │ │ └── server.go │ ├── node.go │ ├── options.go │ ├── partition.go │ ├── protocol.go │ ├── server.go │ ├── set │ │ └── v1 │ │ │ └── server.go │ └── value │ │ └── v1 │ │ └── server.go │ └── statemachine │ ├── caller.go │ ├── codec.go │ ├── counter │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── countermap │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── election │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── errors.go │ ├── indexedmap │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── lock │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── map │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── multimap │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── primitive.go │ ├── scheduler.go │ ├── scheduler_test.go │ ├── session.go │ ├── set │ └── v1 │ │ ├── executor.go │ │ └── statemachine.go │ ├── snapshot.go │ ├── statemachine.go │ └── value │ └── v1 │ ├── executor.go │ └── statemachine.go ├── runtime ├── .github │ └── workflows │ │ └── verify.yml ├── Makefile ├── README.md ├── go.mod ├── go.sum └── pkg │ ├── driver │ └── driver.go │ ├── logging │ ├── config.go │ ├── field.go │ ├── level.go │ ├── logger.go │ ├── logger_test.go │ ├── output.go │ └── test.yaml │ ├── network │ ├── driver.go │ ├── options.go │ └── service.go │ ├── runtime │ ├── counter │ │ └── v1 │ │ │ ├── counter.go │ │ │ └── counters.go │ ├── countermap │ │ └── v1 │ │ │ ├── countermap.go │ │ │ └── countermaps.go │ ├── election │ │ └── v1 │ │ │ ├── election.go │ │ │ └── elections.go │ ├── indexedmap │ │ └── v1 │ │ │ ├── indexedmap.go │ │ │ └── indexedmaps.go │ ├── list │ │ └── v1 │ │ │ ├── list.go │ │ │ └── lists.go │ ├── lock │ │ └── v1 │ │ │ ├── lock.go │ │ │ └── locks.go │ ├── map │ │ └── v1 │ │ │ ├── map.go │ │ │ └── maps.go │ ├── multimap │ │ └── v1 │ │ │ ├── multimap.go │ │ │ └── multimaps.go │ ├── options.go │ ├── service.go │ ├── set │ │ └── v1 │ │ │ ├── set.go │ │ │ └── sets.go │ ├── topic │ │ └── v1 │ │ │ ├── topic.go │ │ │ └── topics.go │ ├── v1 │ │ ├── driver.go │ │ ├── options.go │ │ ├── primitive.go │ │ ├── runtime.go │ │ ├── runtime_test.go │ │ └── server.go │ └── value │ │ └── v1 │ │ ├── value.go │ │ └── values.go │ ├── stream │ └── stream.go │ └── utils │ ├── async │ ├── async.go │ └── async_test.go │ └── grpc │ └── interceptors │ ├── errors.go │ ├── options.go │ └── retry.go ├── sidecar ├── .github │ └── workflows │ │ ├── release.yml │ │ ├── test.yml │ │ └── verify.yml ├── Makefile ├── README.md ├── build │ ├── controller-test │ │ └── Dockerfile │ ├── controller │ │ └── Dockerfile │ └── sidecar │ │ └── Dockerfile ├── chart │ ├── Chart.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ ├── clusterrole.yaml │ │ ├── clusterrolebinding.yaml │ │ ├── configmap.yaml │ │ ├── deployment.yaml │ │ ├── mutatingwebhookconfiguration.yaml │ │ ├── service.yaml │ │ └── serviceaccount.yaml │ └── values.yaml ├── cmd │ ├── atomix-sidecar-controller │ │ └── main.go │ └── atomix-sidecar │ │ └── main.go ├── go.mod ├── go.sum ├── pkg │ ├── sidecar │ │ ├── driver.go │ │ ├── options.go │ │ └── service.go │ └── webhook │ │ └── injector.go └── tests │ ├── go.mod │ ├── go.sum │ └── tests.go ├── stores ├── Makefile ├── pod-memory │ ├── .github │ │ └── workflows │ │ │ ├── release.yml │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── build │ │ ├── boilerplate.go.txt │ │ ├── controller-test │ │ │ └── Dockerfile │ │ └── controller │ │ │ └── Dockerfile │ ├── chart │ │ ├── Chart.yaml │ │ ├── README.md │ │ ├── crds │ │ │ └── podmemory.atomix.io │ │ │ │ └── podmemorystores.yaml │ │ ├── templates │ │ │ ├── _helpers.tpl │ │ │ ├── clusterrole.yaml │ │ │ ├── clusterrolebinding.yaml │ │ │ ├── configmap.yaml │ │ │ ├── deployment.yaml │ │ │ ├── service.yaml │ │ │ ├── serviceaccount.yaml │ │ │ └── tests │ │ │ │ └── crds.yaml │ │ └── values.yaml │ ├── cmd │ │ └── atomix-pod-memory-controller │ │ │ └── main.go │ ├── go.mod │ ├── go.sum │ ├── pkg │ │ ├── apis │ │ │ ├── addtoscheme_podmemory_v1beta1.go │ │ │ ├── apis.go │ │ │ └── podmemory │ │ │ │ └── v1beta1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── store.go │ │ │ │ └── zz_generated.deepcopy.go │ │ ├── client │ │ │ └── clientset │ │ │ │ └── versioned │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── clientset_generated.go │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ └── podmemory │ │ │ │ └── v1beta1 │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_podmemory_client.go │ │ │ │ └── fake_podmemorystore.go │ │ │ │ ├── generated_expansion.go │ │ │ │ ├── podmemory_client.go │ │ │ │ └── podmemorystore.go │ │ └── controller │ │ │ └── podmemory │ │ │ └── v1beta1 │ │ │ ├── controller.go │ │ │ └── store.go │ └── tests │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go ├── raft │ ├── .github │ │ └── workflows │ │ │ ├── release.yml │ │ │ ├── test.yml │ │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── api │ │ └── v1 │ │ │ ├── raft.go │ │ │ ├── raft.pb.go │ │ │ └── raft.proto │ ├── build │ │ ├── boilerplate.go.txt │ │ ├── controller │ │ │ └── Dockerfile │ │ └── node │ │ │ └── Dockerfile │ ├── chart │ │ ├── Chart.yaml │ │ ├── README.md │ │ ├── crds │ │ │ └── raft.atomix.io │ │ │ │ ├── raftclusters.yaml │ │ │ │ ├── raftpartitions.yaml │ │ │ │ ├── raftreplicas.yaml │ │ │ │ └── raftstores.yaml │ │ ├── templates │ │ │ ├── _helpers.tpl │ │ │ ├── clusterrole.yaml │ │ │ ├── clusterrolebinding.yaml │ │ │ ├── configmap.yaml │ │ │ ├── deployment.yaml │ │ │ ├── service.yaml │ │ │ └── serviceaccount.yaml │ │ └── values.yaml │ ├── cmd │ │ ├── atomix-raft-controller │ │ │ └── main.go │ │ └── atomix-raft-node │ │ │ └── main.go │ ├── go.mod │ ├── go.sum │ ├── pkg │ │ ├── apis │ │ │ ├── apis.go │ │ │ ├── raft │ │ │ │ ├── v1beta2 │ │ │ │ │ ├── cluster.go │ │ │ │ │ ├── config.go │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── partition.go │ │ │ │ │ ├── register.go │ │ │ │ │ ├── replica.go │ │ │ │ │ ├── store.go │ │ │ │ │ └── zz_generated.deepcopy.go │ │ │ │ └── v1beta3 │ │ │ │ │ ├── cluster.go │ │ │ │ │ ├── config.go │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── partition.go │ │ │ │ │ ├── register.go │ │ │ │ │ ├── replica.go │ │ │ │ │ ├── store.go │ │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── v1beta2.go │ │ │ └── v1beta3.go │ │ ├── client │ │ │ └── clientset │ │ │ │ └── versioned │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── clientset_generated.go │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ └── raft │ │ │ │ ├── v1beta2 │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── fake_raft_client.go │ │ │ │ │ ├── fake_raftcluster.go │ │ │ │ │ ├── fake_raftpartition.go │ │ │ │ │ ├── fake_raftreplica.go │ │ │ │ │ └── fake_raftstore.go │ │ │ │ ├── generated_expansion.go │ │ │ │ ├── raft_client.go │ │ │ │ ├── raftcluster.go │ │ │ │ ├── raftpartition.go │ │ │ │ ├── raftreplica.go │ │ │ │ └── raftstore.go │ │ │ │ └── v1beta3 │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_raft_client.go │ │ │ │ ├── fake_raftcluster.go │ │ │ │ ├── fake_raftpartition.go │ │ │ │ ├── fake_raftreplica.go │ │ │ │ └── fake_raftstore.go │ │ │ │ ├── generated_expansion.go │ │ │ │ ├── raft_client.go │ │ │ │ ├── raftcluster.go │ │ │ │ ├── raftpartition.go │ │ │ │ ├── raftreplica.go │ │ │ │ └── raftstore.go │ │ ├── controller │ │ │ └── raft │ │ │ │ └── v1beta3 │ │ │ │ ├── cluster.go │ │ │ │ ├── controller.go │ │ │ │ ├── meta.go │ │ │ │ ├── partition.go │ │ │ │ ├── pod.go │ │ │ │ ├── replica.go │ │ │ │ └── store.go │ │ └── raft │ │ │ ├── config.go │ │ │ ├── context.go │ │ │ ├── events.go │ │ │ ├── options.go │ │ │ ├── partition.go │ │ │ ├── protocol.go │ │ │ ├── server.go │ │ │ └── statemachine.go │ └── tests │ │ ├── go.mod │ │ ├── go.sum │ │ └── tests.go └── shared-memory │ ├── .github │ └── workflows │ │ ├── release.yml │ │ ├── test.yml │ │ └── verify.yml │ ├── Makefile │ ├── README.md │ ├── build │ ├── boilerplate.go.txt │ ├── controller-test │ │ └── Dockerfile │ ├── controller │ │ └── Dockerfile │ └── node │ │ └── Dockerfile │ ├── chart │ ├── Chart.yaml │ ├── README.md │ ├── crds │ │ └── sharedmemory.atomix.io │ │ │ └── sharedmemorystores.yaml │ ├── templates │ │ ├── _helpers.tpl │ │ ├── clusterrole.yaml │ │ ├── clusterrolebinding.yaml │ │ ├── configmap.yaml │ │ ├── deployment.yaml │ │ ├── service.yaml │ │ ├── serviceaccount.yaml │ │ └── tests │ │ │ └── crds.yaml │ └── values.yaml │ ├── cmd │ ├── atomix-shared-memory-controller │ │ └── main.go │ └── atomix-shared-memory-node │ │ └── main.go │ ├── go.mod │ ├── go.sum │ ├── pkg │ ├── apis │ │ ├── apis.go │ │ ├── sharedmemory │ │ │ ├── v1beta1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── store.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── v1beta2 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── store.go │ │ │ │ └── zz_generated.deepcopy.go │ │ ├── v1beta1.go │ │ └── v1beta2.go │ ├── client │ │ └── clientset │ │ │ └── versioned │ │ │ ├── clientset.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ └── sharedmemory │ │ │ ├── v1beta1 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_sharedmemory_client.go │ │ │ │ └── fake_sharedmemorystore.go │ │ │ ├── generated_expansion.go │ │ │ ├── sharedmemory_client.go │ │ │ └── sharedmemorystore.go │ │ │ └── v1beta2 │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_sharedmemory_client.go │ │ │ └── fake_sharedmemorystore.go │ │ │ ├── generated_expansion.go │ │ │ ├── sharedmemory_client.go │ │ │ └── sharedmemorystore.go │ ├── controller │ │ └── sharedmemory │ │ │ └── v1beta2 │ │ │ ├── controller.go │ │ │ ├── conversion.go │ │ │ └── store.go │ └── node │ │ ├── config.go │ │ └── protocol.go │ └── tests │ ├── go.mod │ ├── go.sum │ └── tests.go └── testing ├── .github └── workflows │ └── verify.yml ├── Makefile ├── README.md ├── go.mod ├── go.sum └── pkg ├── benchmarks ├── map.go └── primitive.go └── tests ├── counter.go ├── map.go └── primitive.go /.github/actions/setup-docker/action.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Setup Docker 6 | 7 | inputs: 8 | username: 9 | description: "The Docker username" 10 | required: true 11 | 12 | password: 13 | description: "The Docker password" 14 | required: true 15 | 16 | runs: 17 | using: composite 18 | steps: 19 | - name: Set up Docker Buildx 20 | uses: docker/setup-buildx-action@v2 21 | 22 | - name: Docker login 23 | uses: docker/login-action@v2 24 | with: 25 | username: ${{ inputs.username }} 26 | password: ${{ inputs.password }} 27 | -------------------------------------------------------------------------------- /.github/actions/setup-go/action.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Setup Go 6 | 7 | runs: 8 | using: composite 9 | steps: 10 | - name: Set up Go 11 | uses: actions/setup-go@v3 12 | with: 13 | go-version: 1.19 14 | 15 | - name: Cache Go modules 16 | uses: actions/cache@v3 17 | with: 18 | path: ~/go/pkg/mod 19 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 20 | restore-keys: | 21 | ${{ runner.os }}-go- 22 | -------------------------------------------------------------------------------- /.github/actions/setup-helm/action.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Setup Helm 6 | 7 | runs: 8 | using: composite 9 | steps: 10 | - name: Configure Git 11 | run: | 12 | git config user.name "$GITHUB_ACTOR" 13 | git config user.email "$GITHUB_ACTOR@users.noreply.github.com" 14 | shell: bash 15 | 16 | - name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v2 18 | 19 | - name: Set up Helm 20 | uses: azure/setup-helm@v3 21 | with: 22 | version: v3.10.0 23 | 24 | - uses: actions/setup-python@v4 25 | with: 26 | python-version: '3.9' 27 | check-latest: true 28 | 29 | - name: Set up chart-testing 30 | uses: helm/chart-testing-action@v2.3.1 31 | -------------------------------------------------------------------------------- /.github/actions/setup-helmit/action.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Setup Helm Integration Testing Framework 6 | 7 | runs: 8 | using: composite 9 | steps: 10 | - name: Set up Go 11 | uses: actions/setup-go@v3 12 | with: 13 | go-version: 1.19 14 | 15 | - name: Cache Go modules 16 | uses: actions/cache@v3 17 | with: 18 | path: ~/go/pkg/mod 19 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 20 | restore-keys: | 21 | ${{ runner.os }}-go- 22 | 23 | - name: Install Helmit 24 | run: go install github.com/onosproject/helmit@v1.1.3 25 | shell: bash 26 | -------------------------------------------------------------------------------- /.github/scripts/build-workflows: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | 6 | readonly ROOT_WF_DIR=".github/workflows" 7 | 8 | DIRS="$(find . -mindepth 2 -name '*.yml' -type f -not -path "./.git*/*")" 9 | 10 | for file in $DIRS; do 11 | source=$(echo "$file" | sed 's/^.\///g') 12 | prefix=$(echo "$(dirname $(dirname $(dirname "$source")))" | sed 's/\//-/g') 13 | find $ROOT_WF_DIR -type f -name "$prefix-*.yml" -delete 14 | done 15 | 16 | for file in $DIRS; do 17 | source=$(echo "$file" | sed 's/^.\///g') 18 | prefix=$(echo "$(dirname $(dirname $(dirname "$source")))" | sed 's/\//-/g') 19 | dest="$ROOT_WF_DIR/$prefix-$(basename "$source")" 20 | echo "$source -> $dest" 21 | echo "# Code generated by build-workflows script. DO NOT EDIT." >> $dest 22 | echo "# source: $source" >> $dest 23 | echo "" >> $dest 24 | cat "$source" >> "$dest" 25 | done -------------------------------------------------------------------------------- /.github/workflows/api-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: api/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify API 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'api/**' 16 | pull_request: 17 | paths: 18 | - 'api/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: api 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: api 35 | -------------------------------------------------------------------------------- /.github/workflows/chart-test.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: chart/.github/workflows/test.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Test Atomix chart 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'chart/**' 16 | pull_request: 17 | paths: 18 | - 'chart/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test-install: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v3 31 | 32 | - name: Setup Go 33 | uses: ./.github/actions/setup-go 34 | 35 | - name: Setup Helm 36 | uses: ./.github/actions/setup-helm 37 | 38 | - name: Create kind cluster 39 | uses: helm/kind-action@v1.4.0 40 | with: 41 | cluster_name: kind 42 | 43 | - name: Test install 44 | run: ct install --charts ./chart 45 | -------------------------------------------------------------------------------- /.github/workflows/chart-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: chart/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Atomix chart 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'chart/**' 16 | pull_request: 17 | paths: 18 | - 'chart/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | lint: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v3 31 | 32 | - name: Setup Helm environment 33 | uses: ./.github/actions/setup-helm 34 | 35 | - name: Helm lint 36 | run: ct lint --charts ./chart --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false 37 | -------------------------------------------------------------------------------- /.github/workflows/check-license.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Check License 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | pull_request: 12 | 13 | jobs: 14 | check-license: 15 | name: Check license 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v3 20 | 21 | - name: Check REUSE compliance 22 | uses: fsfe/reuse-action@v1 23 | with: 24 | args: lint 25 | -------------------------------------------------------------------------------- /.github/workflows/controller-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: controller/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Controller 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'controller/**' 16 | pull_request: 17 | paths: 18 | - 'controller/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: controller 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: controller 35 | chart: chart 36 | -------------------------------------------------------------------------------- /.github/workflows/drivers-etcd-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: drivers/etcd/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Etcd Driver 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'drivers/etcd/**' 16 | pull_request: 17 | paths: 18 | - 'drivers/etcd/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: drivers/etcd 30 | package: github.com/atomix/atomix/drivers/etcd/v3/... 31 | 32 | lint: 33 | uses: ./.github/workflows/lint.yml 34 | with: 35 | component: drivers/etcd 36 | -------------------------------------------------------------------------------- /.github/workflows/drivers-pod-memory-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: drivers/pod-memory/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify pod-memory Driver 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'drivers/pod-memory/**' 16 | pull_request: 17 | paths: 18 | - 'drivers/pod-memory/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: drivers/pod-memory 30 | package: github.com/atomix/atomix/drivers/pod-memory/v1/... 31 | 32 | lint: 33 | uses: ./.github/workflows/lint.yml 34 | with: 35 | component: drivers/pod-memory 36 | -------------------------------------------------------------------------------- /.github/workflows/drivers-raft-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: drivers/raft/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Raft Driver 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'drivers/raft/**' 16 | pull_request: 17 | paths: 18 | - 'drivers/raft/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: drivers/raft 30 | package: github.com/atomix/atomix/drivers/raft/v1/... 31 | 32 | lint: 33 | uses: ./.github/workflows/lint.yml 34 | with: 35 | component: drivers/raft 36 | -------------------------------------------------------------------------------- /.github/workflows/drivers-redis-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: drivers/redis/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Redis Driver v8 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'drivers/redis/**' 16 | pull_request: 17 | paths: 18 | - 'drivers/redis/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test-v8: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: drivers/redis 30 | package: github.com/atomix/atomix/drivers/redis/v8/... 31 | 32 | lint-v8: 33 | uses: ./.github/workflows/lint.yml 34 | with: 35 | component: drivers/redis 36 | 37 | test-v9: 38 | uses: ./.github/workflows/test.yml 39 | with: 40 | component: drivers/redis 41 | package: github.com/atomix/atomix/drivers/redis/v9/... 42 | 43 | lint-v9: 44 | uses: ./.github/workflows/lint.yml 45 | with: 46 | component: drivers/redis -------------------------------------------------------------------------------- /.github/workflows/drivers-shared-memory-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: drivers/shared-memory/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify shared-memory Driver 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'drivers/shared-memory/**' 16 | pull_request: 17 | paths: 18 | - 'drivers/shared-memory/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: drivers/shared-memory 30 | package: github.com/atomix/atomix/drivers/shared-memory/v1/... 31 | 32 | lint: 33 | uses: ./.github/workflows/lint.yml 34 | with: 35 | component: drivers/shared-memory 36 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | on: 6 | workflow_call: 7 | inputs: 8 | component: 9 | type: string 10 | description: "The component to lint" 11 | required: true 12 | 13 | chart: 14 | type: string 15 | description: "The path to the Helm chart relative to the component root" 16 | required: false 17 | 18 | jobs: 19 | lint: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v3 24 | 25 | - name: Set up Go 26 | uses: actions/setup-go@v3 27 | with: 28 | go-version: 1.19 29 | 30 | - name: Go lint 31 | uses: golangci/golangci-lint-action@v3 32 | with: 33 | working-directory: ${{ inputs.component }} 34 | args: --timeout=5m 35 | 36 | - name: Setup Helm environment 37 | uses: ./.github/actions/setup-helm 38 | if: ${{ inputs.chart != '' }} 39 | 40 | - name: Helm lint 41 | run: ct lint --charts ${{ inputs.component }}/${{ inputs.chart }} --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false 42 | if: ${{ inputs.chart != '' }} 43 | -------------------------------------------------------------------------------- /.github/workflows/logging-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: logging/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Logging Framework 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'logging/**' 16 | pull_request: 17 | paths: 18 | - 'logging/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: logging 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: logging 35 | -------------------------------------------------------------------------------- /.github/workflows/protocols-rsm-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: protocols/rsm/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify RSM Protocol 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'protocols/rsm/**' 16 | pull_request: 17 | paths: 18 | - 'protocols/rsm/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: protocols/rsm 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: protocols/rsm 35 | -------------------------------------------------------------------------------- /.github/workflows/runtime-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: runtime/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Runtime 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'runtime/**' 16 | pull_request: 17 | paths: 18 | - 'runtime/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: runtime 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: runtime 35 | -------------------------------------------------------------------------------- /.github/workflows/sidecar-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: sidecar/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Sidecar 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'sidecar/**' 16 | pull_request: 17 | paths: 18 | - 'sidecar/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: sidecar 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: sidecar 35 | chart: chart 36 | -------------------------------------------------------------------------------- /.github/workflows/stores-pod-memory-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: stores/pod-memory/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify pod-memory Store 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'stores/pod-memory/**' 16 | pull_request: 17 | paths: 18 | - 'stores/pod-memory/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: stores/pod-memory 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: stores/pod-memory 35 | chart: chart 36 | -------------------------------------------------------------------------------- /.github/workflows/stores-raft-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: stores/raft/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Raft Store 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'stores/raft/**' 16 | pull_request: 17 | paths: 18 | - 'stores/raft/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: stores/raft 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: stores/raft 35 | chart: chart 36 | -------------------------------------------------------------------------------- /.github/workflows/stores-shared-memory-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: stores/shared-memory/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify shared-memory Store 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'stores/shared-memory/**' 16 | pull_request: 17 | paths: 18 | - 'stores/shared-memory/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: stores/shared-memory 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: stores/shared-memory 35 | chart: chart 36 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | on: 6 | workflow_call: 7 | inputs: 8 | component: 9 | type: string 10 | description: "The component path" 11 | required: true 12 | 13 | package: 14 | type: string 15 | description: "The package to test" 16 | required: false 17 | default: '' 18 | 19 | jobs: 20 | test: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v3 25 | 26 | - name: Setup Go environment 27 | uses: ./.github/actions/setup-go 28 | 29 | - name: Run tests 30 | run: go test ${{ inputs.package || format('github.com/atomix/atomix/{0}/...', inputs.component) }} 31 | working-directory: ${{ inputs.component }} 32 | -------------------------------------------------------------------------------- /.github/workflows/testing-verify.yml: -------------------------------------------------------------------------------- 1 | # Code generated by build-workflows script. DO NOT EDIT. 2 | # source: testing/.github/workflows/verify.yml 3 | 4 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | 8 | name: Verify Integration Tests 9 | 10 | on: 11 | push: 12 | branches: 13 | - 'master' 14 | paths: 15 | - 'testing/**' 16 | pull_request: 17 | paths: 18 | - 'testing/**' 19 | workflow_dispatch: 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | test: 27 | uses: ./.github/workflows/test.yml 28 | with: 29 | component: testing 30 | 31 | lint: 32 | uses: ./.github/workflows/lint.yml 33 | with: 34 | component: testing 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # Binaries for programs and plugins 6 | *.exe 7 | *.exe~ 8 | *.dll 9 | *.so 10 | *.dylib 11 | *.tgz 12 | .idea 13 | .DS_Store 14 | 15 | # Generated TLS certificate files 16 | admission.conf 17 | admission.csr 18 | ca.key 19 | ca.srl 20 | 21 | # Test binary, built with `go test -c` 22 | *.test 23 | *.log 24 | 25 | # Output of the go coverage tool, specifically when used with LiteIDE 26 | *.out 27 | 28 | # Dependency directories (remove the comment below to include it) 29 | # vendor/ 30 | 31 | dist/ 32 | .release 33 | .cr-release-packages 34 | 35 | # Helm files 36 | Chart.lock 37 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | 3 | Files: *.so *.gnmi *.png *.gif *.jpg *.mock.go **/go.mod **/go.sum **/*.pb.go api/**/*.md *.crt *.key 4 | Copyright: 2023-present Intel Corporation 5 | License: Apache-2.0 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | $(MAKE) -C api build 8 | $(MAKE) -C charts build 9 | $(MAKE) -C controller build 10 | $(MAKE) -C drivers build 11 | $(MAKE) -C logging build 12 | $(MAKE) -C protocols build 13 | $(MAKE) -C runtime build 14 | $(MAKE) -C sidecar build 15 | $(MAKE) -C stores build 16 | $(MAKE) -C testing build 17 | 18 | .PHONY: test 19 | test: 20 | $(MAKE) -C api test 21 | $(MAKE) -C bench test 22 | $(MAKE) -C charts test 23 | $(MAKE) -C controller test 24 | $(MAKE) -C drivers test 25 | $(MAKE) -C logging test 26 | $(MAKE) -C protocols test 27 | $(MAKE) -C runtime test 28 | $(MAKE) -C sidecar test 29 | $(MAKE) -C stores test 30 | $(MAKE) -C testing test 31 | 32 | .PHONY: kind 33 | kind: 34 | $(MAKE) -C controller kind 35 | $(MAKE) -C sidecar kind 36 | $(MAKE) -C stores kind 37 | -------------------------------------------------------------------------------- /api/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify API 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'api/**' 13 | pull_request: 14 | paths: 15 | - 'api/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: api 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: api 32 | -------------------------------------------------------------------------------- /api/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: go docs 7 | go build ./... 8 | 9 | .PHONY: test 10 | test: 11 | go test github.com/atomix/atomix/api/... 12 | 13 | go: 14 | @find ./runtime -name '*.pb.go' -delete 15 | docker run -i \ 16 | -v `pwd`:/build \ 17 | atomix/codegen:go-latest \ 18 | --proto-path . --go-path . --import-path github.com/atomix/atomix/api 19 | 20 | docs: 21 | @find ./runtime -name '*.md' -delete 22 | docker run -i \ 23 | -v `pwd`:/build \ 24 | atomix/codegen:docs-latest \ 25 | --proto-path . --docs-path . --docs-format markdown 26 | -------------------------------------------------------------------------------- /api/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix API 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/api-verify.yml)](https://github.com/atomix/atomix/actions/workflows/api-verify.yml) 9 | ![Go Version](https://img.shields.io/github/go-mod/go-version/atomix/atomix?label=go%20version&filename=api%2Fgo.mod) 10 | 11 | This module defines the core Protobuf API for Atomix. -------------------------------------------------------------------------------- /api/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/api 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/gogo/protobuf v1.3.2 7 | github.com/stretchr/testify v1.7.0 8 | google.golang.org/grpc v1.46.0 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.0 // indirect 13 | github.com/golang/protobuf v1.5.2 // indirect 14 | github.com/google/go-cmp v0.5.7 // indirect 15 | github.com/pmezard/go-difflib v1.0.0 // indirect 16 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 17 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 18 | golang.org/x/text v0.3.7 // indirect 19 | golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect 20 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 21 | google.golang.org/protobuf v1.28.0 // indirect 22 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /api/runtime/counter/v1/counter.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Counter" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/countermap/v1/countermap.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "CounterMap" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/election/v1/election.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "LeaderElection" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/indexedmap/v1/indexedmap.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "IndexedMap" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/list/v1/list.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "List" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/lock/v1/lock.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Lock" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/lock/v1/locks.proto: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2022-present Open Networking Foundation 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | syntax = "proto3"; 8 | 9 | package atomix.runtime.lock.v1; 10 | 11 | option java_package = "io.atomix.api.lock.v1"; 12 | option java_outer_classname = "LocksV1"; 13 | option java_multiple_files = true; 14 | 15 | import "runtime/v1/runtime.proto"; 16 | import "gogoproto/gogo.proto"; 17 | 18 | // Locks is a service for managing lock primitives 19 | service Locks { 20 | // Create creates the lock 21 | rpc Create (CreateRequest) returns (CreateResponse); 22 | 23 | // Close closes the lock 24 | rpc Close (CloseRequest) returns (CloseResponse); 25 | } 26 | 27 | message Config { 28 | 29 | } 30 | 31 | message CreateRequest { 32 | atomix.runtime.v1.PrimitiveID id = 1 [ 33 | (gogoproto.customname) = "ID", 34 | (gogoproto.nullable) = false 35 | ]; 36 | repeated string tags = 2; 37 | } 38 | 39 | message CreateResponse { 40 | Config config = 1 [ 41 | (gogoproto.nullable) = false 42 | ]; 43 | } 44 | 45 | message CloseRequest { 46 | atomix.runtime.v1.PrimitiveID id = 1 [ 47 | (gogoproto.customname) = "ID", 48 | (gogoproto.nullable) = false 49 | ]; 50 | } 51 | 52 | message CloseResponse { 53 | 54 | } 55 | -------------------------------------------------------------------------------- /api/runtime/map/v1/map.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Map" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/multimap/v1/multimap.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "MultiMap" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/set/v1/set.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Set" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/topic/v1/topic.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Topic" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /api/runtime/topic/v1/topics.proto: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2022-present Open Networking Foundation 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | syntax = "proto3"; 8 | 9 | package atomix.runtime.topic.v1; 10 | 11 | option java_package = "io.atomix.api.topic.v1"; 12 | option java_outer_classname = "TopicsV1"; 13 | option java_multiple_files = true; 14 | 15 | import "runtime/v1/runtime.proto"; 16 | import "gogoproto/gogo.proto"; 17 | 18 | // Topics is a service for managing Topic primitives 19 | service Topics { 20 | // Create creates the topic 21 | rpc Create (CreateRequest) returns (CreateResponse); 22 | 23 | // Close closes the topic 24 | rpc Close (CloseRequest) returns (CloseResponse); 25 | } 26 | 27 | message Config { 28 | 29 | } 30 | 31 | message CreateRequest { 32 | atomix.runtime.v1.PrimitiveID id = 1 [ 33 | (gogoproto.customname) = "ID", 34 | (gogoproto.nullable) = false 35 | ]; 36 | repeated string tags = 2; 37 | } 38 | 39 | message CreateResponse { 40 | Config config = 1 [ 41 | (gogoproto.nullable) = false 42 | ]; 43 | } 44 | 45 | message CloseRequest { 46 | atomix.runtime.v1.PrimitiveID id = 1 [ 47 | (gogoproto.customname) = "ID", 48 | (gogoproto.nullable) = false 49 | ]; 50 | } 51 | 52 | message CloseResponse { 53 | 54 | } 55 | -------------------------------------------------------------------------------- /api/runtime/value/v1/value.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import runtimev1 "github.com/atomix/atomix/api/runtime/v1" 8 | 9 | const ( 10 | Name = "Value" 11 | APIVersion = "v1" 12 | ) 13 | 14 | var PrimitiveType = runtimev1.PrimitiveType{ 15 | Name: Name, 16 | APIVersion: APIVersion, 17 | } 18 | -------------------------------------------------------------------------------- /chart/.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Test Atomix chart 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'chart/**' 13 | pull_request: 14 | paths: 15 | - 'chart/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test-install: 24 | runs-on: ubuntu-latest 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | 29 | - name: Setup Go 30 | uses: ./.github/actions/setup-go 31 | 32 | - name: Setup Helm 33 | uses: ./.github/actions/setup-helm 34 | 35 | - name: Create kind cluster 36 | uses: helm/kind-action@v1.4.0 37 | with: 38 | cluster_name: kind 39 | 40 | - name: Test install 41 | run: ct install --charts ./chart 42 | -------------------------------------------------------------------------------- /chart/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Atomix chart 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'chart/**' 13 | pull_request: 14 | paths: 15 | - 'chart/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | lint: 24 | runs-on: ubuntu-latest 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | 29 | - name: Setup Helm environment 30 | uses: ./.github/actions/setup-helm 31 | 32 | - name: Helm lint 33 | run: ct lint --charts ./chart --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false 34 | -------------------------------------------------------------------------------- /chart/.helmignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # Patterns to ignore when building packages. 6 | # This supports shell glob matching, relative path matching, and 7 | # negation (prefixed with !). Only one pattern per line. 8 | .DS_Store 9 | # Common VCS dirs 10 | .git/ 11 | .gitignore 12 | .bzr/ 13 | .bzrignore 14 | .hg/ 15 | .hgignore 16 | .svn/ 17 | # Common backup files 18 | *.swp 19 | *.bak 20 | *.tmp 21 | *~ 22 | # Various IDEs 23 | .project 24 | .idea/ 25 | *.tmproj 26 | .vscode/ 27 | 28 | packages/ -------------------------------------------------------------------------------- /chart/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix Helm Chart 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/atomix-test.yml)](https://github.com/atomix/atomix/actions/workflows/atomix-test.yml) 9 | 10 | This chart is an umbrella chart containing all the controllers and stores supported by Atomix. 11 | -------------------------------------------------------------------------------- /chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | stores: 6 | raft: 7 | enabled: true 8 | shared-memory: 9 | enabled: true 10 | pod-memory: 11 | enabled: true 12 | consensus: 13 | enabled: true 14 | -------------------------------------------------------------------------------- /cli/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify CLI 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'cli/**' 13 | pull_request: 14 | paths: 15 | - 'cli/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | runs-on: ubuntu-latest 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | 29 | - name: Setup Go environment 30 | uses: ./.github/actions/setup-go 31 | 32 | - name: Run tests 33 | run: go test ./... 34 | working-directory: cli 35 | 36 | lint: 37 | uses: ./.github/workflows/lint.yml 38 | with: 39 | component: cli 40 | 41 | build: 42 | runs-on: ubuntu-latest 43 | steps: 44 | - name: Checkout 45 | uses: actions/checkout@v3 46 | with: 47 | fetch-depth: 0 48 | 49 | - name: Set up Docker Buildx 50 | uses: docker/setup-buildx-action@v2 51 | 52 | - name: Build image 53 | uses: docker/build-push-action@v3 54 | with: 55 | context: cli 56 | file: cli/build/Dockerfile 57 | -------------------------------------------------------------------------------- /cli/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | docker build . -f build/Dockerfile -t atomix/build 8 | 9 | .PHONY: test 10 | test: 11 | go test ./... 12 | -------------------------------------------------------------------------------- /cli/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix CLI 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/cli-verify.yml)](https://github.com/atomix/atomix/actions/workflows/cli-verify.yml) 9 | [![Image](https://img.shields.io/docker/v/atomix/cli?label=release)](https://hub.docker.com/repository/docker/atomix/cli) 10 | -------------------------------------------------------------------------------- /cli/build/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM goreleaser/goreleaser-cross:v1.19 AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download -x 13 | 14 | COPY ./cmd ./cmd 15 | COPY ./internal ./internal 16 | 17 | RUN go build -mod=readonly -trimpath -o /build/bin/atomix ./cmd/atomix 18 | 19 | FROM goreleaser/goreleaser-cross:v1.19 20 | 21 | COPY --from=build /build/bin/atomix /usr/local/bin/atomix 22 | 23 | ENV CC=gcc 24 | ENV CXX=g++ 25 | ENV ATOMIX_CC_ENABLED=true 26 | 27 | ENTRYPOINT ["atomix"] 28 | -------------------------------------------------------------------------------- /cli/cmd/atomix/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "github.com/atomix/atomix/cli/internal/atomix" 10 | "os" 11 | ) 12 | 13 | func main() { 14 | cmd := atomix.GetCommand() 15 | if err := cmd.Execute(); err != nil { 16 | fmt.Println(err) 17 | os.Exit(1) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /cli/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/cli 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/runtime v1.1.0 7 | github.com/rogpeppe/go-internal v1.8.1 8 | github.com/spf13/cobra v1.4.0 9 | github.com/stretchr/testify v1.8.0 10 | ) 11 | 12 | require ( 13 | github.com/inconshreveable/mousetrap v1.0.0 // indirect 14 | github.com/mitchellh/go-homedir v1.1.0 // indirect 15 | github.com/spf13/pflag v1.0.5 // indirect 16 | go.uber.org/atomic v1.7.0 // indirect 17 | go.uber.org/multierr v1.6.0 // indirect 18 | go.uber.org/zap v1.24.0 // indirect 19 | gopkg.in/yaml.v3 v3.0.1 // indirect 20 | ) 21 | 22 | require ( 23 | github.com/davecgh/go-spew v1.1.1 // indirect 24 | github.com/kr/text v0.2.0 // indirect 25 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect 26 | github.com/pkg/errors v0.9.1 // indirect 27 | github.com/pmezard/go-difflib v1.0.0 // indirect 28 | go.uber.org/goleak v1.1.12 // indirect 29 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect 30 | ) 31 | -------------------------------------------------------------------------------- /cli/internal/atomix/cmd.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package atomix 6 | 7 | import ( 8 | "github.com/atomix/atomix/cli/internal/atomix/build" 9 | "github.com/atomix/atomix/runtime/pkg/logging" 10 | "github.com/spf13/cobra" 11 | "strings" 12 | ) 13 | 14 | var log = logging.GetLogger("github.com/atomix/atomix/cli") 15 | 16 | func GetCommand() *cobra.Command { 17 | cmd := &cobra.Command{ 18 | Use: "atomix", 19 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error { 20 | logLevel, err := cmd.Flags().GetString("log-level") 21 | if err != nil { 22 | return err 23 | } 24 | switch strings.ToLower(logLevel) { 25 | case "debug": 26 | log.SetLevel(logging.DebugLevel) 27 | case "info": 28 | log.SetLevel(logging.InfoLevel) 29 | case "warn": 30 | log.SetLevel(logging.WarnLevel) 31 | case "error": 32 | log.SetLevel(logging.ErrorLevel) 33 | case "fatal": 34 | log.SetLevel(logging.FatalLevel) 35 | default: 36 | log.SetLevel(logging.InfoLevel) 37 | } 38 | return nil 39 | }, 40 | } 41 | cmd.AddCommand(build.GetCommand()) 42 | cmd.PersistentFlags().StringP("log-level", "l", "info", "the log level") 43 | return cmd 44 | } 45 | -------------------------------------------------------------------------------- /cli/internal/exec/exec.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package exec 6 | 7 | import ( 8 | "io" 9 | "os" 10 | "os/exec" 11 | "strings" 12 | ) 13 | 14 | func Command(name string, args ...string) *Cmd { 15 | cmd := exec.Command(name, args...) 16 | cmd.Stdout = os.Stdout 17 | cmd.Stderr = os.Stderr 18 | cmd.Env = os.Environ() 19 | return &Cmd{ 20 | cmd: cmd, 21 | } 22 | } 23 | 24 | type Cmd struct { 25 | cmd *exec.Cmd 26 | } 27 | 28 | func (c *Cmd) Stdout(stdout io.Writer) *Cmd { 29 | c.cmd.Stdout = stdout 30 | return c 31 | } 32 | 33 | func (c *Cmd) Stderr(stderr io.Writer) *Cmd { 34 | c.cmd.Stderr = stderr 35 | return c 36 | } 37 | 38 | func (c *Cmd) Dir(dir string) *Cmd { 39 | c.cmd.Dir = dir 40 | return c 41 | } 42 | 43 | func (c *Cmd) Env(env ...string) *Cmd { 44 | c.cmd.Env = append(c.cmd.Env, env...) 45 | return c 46 | } 47 | 48 | func (c *Cmd) Run(args ...string) error { 49 | c.cmd.Args = append(c.cmd.Args, args...) 50 | println(strings.Join(c.cmd.Args, " ")) 51 | return c.cmd.Run() 52 | } 53 | 54 | func (c *Cmd) Output(args ...string) ([]byte, error) { 55 | c.cmd.Stdout = nil 56 | c.cmd.Args = append(c.cmd.Args, args...) 57 | println(strings.Join(c.cmd.Args, " ")) 58 | return c.cmd.Output() 59 | } 60 | -------------------------------------------------------------------------------- /controller/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Controller 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'controller/**' 13 | pull_request: 14 | paths: 15 | - 'controller/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: controller 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: controller 32 | chart: chart 33 | -------------------------------------------------------------------------------- /controller/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: controller-init controller 7 | 8 | controller: 9 | docker build . -f build/controller/Dockerfile -t atomix/controller 10 | 11 | controller-init: 12 | docker build . -f build/controller-init/Dockerfile -t atomix/controller-init 13 | 14 | kind: controller-kind controller-init-kind 15 | 16 | controller-kind: controller 17 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 18 | kind load docker-image atomix/controller:latest 19 | 20 | controller-init-kind: controller-init 21 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 22 | kind load docker-image atomix/controller-init:latest 23 | 24 | .PHONY: test 25 | test: 26 | go test github.com/atomix/atomix/controller/pkg/... -p 1 27 | -------------------------------------------------------------------------------- /controller/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix Controller 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/controller-verify.yml)](https://github.com/atomix/atomix/actions/workflows/controller-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/controller-test.yml)](https://github.com/atomix/atomix/actions/workflows/controller-test.yml) 10 | [![Image](https://img.shields.io/docker/v/atomix/controller?label=release)](https://hub.docker.com/repository/docker/atomix/controller) 11 | 12 | The Atomix controller handles sidecar injection and provides the base custom resources used by Atomix 13 | stores and applications. 14 | -------------------------------------------------------------------------------- /controller/build/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 -------------------------------------------------------------------------------- /controller/build/controller-init/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd ./cmd 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-controller-init -o ./bin/atomix-controller-init 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-controller-init /usr/local/bin/atomix-controller-init 28 | 29 | ENTRYPOINT ["atomix-controller-init"] 30 | -------------------------------------------------------------------------------- /controller/build/controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd ./cmd 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-controller -o ./bin/atomix-controller 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-controller /usr/local/bin/atomix-controller 28 | 29 | ENTRYPOINT ["atomix-controller"] 30 | -------------------------------------------------------------------------------- /controller/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v2 6 | name: atomix-controller 7 | description: The core Atomix controller provides custom resources for Atomix data stores 8 | kubeVersion: ">=1.17.0" 9 | type: application 10 | # The 0.0.0 version is a placeholder. The 'version' and 'appVersion' keys are 11 | # set to the version specified by the tag when the chart is packaged for release. 12 | version: 0.0.0 13 | keywords: 14 | - atomix 15 | home: https://atomix.io 16 | maintainers: 17 | - name: Jordan Halterman 18 | email: jordan.halterman@intel.com 19 | -------------------------------------------------------------------------------- /controller/chart/templates/clusterrole.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: rbac.authorization.k8s.io/v1 6 | kind: ClusterRole 7 | metadata: 8 | creationTimestamp: null 9 | name: {{ template "atomix-controller.fullname" . }} 10 | rules: 11 | - apiGroups: 12 | - "" 13 | resources: 14 | - pods 15 | - pods/status 16 | - configmaps 17 | - events 18 | verbs: 19 | - '*' 20 | - apiGroups: 21 | - "" 22 | resources: 23 | - namespaces 24 | - serviceaccounts 25 | verbs: 26 | - get 27 | - list 28 | - watch 29 | - apiGroups: 30 | - policy 31 | resources: 32 | - poddisruptionbudgets 33 | verbs: 34 | - '*' 35 | - apiGroups: 36 | - atomix.io 37 | resources: 38 | - '*' 39 | verbs: 40 | - '*' 41 | - apiGroups: 42 | - apiextensions.k8s.io 43 | resources: 44 | - customresourcedefinitions 45 | verbs: 46 | - get 47 | - list 48 | - watch 49 | - update 50 | -------------------------------------------------------------------------------- /controller/chart/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: {{ template "atomix-controller.fullname" . }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: {{ template "atomix-controller.fullname" . }} 12 | namespace: {{ .Release.Namespace }} 13 | roleRef: 14 | kind: ClusterRole 15 | name: {{ template "atomix-controller.fullname" . }} 16 | apiGroup: rbac.authorization.k8s.io -------------------------------------------------------------------------------- /controller/chart/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: {{ template "atomix-controller.fullname" . }}-config 9 | data: 10 | {{ (.Files.Glob "crds/atomix.io/*.yaml").AsConfig | indent 2 }} 11 | logging.yaml: |- 12 | loggers: 13 | root: 14 | level: {{ .Values.logging.rootLevel }} 15 | output: 16 | stdout: 17 | sink: stdout 18 | {{ toYaml .Values.logging.loggers | indent 6 }} 19 | sinks: 20 | stdout: 21 | encoding: {{ .Values.logging.encoding }} 22 | stdout: {} -------------------------------------------------------------------------------- /controller/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ template "atomix-controller.fullname" . }} 9 | labels: 10 | name: {{ template "atomix-controller.fullname" . }} 11 | spec: 12 | selector: 13 | name: {{ template "atomix-controller.fullname" . }} 14 | ports: 15 | - name: webhook 16 | port: 443 17 | targetPort: 443 -------------------------------------------------------------------------------- /controller/chart/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: {{ template "atomix-controller.fullname" . }} 9 | namespace: {{ .Release.Namespace }} -------------------------------------------------------------------------------- /controller/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | replicas: 1 6 | 7 | image: 8 | repository: atomix/controller 9 | tag: "" 10 | pullPolicy: "" 11 | pullSecrets: [] 12 | 13 | init: 14 | image: 15 | repository: atomix/controller-init 16 | tag: "" 17 | pullPolicy: "" 18 | pullSecrets: [] 19 | 20 | logging: 21 | rootLevel: info 22 | encoding: console 23 | loggers: 24 | github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors: 25 | level: error 26 | -------------------------------------------------------------------------------- /controller/pkg/apis/apis.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package apis 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/runtime" 9 | ) 10 | 11 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 12 | var AddToSchemes runtime.SchemeBuilder 13 | 14 | // AddToScheme adds all Resources to the Scheme 15 | func AddToScheme(s *runtime.Scheme) error { 16 | if err := AddToSchemes.AddToScheme(s); err != nil { 17 | return err 18 | } 19 | if err := RegisterConversions(s); err != nil { 20 | return err 21 | } 22 | return nil 23 | } 24 | 25 | func RegisterConversions(s *runtime.Scheme) error { 26 | if err := registerConversions_v3beta3(s); err != nil { 27 | return err 28 | } 29 | if err := registerConversions_v3beta4(s); err != nil { 30 | return err 31 | } 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /controller/pkg/apis/atomix/v3beta3/datastore.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Open Networking Foundation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v3beta3 6 | 7 | import ( 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 | "k8s.io/apimachinery/pkg/runtime" 10 | ) 11 | 12 | // +genclient 13 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 14 | 15 | // DataStore is a specification for a DataStore resource 16 | type DataStore struct { 17 | metav1.TypeMeta `json:",inline"` 18 | metav1.ObjectMeta `json:"metadata,omitempty"` 19 | 20 | Spec DataStoreSpec `json:"spec"` 21 | } 22 | 23 | // DataStoreSpec is the spec for a DataStore resource 24 | type DataStoreSpec struct { 25 | Driver Driver `json:"driver"` 26 | Config runtime.RawExtension `json:"config"` 27 | } 28 | 29 | type Driver struct { 30 | Name string `json:"name"` 31 | Version string `json:"version"` 32 | } 33 | 34 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 35 | 36 | // DataStoreList is a list of DataStore resources 37 | type DataStoreList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | metav1.ListMeta `json:"metadata"` 40 | 41 | Items []DataStore `json:"items"` 42 | } 43 | -------------------------------------------------------------------------------- /controller/pkg/apis/atomix/v3beta3/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v3beta3 contains API Schema definitions for the cloud v3beta3 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=atomix.io 8 | package v3beta3 9 | -------------------------------------------------------------------------------- /controller/pkg/apis/atomix/v3beta4/datastore.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Open Networking Foundation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v3beta4 6 | 7 | import ( 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 | "k8s.io/apimachinery/pkg/runtime" 10 | ) 11 | 12 | // +genclient 13 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 14 | 15 | // DataStore is a specification for a DataStore resource 16 | type DataStore struct { 17 | metav1.TypeMeta `json:",inline"` 18 | metav1.ObjectMeta `json:"metadata,omitempty"` 19 | 20 | Spec DataStoreSpec `json:"spec"` 21 | } 22 | 23 | // DataStoreSpec is the spec for a DataStore resource 24 | type DataStoreSpec struct { 25 | Driver Driver `json:"driver"` 26 | Config runtime.RawExtension `json:"config"` 27 | } 28 | 29 | type Driver struct { 30 | Name string `json:"name"` 31 | APIVersion string `json:"apiVersion"` 32 | } 33 | 34 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 35 | 36 | // DataStoreList is a list of DataStore resources 37 | type DataStoreList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | metav1.ListMeta `json:"metadata"` 40 | 41 | Items []DataStore `json:"items"` 42 | } 43 | -------------------------------------------------------------------------------- /controller/pkg/apis/atomix/v3beta4/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v3beta4 contains API Schema definitions for the cloud v3beta4 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=atomix.io 8 | package v3beta4 9 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated clientset. 7 | package versioned 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated fake clientset. 7 | package fake 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package contains the scheme of the automatically generated clientset. 7 | package scheme 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta3/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v3beta3 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta3/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta3/fake/fake_atomix_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v3beta3 "github.com/atomix/atomix/controller/pkg/client/clientset/versioned/typed/atomix/v3beta3" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeAtomixV3beta3 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeAtomixV3beta3) DataStores(namespace string) v3beta3.DataStoreInterface { 19 | return &FakeDataStores{c, namespace} 20 | } 21 | 22 | func (c *FakeAtomixV3beta3) StorageProfiles(namespace string) v3beta3.StorageProfileInterface { 23 | return &FakeStorageProfiles{c, namespace} 24 | } 25 | 26 | // RESTClient returns a RESTClient that is used to communicate 27 | // with API server by this client implementation. 28 | func (c *FakeAtomixV3beta3) RESTClient() rest.Interface { 29 | var ret *rest.RESTClient 30 | return ret 31 | } 32 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta3/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v3beta3 7 | 8 | type DataStoreExpansion interface{} 9 | 10 | type StorageProfileExpansion interface{} 11 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta4/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v3beta4 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta4/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta4/fake/fake_atomix_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v3beta4 "github.com/atomix/atomix/controller/pkg/client/clientset/versioned/typed/atomix/v3beta4" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeAtomixV3beta4 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeAtomixV3beta4) DataStores(namespace string) v3beta4.DataStoreInterface { 19 | return &FakeDataStores{c, namespace} 20 | } 21 | 22 | func (c *FakeAtomixV3beta4) StorageProfiles(namespace string) v3beta4.StorageProfileInterface { 23 | return &FakeStorageProfiles{c, namespace} 24 | } 25 | 26 | // RESTClient returns a RESTClient that is used to communicate 27 | // with API server by this client implementation. 28 | func (c *FakeAtomixV3beta4) RESTClient() rest.Interface { 29 | var ret *rest.RESTClient 30 | return ret 31 | } 32 | -------------------------------------------------------------------------------- /controller/pkg/client/clientset/versioned/typed/atomix/v3beta4/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v3beta4 7 | 8 | type DataStoreExpansion interface{} 9 | 10 | type StorageProfileExpansion interface{} 11 | -------------------------------------------------------------------------------- /controller/pkg/controller/atomix/v3beta4/controller.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v3beta4 6 | 7 | import ( 8 | "github.com/atomix/atomix/runtime/pkg/logging" 9 | "sigs.k8s.io/controller-runtime/pkg/manager" 10 | ) 11 | 12 | var log = logging.GetLogger() 13 | 14 | // AddControllers adds sidecar controllers to the given manager 15 | func AddControllers(mgr manager.Manager) error { 16 | if err := addRuntimeController(mgr); err != nil { 17 | return err 18 | } 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /controller/pkg/controller/util/k8s/env.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package k8s 6 | 7 | import ( 8 | "fmt" 9 | "os" 10 | ) 11 | 12 | const ( 13 | nameEnv = "CONTROLLER_NAME" 14 | namespaceEnv = "CONTROLLER_NAMESPACE" 15 | ) 16 | 17 | const ( 18 | defaultNamespace = "kube-system" 19 | ) 20 | 21 | // GetName : 22 | func GetName() string { 23 | name := os.Getenv(nameEnv) 24 | if name == "" { 25 | panic(fmt.Sprintf("'%s' environment variable not defined", nameEnv)) 26 | } 27 | return name 28 | } 29 | 30 | // GetNamespace : 31 | func GetNamespace() string { 32 | namespace := os.Getenv(namespaceEnv) 33 | if namespace != "" { 34 | return namespace 35 | } 36 | return defaultNamespace 37 | } 38 | -------------------------------------------------------------------------------- /drivers/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | $(MAKE) -C etcd build 8 | $(MAKE) -C pod-memory build 9 | $(MAKE) -C raft build 10 | $(MAKE) -C redis build 11 | $(MAKE) -C shared-memory build 12 | 13 | .PHONY: test 14 | test: 15 | $(MAKE) -C etcd test 16 | $(MAKE) -C pod-memory test 17 | $(MAKE) -C raft test 18 | $(MAKE) -C redis test 19 | $(MAKE) -C shared-memory test 20 | -------------------------------------------------------------------------------- /drivers/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Drivers 7 | 8 | This folder contains drivers for databases and protocols supported by Atomix. Each driver is defined 9 | as a separate Go module. Drivers are compiled into plugins and packaged in the proxy image. 10 | -------------------------------------------------------------------------------- /drivers/etcd/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Etcd Driver 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'drivers/etcd/**' 13 | pull_request: 14 | paths: 15 | - 'drivers/etcd/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: drivers/etcd 27 | package: github.com/atomix/atomix/drivers/etcd/v3/... 28 | 29 | lint: 30 | uses: ./.github/workflows/lint.yml 31 | with: 32 | component: drivers/etcd 33 | -------------------------------------------------------------------------------- /drivers/etcd/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | go build ./v3/driver/... -------------------------------------------------------------------------------- /drivers/etcd/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Etcd Driver 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-etcd-verify.yml)](https://github.com/atomix/atomix/actions/workflows/drivers-etcd-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-etcd-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/drivers-etcd-test.yml) 10 | 11 | This module implements an etcd driver. 12 | -------------------------------------------------------------------------------- /drivers/etcd/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/drivers/etcd 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/atomix/atomix/runtime v1.1.1 8 | go.etcd.io/etcd/api/v3 v3.5.6 9 | go.etcd.io/etcd/client/v3 v3.5.6 10 | ) 11 | 12 | require ( 13 | github.com/coreos/go-semver v0.3.0 // indirect 14 | github.com/coreos/go-systemd/v22 v22.3.2 // indirect 15 | github.com/gogo/protobuf v1.3.2 // indirect 16 | github.com/golang/protobuf v1.5.2 // indirect 17 | github.com/mitchellh/go-homedir v1.1.0 // indirect 18 | go.etcd.io/etcd/client/pkg/v3 v3.5.6 // indirect 19 | go.uber.org/atomic v1.7.0 // indirect 20 | go.uber.org/multierr v1.6.0 // indirect 21 | go.uber.org/zap v1.24.0 // indirect 22 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 23 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 24 | golang.org/x/text v0.3.7 // indirect 25 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 26 | google.golang.org/grpc v1.46.0 // indirect 27 | google.golang.org/protobuf v1.28.0 // indirect 28 | gopkg.in/yaml.v3 v3.0.1 // indirect 29 | ) 30 | -------------------------------------------------------------------------------- /drivers/etcd/tests/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS sidecar-builder 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY ./sidecar/go.mod ./sidecar/go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./sidecar/cmd ./cmd 15 | COPY ./sidecar/pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar -o ./bin/atomix-sidecar 18 | 19 | FROM atomix/build AS driver-builder 20 | 21 | RUN mkdir /build 22 | WORKDIR /build 23 | 24 | COPY ./drivers/etcd/go.mod ./drivers/etcd/go.sum ./ 25 | 26 | RUN go mod download 27 | 28 | COPY ./drivers/etcd/v3 ./v3 29 | 30 | RUN atomix build plugin -o ./bin/driver.so ./v3 31 | 32 | # Pull binaries and plugins into the Alpine image 33 | FROM alpine:3.15 34 | 35 | RUN apk add libc6-compat 36 | 37 | RUN addgroup -S atomix && adduser -S -G atomix atomix 38 | 39 | USER atomix 40 | 41 | COPY --from=sidecar-builder /build/bin/atomix-sidecar /usr/local/bin/atomix-sidecar 42 | COPY --from=driver-builder /build/bin/driver.so /var/atomix/plugins/atomix.io/etcd@v3.so 43 | 44 | ENTRYPOINT ["atomix-sidecar"] 45 | -------------------------------------------------------------------------------- /drivers/etcd/v3/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | "github.com/atomix/atomix/runtime/pkg/driver" 10 | "github.com/atomix/atomix/runtime/pkg/logging" 11 | clientv3 "go.etcd.io/etcd/client/v3" 12 | ) 13 | 14 | var log = logging.GetLogger() 15 | 16 | func New() driver.Driver { 17 | return &etcdDriver{} 18 | } 19 | 20 | type etcdDriver struct{} 21 | 22 | func (d *etcdDriver) Connect(ctx context.Context, config clientv3.Config) (driver.Conn, error) { 23 | client, err := clientv3.New(config) 24 | if err != nil { 25 | log.Error(err) 26 | return nil, err 27 | } 28 | return newConn(client) 29 | } 30 | -------------------------------------------------------------------------------- /drivers/etcd/v3/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/etcd/v3/driver" 9 | ) 10 | 11 | var Plugin = driver.New() 12 | -------------------------------------------------------------------------------- /drivers/pod-memory/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify pod-memory Driver 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'drivers/pod-memory/**' 13 | pull_request: 14 | paths: 15 | - 'drivers/pod-memory/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: drivers/pod-memory 27 | package: github.com/atomix/atomix/drivers/pod-memory/v1/... 28 | 29 | lint: 30 | uses: ./.github/workflows/lint.yml 31 | with: 32 | component: drivers/pod-memory 33 | -------------------------------------------------------------------------------- /drivers/pod-memory/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | go build ./v1/driver/... 8 | -------------------------------------------------------------------------------- /drivers/pod-memory/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Pod Memory Storage Driver 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-pod-memory-verify.yml)](https://github.com/atomix/atomix/actions/workflows/drivers-pod-memory-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-pod-memory-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/drivers-pod-memory-test.yml) 10 | 11 | This module implements a driver for pod-local memory storage. 12 | -------------------------------------------------------------------------------- /drivers/pod-memory/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/drivers/pod-memory 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/atomix/atomix/protocols/rsm v1.1.1 8 | github.com/atomix/atomix/runtime v1.1.1 9 | ) 10 | 11 | require ( 12 | github.com/bits-and-blooms/bitset v1.3.1 // indirect 13 | github.com/bits-and-blooms/bloom/v3 v3.3.1 // indirect 14 | github.com/cenkalti/backoff v2.2.1+incompatible // indirect 15 | github.com/gogo/protobuf v1.3.2 // indirect 16 | github.com/golang/mock v1.6.0 // indirect 17 | github.com/golang/protobuf v1.5.2 // indirect 18 | github.com/google/uuid v1.1.2 // indirect 19 | github.com/kr/text v0.1.0 // indirect 20 | github.com/mitchellh/go-homedir v1.1.0 // indirect 21 | go.uber.org/atomic v1.7.0 // indirect 22 | go.uber.org/multierr v1.6.0 // indirect 23 | go.uber.org/zap v1.24.0 // indirect 24 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 25 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 26 | golang.org/x/text v0.3.7 // indirect 27 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 28 | google.golang.org/grpc v1.46.0 // indirect 29 | google.golang.org/protobuf v1.28.0 // indirect 30 | gopkg.in/yaml.v3 v3.0.1 // indirect 31 | ) 32 | -------------------------------------------------------------------------------- /drivers/pod-memory/tests/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS sidecar-builder 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY ./sidecar/go.mod ./sidecar/go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./sidecar/cmd ./cmd 15 | COPY ./sidecar/pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar -o ./bin/atomix-sidecar 18 | 19 | FROM atomix/build AS driver-builder 20 | 21 | RUN mkdir /build 22 | WORKDIR /build 23 | 24 | COPY ./drivers/pod-memory/go.mod ./drivers/pod-memory/go.sum ./ 25 | 26 | RUN go mod download 27 | 28 | COPY ./drivers/pod-memory/v1 ./v1 29 | 30 | RUN atomix build plugin -o ./bin/driver.so ./v1 31 | 32 | # Pull binaries and plugins into the Alpine image 33 | FROM alpine:3.15 34 | 35 | RUN apk add libc6-compat 36 | 37 | RUN addgroup -S atomix && adduser -S -G atomix atomix 38 | 39 | USER atomix 40 | 41 | COPY --from=sidecar-builder /build/bin/atomix-sidecar /usr/local/bin/atomix-sidecar 42 | COPY --from=driver-builder /build/bin/driver.so /var/atomix/plugins/atomix.io/pod-memory@v1.so 43 | 44 | ENTRYPOINT ["atomix-sidecar"] 45 | -------------------------------------------------------------------------------- /drivers/pod-memory/v1/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | rsmapiv1 "github.com/atomix/atomix/protocols/rsm/api/v1" 10 | "github.com/atomix/atomix/runtime/pkg/driver" 11 | "github.com/atomix/atomix/runtime/pkg/network" 12 | ) 13 | 14 | func New(network network.Driver) driver.Driver { 15 | return &podMemoryDriver{ 16 | network: network, 17 | } 18 | } 19 | 20 | type podMemoryDriver struct { 21 | network network.Driver 22 | } 23 | 24 | func (d *podMemoryDriver) Connect(ctx context.Context, spec rsmapiv1.ProtocolConfig) (driver.Conn, error) { 25 | conn := newConn(d.network) 26 | if err := conn.Connect(ctx); err != nil { 27 | return nil, err 28 | } 29 | return conn, nil 30 | } 31 | -------------------------------------------------------------------------------- /drivers/pod-memory/v1/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/pod-memory/v1/driver" 9 | "github.com/atomix/atomix/runtime/pkg/network" 10 | ) 11 | 12 | var Plugin = driver.New(network.NewLocalDriver()) 13 | -------------------------------------------------------------------------------- /drivers/raft/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Raft Driver 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'drivers/raft/**' 13 | pull_request: 14 | paths: 15 | - 'drivers/raft/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: drivers/raft 27 | package: github.com/atomix/atomix/drivers/raft/v1/... 28 | 29 | lint: 30 | uses: ./.github/workflows/lint.yml 31 | with: 32 | component: drivers/raft 33 | -------------------------------------------------------------------------------- /drivers/raft/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | go build ./v1/driver/... 8 | -------------------------------------------------------------------------------- /drivers/raft/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Raft Storage Driver 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-raft-verify.yml)](https://github.com/atomix/atomix/actions/workflows/drivers-raft-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-raft-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/drivers-raft-test.yml) 10 | 11 | This module implements a driver for Raft consensus storage. 12 | -------------------------------------------------------------------------------- /drivers/raft/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/drivers/raft 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/atomix/atomix/protocols/rsm v1.1.1 8 | github.com/atomix/atomix/runtime v1.1.1 9 | ) 10 | 11 | require ( 12 | github.com/bits-and-blooms/bitset v1.3.1 // indirect 13 | github.com/bits-and-blooms/bloom/v3 v3.3.1 // indirect 14 | github.com/cenkalti/backoff v2.2.1+incompatible // indirect 15 | github.com/gogo/protobuf v1.3.2 // indirect 16 | github.com/golang/mock v1.6.0 // indirect 17 | github.com/golang/protobuf v1.5.2 // indirect 18 | github.com/kr/text v0.1.0 // indirect 19 | github.com/mitchellh/go-homedir v1.1.0 // indirect 20 | go.uber.org/atomic v1.7.0 // indirect 21 | go.uber.org/multierr v1.6.0 // indirect 22 | go.uber.org/zap v1.24.0 // indirect 23 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 24 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 25 | golang.org/x/text v0.3.7 // indirect 26 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 27 | google.golang.org/grpc v1.46.0 // indirect 28 | google.golang.org/protobuf v1.28.0 // indirect 29 | gopkg.in/yaml.v3 v3.0.1 // indirect 30 | ) 31 | -------------------------------------------------------------------------------- /drivers/raft/tests/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS sidecar-builder 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY ./sidecar/go.mod ./sidecar/go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./sidecar/cmd ./cmd 15 | COPY ./sidecar/pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar -o ./bin/atomix-sidecar 18 | 19 | FROM atomix/build AS driver-builder 20 | 21 | RUN mkdir /build 22 | WORKDIR /build 23 | 24 | COPY ./drivers/raft/go.mod ./drivers/raft/go.sum ./ 25 | 26 | RUN go mod download 27 | 28 | COPY ./drivers/raft/v1 ./v1 29 | 30 | RUN atomix build plugin -o ./bin/driver.so ./v1 31 | 32 | # Pull binaries and plugins into the Alpine image 33 | FROM alpine:3.15 34 | 35 | RUN apk add libc6-compat 36 | 37 | RUN addgroup -S atomix && adduser -S -G atomix atomix 38 | 39 | USER atomix 40 | 41 | COPY --from=sidecar-builder /build/bin/atomix-sidecar /usr/local/bin/atomix-sidecar 42 | COPY --from=driver-builder /build/bin/driver.so /var/atomix/plugins/atomix.io/raft@v1.so 43 | 44 | ENTRYPOINT ["atomix-sidecar"] 45 | -------------------------------------------------------------------------------- /drivers/raft/v1/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | rsmapiv1 "github.com/atomix/atomix/protocols/rsm/api/v1" 10 | "github.com/atomix/atomix/runtime/pkg/driver" 11 | "github.com/atomix/atomix/runtime/pkg/network" 12 | ) 13 | 14 | func New(network network.Driver) driver.Driver { 15 | return &raftDriver{ 16 | network: network, 17 | } 18 | } 19 | 20 | type raftDriver struct { 21 | network network.Driver 22 | } 23 | 24 | func (d *raftDriver) Connect(ctx context.Context, config *rsmapiv1.ProtocolConfig) (driver.Conn, error) { 25 | conn := newConn(d.network) 26 | if err := conn.Connect(ctx, config); err != nil { 27 | return nil, err 28 | } 29 | return conn, nil 30 | } 31 | -------------------------------------------------------------------------------- /drivers/raft/v1/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/raft/v1/driver" 9 | "github.com/atomix/atomix/runtime/pkg/network" 10 | ) 11 | 12 | var Plugin = driver.New(network.NewDefaultDriver()) 13 | -------------------------------------------------------------------------------- /drivers/redis/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Redis Driver v8 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'drivers/redis/**' 13 | pull_request: 14 | paths: 15 | - 'drivers/redis/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test-v8: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: drivers/redis 27 | package: github.com/atomix/atomix/drivers/redis/v8/... 28 | 29 | lint-v8: 30 | uses: ./.github/workflows/lint.yml 31 | with: 32 | component: drivers/redis 33 | 34 | test-v9: 35 | uses: ./.github/workflows/test.yml 36 | with: 37 | component: drivers/redis 38 | package: github.com/atomix/atomix/drivers/redis/v9/... 39 | 40 | lint-v9: 41 | uses: ./.github/workflows/lint.yml 42 | with: 43 | component: drivers/redis -------------------------------------------------------------------------------- /drivers/redis/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | go build ./v8/driver/... 8 | go build ./v9/driver/... 9 | -------------------------------------------------------------------------------- /drivers/redis/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Redis Driver 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-redis-verify.yml)](https://github.com/atomix/atomix/actions/workflows/drivers-redis-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-redis-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/drivers-redis-test.yml) 10 | 11 | This module implements a Redis storage driver. 12 | -------------------------------------------------------------------------------- /drivers/redis/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/drivers/redis 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/atomix/atomix/runtime v1.1.1 8 | github.com/go-redis/redis/v8 v8.11.5 9 | github.com/go-redis/redis/v9 v9.0.0-beta.1 10 | ) 11 | 12 | require ( 13 | github.com/cespare/xxhash/v2 v2.1.2 // indirect 14 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect 15 | github.com/gogo/protobuf v1.3.2 // indirect 16 | github.com/golang/protobuf v1.5.2 // indirect 17 | github.com/kr/pretty v0.1.0 // indirect 18 | github.com/mitchellh/go-homedir v1.1.0 // indirect 19 | github.com/pkg/errors v0.9.1 // indirect 20 | go.uber.org/atomic v1.7.0 // indirect 21 | go.uber.org/multierr v1.6.0 // indirect 22 | go.uber.org/zap v1.24.0 // indirect 23 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 24 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 25 | golang.org/x/text v0.3.7 // indirect 26 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 27 | google.golang.org/grpc v1.46.0 // indirect 28 | google.golang.org/protobuf v1.28.0 // indirect 29 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect 30 | gopkg.in/yaml.v3 v3.0.1 // indirect 31 | ) 32 | -------------------------------------------------------------------------------- /drivers/redis/v8/driver/conn.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | runtimev1 "github.com/atomix/atomix/api/runtime/v1" 10 | redissetv1 "github.com/atomix/atomix/drivers/redis/v8/driver/set/v1" 11 | "github.com/atomix/atomix/runtime/pkg/driver" 12 | runtimesetv1 "github.com/atomix/atomix/runtime/pkg/runtime/set/v1" 13 | "github.com/go-redis/redis/v8" 14 | ) 15 | 16 | func newConn(client *redis.Client) driver.Conn { 17 | return &redisConn{ 18 | client: client, 19 | } 20 | } 21 | 22 | type redisConn struct { 23 | client *redis.Client 24 | } 25 | 26 | func (c *redisConn) NewSetV1(context.Context, runtimev1.PrimitiveID) (runtimesetv1.SetProxy, error) { 27 | return redissetv1.NewSet(c.client), nil 28 | } 29 | 30 | func (c *redisConn) Close(ctx context.Context) error { 31 | return c.client.Close() 32 | } 33 | 34 | var _ runtimesetv1.SetProvider = (*redisConn)(nil) 35 | -------------------------------------------------------------------------------- /drivers/redis/v8/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | "github.com/atomix/atomix/runtime/pkg/driver" 10 | "github.com/go-redis/redis/v8" 11 | ) 12 | 13 | func New() driver.Driver { 14 | return &redisDriver{} 15 | } 16 | 17 | type redisDriver struct{} 18 | 19 | func (d *redisDriver) Connect(ctx context.Context, options *redis.Options) (driver.Conn, error) { 20 | client := redis.NewClient(options) 21 | return newConn(client), nil 22 | } 23 | -------------------------------------------------------------------------------- /drivers/redis/v8/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/redis/v8/driver" 9 | ) 10 | 11 | var Plugin = driver.New() 12 | -------------------------------------------------------------------------------- /drivers/redis/v9/driver/conn.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | setv1 "github.com/atomix/atomix/api/runtime/set/v1" 10 | redissetv1 "github.com/atomix/atomix/drivers/redis/v9/driver/set/v1" 11 | "github.com/atomix/atomix/runtime/pkg/driver" 12 | "github.com/go-redis/redis/v9" 13 | ) 14 | 15 | func newConn(client *redis.Client) driver.Conn { 16 | return &redisConn{ 17 | client: client, 18 | } 19 | } 20 | 21 | type redisConn struct { 22 | client *redis.Client 23 | } 24 | 25 | func (c *redisConn) NewSetV1() setv1.SetServer { 26 | return redissetv1.NewSet(c.client) 27 | } 28 | 29 | func (c *redisConn) Close(ctx context.Context) error { 30 | return c.client.Close() 31 | } 32 | -------------------------------------------------------------------------------- /drivers/redis/v9/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | "github.com/atomix/atomix/runtime/pkg/driver" 10 | "github.com/go-redis/redis/v9" 11 | ) 12 | 13 | func New() driver.Driver { 14 | return &redisDriver{} 15 | } 16 | 17 | type redisDriver struct{} 18 | 19 | func (d *redisDriver) Connect(ctx context.Context, options *redis.Options) (driver.Conn, error) { 20 | client := redis.NewClient(options) 21 | return newConn(client), nil 22 | } 23 | -------------------------------------------------------------------------------- /drivers/redis/v9/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/redis/v9/driver" 9 | ) 10 | 11 | var Plugin = driver.New() 12 | -------------------------------------------------------------------------------- /drivers/shared-memory/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify shared-memory Driver 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'drivers/shared-memory/**' 13 | pull_request: 14 | paths: 15 | - 'drivers/shared-memory/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: drivers/shared-memory 27 | package: github.com/atomix/atomix/drivers/shared-memory/v1/... 28 | 29 | lint: 30 | uses: ./.github/workflows/lint.yml 31 | with: 32 | component: drivers/shared-memory 33 | -------------------------------------------------------------------------------- /drivers/shared-memory/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | go build ./v1/driver/... 8 | -------------------------------------------------------------------------------- /drivers/shared-memory/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Shared Memory Storage Driver 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-shared-memory-verify.yml)](https://github.com/atomix/atomix/actions/workflows/drivers-shared-memory-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/drivers-shared-memory-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/drivers-shared-memory-test.yml) 10 | 11 | This module implements a driver for shared memory storage. 12 | -------------------------------------------------------------------------------- /drivers/shared-memory/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/drivers/shared-memory 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/atomix/atomix/protocols/rsm v1.1.1 8 | github.com/atomix/atomix/runtime v1.1.1 9 | ) 10 | 11 | require ( 12 | github.com/bits-and-blooms/bitset v1.3.1 // indirect 13 | github.com/bits-and-blooms/bloom/v3 v3.3.1 // indirect 14 | github.com/cenkalti/backoff v2.2.1+incompatible // indirect 15 | github.com/gogo/protobuf v1.3.2 // indirect 16 | github.com/golang/mock v1.6.0 // indirect 17 | github.com/golang/protobuf v1.5.2 // indirect 18 | github.com/kr/text v0.1.0 // indirect 19 | github.com/mitchellh/go-homedir v1.1.0 // indirect 20 | go.uber.org/atomic v1.7.0 // indirect 21 | go.uber.org/multierr v1.6.0 // indirect 22 | go.uber.org/zap v1.24.0 // indirect 23 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 24 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 25 | golang.org/x/text v0.3.7 // indirect 26 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 27 | google.golang.org/grpc v1.46.0 // indirect 28 | google.golang.org/protobuf v1.28.0 // indirect 29 | gopkg.in/yaml.v3 v3.0.1 // indirect 30 | ) 31 | -------------------------------------------------------------------------------- /drivers/shared-memory/tests/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS sidecar-builder 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY ./sidecar/go.mod ./sidecar/go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./sidecar/cmd ./cmd 15 | COPY ./sidecar/pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar -o ./bin/atomix-sidecar 18 | 19 | FROM atomix/build AS driver-builder 20 | 21 | RUN mkdir /build 22 | WORKDIR /build 23 | 24 | COPY ./drivers/shared-memory/go.mod ./drivers/shared-memory/go.sum ./ 25 | 26 | RUN go mod download 27 | 28 | COPY ./drivers/shared-memory/v1 ./v1 29 | 30 | RUN atomix build plugin -o ./bin/driver.so ./v1 31 | 32 | # Pull binaries and plugins into the Alpine image 33 | FROM alpine:3.15 34 | 35 | RUN apk add libc6-compat 36 | 37 | RUN addgroup -S atomix && adduser -S -G atomix atomix 38 | 39 | USER atomix 40 | 41 | COPY --from=sidecar-builder /build/bin/atomix-sidecar /usr/local/bin/atomix-sidecar 42 | COPY --from=driver-builder /build/bin/driver.so /var/atomix/plugins/atomix.io/shared-memory@v1.so 43 | 44 | ENTRYPOINT ["atomix-sidecar"] 45 | -------------------------------------------------------------------------------- /drivers/shared-memory/v1/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | rsmapiv1 "github.com/atomix/atomix/protocols/rsm/api/v1" 10 | "github.com/atomix/atomix/runtime/pkg/driver" 11 | "github.com/atomix/atomix/runtime/pkg/network" 12 | ) 13 | 14 | func New(network network.Driver) driver.Driver { 15 | return &sharedMemoryDriver{ 16 | network: network, 17 | } 18 | } 19 | 20 | type sharedMemoryDriver struct { 21 | network network.Driver 22 | } 23 | 24 | func (d *sharedMemoryDriver) Connect(ctx context.Context, config *rsmapiv1.ProtocolConfig) (driver.Conn, error) { 25 | conn := newConn(d.network) 26 | if err := conn.Connect(ctx, config); err != nil { 27 | return nil, err 28 | } 29 | return conn, nil 30 | } 31 | -------------------------------------------------------------------------------- /drivers/shared-memory/v1/plugin.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/atomix/atomix/drivers/shared-memory/v1/driver" 9 | "github.com/atomix/atomix/runtime/pkg/network" 10 | ) 11 | 12 | var Plugin = driver.New(network.NewDefaultDriver()) 13 | -------------------------------------------------------------------------------- /examples/pod-memory-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: podmemory.atomix.io/v1beta1 6 | kind: PodMemoryStore 7 | metadata: 8 | name: pod-memory-example-store 9 | --- 10 | apiVersion: atomix.io/v3beta4 11 | kind: StorageProfile 12 | metadata: 13 | name: pod-memory-example 14 | spec: 15 | # Route the profile to the pod-memory-example-store 16 | routes: 17 | - store: 18 | name: pod-memory-example-store 19 | --- 20 | apiVersion: apps/v1 21 | kind: Deployment 22 | metadata: 23 | name: pod-memory-example 24 | labels: 25 | app: pod-memory-example 26 | spec: 27 | replicas: 1 28 | selector: 29 | matchLabels: 30 | app: pod-memory-example 31 | template: 32 | metadata: 33 | labels: 34 | app: pod-memory-example 35 | # Inject the sidecar into the pods 36 | sidecar.atomix.io/inject: "true" 37 | # Configure the sidecar to use the pod-memory-example profile 38 | runtime.atomix.io/profile: pod-memory-example 39 | spec: 40 | containers: 41 | - name: sleep 42 | image: alpine:latest 43 | command: ["/bin/sh", "-c", "--"] 44 | args: ["while true; do sleep 30; done;"] 45 | -------------------------------------------------------------------------------- /examples/profiles/single-store-v3beta3.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: atomix.io/v3beta3 6 | kind: StorageProfile 7 | metadata: 8 | name: single-store 9 | spec: 10 | bindings: 11 | - store: 12 | name: single-store -------------------------------------------------------------------------------- /examples/profiles/single-store-v3beta4.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: atomix.io/v3beta4 6 | kind: StorageProfile 7 | metadata: 8 | name: single-store 9 | spec: 10 | routes: 11 | - store: 12 | name: single-store -------------------------------------------------------------------------------- /examples/shared-memory-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: sharedmemory.atomix.io/v1beta1 6 | kind: SharedMemoryStore 7 | metadata: 8 | name: shared-memory-example-store 9 | --- 10 | apiVersion: atomix.io/v3beta4 11 | kind: StorageProfile 12 | metadata: 13 | name: shared-memory-example 14 | spec: 15 | # Route the profile to the shared-memory-example-store 16 | routes: 17 | - store: 18 | name: shared-memory-example-store 19 | --- 20 | apiVersion: apps/v1 21 | kind: Deployment 22 | metadata: 23 | name: shared-memory-example 24 | labels: 25 | app: shared-memory-example 26 | spec: 27 | replicas: 1 28 | selector: 29 | matchLabels: 30 | app: shared-memory-example 31 | template: 32 | metadata: 33 | labels: 34 | app: shared-memory-example 35 | # Inject the sidecar into the pods 36 | sidecar.atomix.io/inject: "true" 37 | # Configure the sidecar to use the shared-memory-example profile 38 | runtime.atomix.io/profile: shared-memory-example 39 | spec: 40 | containers: 41 | - name: sleep 42 | image: alpine:latest 43 | command: ["/bin/sh", "-c", "--"] 44 | args: ["while true; do sleep 30; done;"] 45 | -------------------------------------------------------------------------------- /examples/stores/etcd-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # Create a DataStore with the configuration for the store 6 | apiVersion: atomix.io/v3beta4 7 | kind: DataStore 8 | metadata: 9 | name: etcd-store 10 | spec: 11 | # Configure the DataStore to use the etcd driver with the v3 API 12 | driver: 13 | name: atomix.io/etcd 14 | apiVersion: v3 15 | # Define the configuration to be passed to the driver to connect to the store 16 | config: 17 | endpoints: 18 | - etcd:2379 19 | -------------------------------------------------------------------------------- /examples/stores/multi-raft-store-v1beta2.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # A Raft cluster with 5 replicas 6 | apiVersion: raft.atomix.io/v1beta2 7 | kind: RaftCluster 8 | metadata: 9 | name: multi-raft-cluster 10 | spec: 11 | replicas: 5 12 | --- 13 | # A horizontally scalable sharded Raft store with 30 partitions 14 | apiVersion: raft.atomix.io/v1beta2 15 | kind: RaftStore 16 | metadata: 17 | name: raft-store-1 18 | spec: 19 | cluster: 20 | name: multi-raft-cluster 21 | partitions: 30 22 | replicationFactor: 3 23 | --- 24 | # A traditional consensus store with a single Raft group replicates across all 5 replicas in the RaftCluster 25 | apiVersion: raft.atomix.io/v1beta2 26 | kind: RaftStore 27 | metadata: 28 | name: raft-store-2 29 | spec: 30 | cluster: 31 | name: multi-raft-cluster 32 | partitions: 1 33 | replicationFactor: 5 34 | -------------------------------------------------------------------------------- /examples/stores/multi-raft-store-v1beta3.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # A Raft cluster with 5 replicas 6 | apiVersion: raft.atomix.io/v1beta3 7 | kind: RaftCluster 8 | metadata: 9 | name: multi-raft-cluster 10 | spec: 11 | replicas: 5 12 | persistence: 13 | size: 1Gi 14 | --- 15 | # A horizontally scalable sharded Raft store with 30 partitions 16 | apiVersion: raft.atomix.io/v1beta3 17 | kind: RaftStore 18 | metadata: 19 | name: raft-store-1 20 | spec: 21 | cluster: 22 | name: multi-raft-cluster 23 | partitions: 30 24 | replicationFactor: 3 25 | --- 26 | # A traditional consensus store with a single Raft group replicates across all 5 replicas in the RaftCluster 27 | apiVersion: raft.atomix.io/v1beta3 28 | kind: RaftStore 29 | metadata: 30 | name: raft-store-2 31 | spec: 32 | cluster: 33 | name: multi-raft-cluster 34 | partitions: 1 35 | replicationFactor: 5 36 | -------------------------------------------------------------------------------- /examples/stores/pod-memory-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: podmemory.atomix.io/v1beta1 6 | kind: PodMemoryStore 7 | metadata: 8 | name: pod-memory-store 9 | -------------------------------------------------------------------------------- /examples/stores/raft-store-v1beta2.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: raft.atomix.io/v1beta2 6 | kind: RaftCluster 7 | metadata: 8 | name: raft-cluster 9 | spec: 10 | replicas: 1 11 | volumeClaimTemplate: 12 | spec: 13 | accessModes: 14 | - ReadWriteOnce 15 | resources: 16 | requests: 17 | storage: 10Gi 18 | --- 19 | apiVersion: raft.atomix.io/v1beta2 20 | kind: RaftStore 21 | metadata: 22 | name: raft-store 23 | spec: 24 | cluster: 25 | name: raft-cluster 26 | partitions: 30 27 | -------------------------------------------------------------------------------- /examples/stores/raft-store-v1beta3.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: raft.atomix.io/v1beta3 6 | kind: RaftCluster 7 | metadata: 8 | name: raft-cluster 9 | spec: 10 | replicas: 1 11 | persistence: 12 | enabled: false 13 | --- 14 | apiVersion: raft.atomix.io/v1beta3 15 | kind: RaftStore 16 | metadata: 17 | name: raft-store 18 | spec: 19 | cluster: 20 | name: raft-cluster 21 | partitions: 30 22 | -------------------------------------------------------------------------------- /examples/stores/raft-stores.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # A Raft cluster with 5 replicas 6 | apiVersion: raft.atomix.io/v1beta3 7 | kind: RaftCluster 8 | metadata: 9 | name: raft-cluster 10 | spec: 11 | replicas: 5 12 | persistence: 13 | size: 1Gi 14 | --- 15 | # A horizontally scalable sharded Raft store with 30 partitions 16 | apiVersion: raft.atomix.io/v1beta2 17 | kind: RaftStore 18 | metadata: 19 | name: raft-store-1 20 | spec: 21 | cluster: 22 | name: raft-cluster 23 | partitions: 30 24 | replicationFactor: 3 25 | --- 26 | # A traditional consensus store with a single Raft group replicates across all 5 replicas in the RaftCluster 27 | apiVersion: raft.atomix.io/v1beta3 28 | kind: RaftStore 29 | metadata: 30 | name: raft-store-2 31 | spec: 32 | cluster: 33 | name: raft-cluster 34 | partitions: 1 35 | replicationFactor: 5 36 | -------------------------------------------------------------------------------- /examples/stores/redis-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # Create a DataStore with the configuration for the store 6 | apiVersion: atomix.io/v3beta3 7 | kind: DataStore 8 | metadata: 9 | name: redis-store 10 | spec: 11 | # Configure the DataStore to use the etcd driver with the v3 API 12 | driver: 13 | name: atomix.io/redis 14 | apiVersion: v9 15 | # Define the configuration to be passed to the driver to connect to the store 16 | config: 17 | Addr: redis-master:6379 18 | -------------------------------------------------------------------------------- /examples/stores/shared-memory-store.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: sharedmemory.atomix.io/v1beta1 6 | kind: SharedMemoryStore 7 | metadata: 8 | name: shared-memory-store 9 | -------------------------------------------------------------------------------- /logging/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Logging Framework 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'logging/**' 13 | pull_request: 14 | paths: 15 | - 'logging/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: logging 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: logging 32 | -------------------------------------------------------------------------------- /logging/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | build: test 6 | go build ./... 7 | 8 | .PHONY: test 9 | test: 10 | go test ./... 11 | -------------------------------------------------------------------------------- /logging/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/logging 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/mitchellh/go-homedir v1.1.0 7 | github.com/stretchr/testify v1.8.0 8 | go.uber.org/zap v1.24.0 9 | gopkg.in/yaml.v3 v3.0.1 10 | ) 11 | 12 | require ( 13 | github.com/davecgh/go-spew v1.1.1 // indirect 14 | github.com/pmezard/go-difflib v1.0.0 // indirect 15 | go.uber.org/atomic v1.7.0 // indirect 16 | go.uber.org/multierr v1.6.0 // indirect 17 | ) 18 | -------------------------------------------------------------------------------- /logging/level_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package logging 6 | 7 | import ( 8 | "github.com/stretchr/testify/assert" 9 | "testing" 10 | ) 11 | 12 | func TestLevel(t *testing.T) { 13 | assert.False(t, DebugLevel.Enabled(EmptyLevel)) 14 | assert.True(t, DebugLevel.Enabled(DebugLevel)) 15 | assert.False(t, InfoLevel.Enabled(DebugLevel)) 16 | assert.True(t, InfoLevel.Enabled(InfoLevel)) 17 | assert.False(t, WarnLevel.Enabled(InfoLevel)) 18 | assert.True(t, WarnLevel.Enabled(WarnLevel)) 19 | assert.False(t, ErrorLevel.Enabled(WarnLevel)) 20 | assert.True(t, ErrorLevel.Enabled(ErrorLevel)) 21 | assert.False(t, FatalLevel.Enabled(ErrorLevel)) 22 | assert.True(t, FatalLevel.Enabled(FatalLevel)) 23 | assert.False(t, PanicLevel.Enabled(FatalLevel)) 24 | assert.True(t, PanicLevel.Enabled(PanicLevel)) 25 | } 26 | -------------------------------------------------------------------------------- /logging/output_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package logging 6 | 7 | import ( 8 | "bytes" 9 | "github.com/stretchr/testify/assert" 10 | "testing" 11 | ) 12 | 13 | func TestOutputLevels(t *testing.T) { 14 | buf := &bytes.Buffer{} 15 | sink, err := NewSink(buf, WithEncoding(ConsoleEncoding), WithMessageKey("message")) 16 | assert.NoError(t, err) 17 | 18 | output := NewOutput(sink, WithLevel(InfoLevel)) 19 | output.Debug("foo") 20 | assert.NoError(t, output.Sync()) 21 | assert.Equal(t, "", buf.String()) 22 | 23 | output.Info("foo") 24 | assert.NoError(t, output.Sync()) 25 | assert.Equal(t, "foo\n", buf.String()) 26 | 27 | output = output.WithLevel(DebugLevel) 28 | output.Debug("bar") 29 | assert.NoError(t, output.Sync()) 30 | assert.Equal(t, "foo\nbar\n", buf.String()) 31 | } 32 | -------------------------------------------------------------------------------- /logging/sink_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package logging 6 | 7 | import ( 8 | "bytes" 9 | "github.com/stretchr/testify/assert" 10 | "testing" 11 | ) 12 | 13 | func TestSinkConsoleEncoding(t *testing.T) { 14 | buf := &bytes.Buffer{} 15 | sink, err := NewSink(buf, WithEncoding(ConsoleEncoding), WithMessageKey("message")) 16 | assert.NoError(t, err) 17 | assert.NotNil(t, sink) 18 | 19 | sink.Info("foo") 20 | assert.NoError(t, sink.Sync()) 21 | assert.Equal(t, "foo\n", buf.String()) 22 | } 23 | 24 | func TestSinkJSONEncoding(t *testing.T) { 25 | buf := &bytes.Buffer{} 26 | sink, err := NewSink(buf, WithEncoding(JSONEncoding), WithMessageKey("message")) 27 | assert.NoError(t, err) 28 | assert.NotNil(t, sink) 29 | 30 | sink.Info("foo") 31 | assert.NoError(t, sink.Sync()) 32 | assert.Equal(t, "{\"message\":\"foo\"}\n", buf.String()) 33 | } 34 | 35 | func TestSinkFields(t *testing.T) { 36 | buf := &bytes.Buffer{} 37 | sink, err := NewSink(buf, WithEncoding(JSONEncoding)) 38 | assert.NoError(t, err) 39 | assert.NotNil(t, sink) 40 | 41 | sink = sink.WithFields(String("foo", "bar"), Int("baz", 1)) 42 | sink.Info("Hello world!") 43 | assert.NoError(t, sink.Sync()) 44 | assert.Equal(t, "{\"foo\":\"bar\",\"baz\":1}\n", buf.String()) 45 | } 46 | -------------------------------------------------------------------------------- /logging/test-data/test-config.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | timeEncoder: RFC3339 6 | 7 | rootLogger: 8 | level: info 9 | outputs: 10 | stdout: 11 | sink: stdout 12 | 13 | loggers: 14 | test/1: 15 | level: debug 16 | test/2: 17 | level: warn 18 | outputs: 19 | stdout-1: 20 | sink: stdout-1 21 | level: info 22 | test/2/3: 23 | level: info 24 | test/3: 25 | level: info 26 | outputs: 27 | stdout: 28 | level: info 29 | stdout-1: 30 | sink: stdout-1 31 | level: warn 32 | test/kafka: 33 | level: info 34 | outputs: 35 | kafka: 36 | sink: kafka-1 37 | 38 | sinks: 39 | stdout: 40 | path: stdout 41 | encoding: console 42 | timeEncoder: RFC3339 43 | stdout-1: 44 | path: stdout 45 | encoding: json 46 | file: 47 | path: file://test.log 48 | encoding: json -------------------------------------------------------------------------------- /protocols/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | $(MAKE) -C rsm build 8 | 9 | .PHONY: test 10 | test: 11 | $(MAKE) -C rsm test 12 | 13 | .PHONY: kind 14 | kind: 15 | $(MAKE) -C rsm kind 16 | -------------------------------------------------------------------------------- /protocols/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Protocols 7 | 8 | This folder contains a set of modules providing common protocols for storage implementations. 9 | -------------------------------------------------------------------------------- /protocols/rsm/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify RSM Protocol 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'protocols/rsm/**' 13 | pull_request: 14 | paths: 15 | - 'protocols/rsm/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: protocols/rsm 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: protocols/rsm 32 | -------------------------------------------------------------------------------- /protocols/rsm/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | go build ./... 8 | 9 | .PHONY: test 10 | test: 11 | go test github.com/atomix/atomix/protocols/rsm/pkg/... -p 1 12 | 13 | .PHONY: api 14 | api: 15 | @find ./api -name '*.pb.go' -delete 16 | docker run -i \ 17 | -v `pwd`:/build \ 18 | atomix/codegen:go-latest \ 19 | --proto-path ./api --go-path ./api --import-path github.com/atomix/atomix/protocols/rsm/api 20 | -------------------------------------------------------------------------------- /protocols/rsm/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Replicated State Machine Protocol 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/protocols-rsm-verify.yml)](https://github.com/atomix/atomix/actions/workflows/protocols-rsm-verify.yml) 9 | ![Go Version](https://img.shields.io/github/go-mod/go-version/atomix/atomix?label=go%20version&filename=protocols%2Frsm%2Fgo.mod) 10 | -------------------------------------------------------------------------------- /protocols/rsm/api/v1/config.proto: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2022-present Open Networking Foundation 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | syntax = "proto3"; 8 | 9 | package atomix.protocols.rsm.v1; 10 | 11 | import "google/protobuf/duration.proto"; 12 | import "gogoproto/gogo.proto"; 13 | 14 | message ProtocolConfig { 15 | repeated PartitionConfig partitions = 1 [ 16 | (gogoproto.nullable) = false 17 | ]; 18 | google.protobuf.Duration session_timeout = 2 [ 19 | (gogoproto.stdduration) = true 20 | ]; 21 | } 22 | 23 | message PartitionConfig { 24 | uint32 partition_id = 1 [ 25 | (gogoproto.customname) = "PartitionID", 26 | (gogoproto.casttype) = "PartitionID", 27 | (gogoproto.jsontag) = "partitionId" 28 | ]; 29 | string leader = 2; 30 | repeated string followers = 3; 31 | } 32 | -------------------------------------------------------------------------------- /protocols/rsm/api/v1/test.proto: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2022-present Open Networking Foundation 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | syntax = "proto3"; 8 | 9 | package atomix.protocols.rsm.v1; 10 | 11 | import "v1/headers.proto"; 12 | import "gogoproto/gogo.proto"; 13 | 14 | // Test is a test service 15 | service Test { 16 | rpc TestPropose (TestProposalRequest) returns (TestProposalResponse); 17 | rpc TestStreamPropose (TestProposalRequest) returns (stream TestProposalResponse); 18 | rpc TestQuery (TestQueryRequest) returns (TestQueryResponse); 19 | rpc TestStreamQuery (TestQueryRequest) returns (stream TestQueryResponse); 20 | } 21 | 22 | message TestProposalRequest { 23 | ProposalRequestHeaders headers = 1; 24 | } 25 | 26 | message TestProposalResponse { 27 | ProposalResponseHeaders headers = 1; 28 | } 29 | 30 | message TestQueryRequest { 31 | QueryRequestHeaders headers = 1; 32 | } 33 | 34 | message TestQueryResponse { 35 | QueryResponseHeaders headers = 1; 36 | } 37 | -------------------------------------------------------------------------------- /protocols/rsm/api/v1/types.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | type PartitionID uint32 8 | 9 | type SessionID uint64 10 | 11 | type PrimitiveID uint64 12 | 13 | type SequenceNum uint64 14 | 15 | type Term uint64 16 | 17 | type Index uint64 18 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/client/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package client 6 | 7 | import "google.golang.org/grpc" 8 | 9 | type Options struct { 10 | GRPCDialOptions []grpc.DialOption 11 | } 12 | 13 | func (o *Options) apply(opts ...Option) { 14 | for _, opt := range opts { 15 | opt(o) 16 | } 17 | } 18 | 19 | type Option func(*Options) 20 | 21 | func WithOptions(opts Options) Option { 22 | return func(options *Options) { 23 | *options = opts 24 | } 25 | } 26 | 27 | func WithGRPCDialOptions(opts ...grpc.DialOption) Option { 28 | return func(options *Options) { 29 | options.GRPCDialOptions = append(options.GRPCDialOptions, opts...) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/client/protocol.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package client 6 | 7 | import ( 8 | "hash/fnv" 9 | "sync" 10 | ) 11 | 12 | func NewProtocol() *Protocol { 13 | return &Protocol{} 14 | } 15 | 16 | type Protocol struct { 17 | partitions []*PartitionClient 18 | mu sync.RWMutex 19 | } 20 | 21 | func (p *Protocol) PartitionIndex(partitionKey []byte) int { 22 | i, err := getPartitionIndex(partitionKey, len(p.partitions)) 23 | if err != nil { 24 | panic(err) 25 | } 26 | return i 27 | } 28 | 29 | func (p *Protocol) PartitionBy(partitionKey []byte) *PartitionClient { 30 | i, err := getPartitionIndex(partitionKey, len(p.partitions)) 31 | if err != nil { 32 | panic(err) 33 | } 34 | return p.partitions[i] 35 | } 36 | 37 | func (p *Protocol) Partitions() []*PartitionClient { 38 | return p.partitions 39 | } 40 | 41 | // getPartitionIndex returns the index of the partition for the given key 42 | func getPartitionIndex(key []byte, partitions int) (int, error) { 43 | h := fnv.New32a() 44 | if _, err := h.Write(key); err != nil { 45 | return 0, err 46 | } 47 | return int(h.Sum32() % uint32(partitions)), nil 48 | } 49 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/node/codec.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package node 6 | 7 | type Codec[I, O any] interface { 8 | EncodeInput(I) ([]byte, error) 9 | DecodeOutput([]byte) (O, error) 10 | } 11 | 12 | type DecodeFunc[T any] func([]byte) (T, error) 13 | 14 | type EncodeFunc[T any] func(T) ([]byte, error) 15 | 16 | func NewCodec[I, O any](encoder EncodeFunc[I], decoder DecodeFunc[O]) Codec[I, O] { 17 | return &codec[I, O]{ 18 | encoder: encoder, 19 | decoder: decoder, 20 | } 21 | } 22 | 23 | type codec[I, O any] struct { 24 | encoder EncodeFunc[I] 25 | decoder DecodeFunc[O] 26 | } 27 | 28 | func (c *codec[I, O]) EncodeInput(input I) ([]byte, error) { 29 | return c.encoder(input) 30 | } 31 | 32 | func (c *codec[I, O]) DecodeOutput(bytes []byte) (O, error) { 33 | return c.decoder(bytes) 34 | } 35 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/node/executor.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package node 6 | 7 | import ( 8 | "context" 9 | protocol "github.com/atomix/atomix/protocols/rsm/api/v1" 10 | "github.com/atomix/atomix/runtime/pkg/stream" 11 | ) 12 | 13 | // Executor is the interface for executing operations on the underlying protocol 14 | type Executor interface { 15 | // Propose proposes a change to the protocol 16 | Propose(ctx context.Context, proposal *protocol.ProposalInput, stream stream.WriteStream[*protocol.ProposalOutput]) error 17 | 18 | // Query queries the state 19 | Query(ctx context.Context, query *protocol.QueryInput, stream stream.WriteStream[*protocol.QueryOutput]) error 20 | } 21 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/node/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package node 6 | 7 | const ( 8 | defaultPort = 8080 9 | ) 10 | 11 | type Options struct { 12 | Host string 13 | Port int 14 | } 15 | 16 | func (o *Options) apply(opts ...Option) { 17 | o.Port = defaultPort 18 | for _, opt := range opts { 19 | opt(o) 20 | } 21 | } 22 | 23 | type Option func(*Options) 24 | 25 | func WithOptions(opts Options) Option { 26 | return func(options *Options) { 27 | *options = opts 28 | } 29 | } 30 | 31 | func WithHost(host string) Option { 32 | return func(options *Options) { 33 | options.Host = host 34 | } 35 | } 36 | 37 | func WithPort(port int) Option { 38 | return func(options *Options) { 39 | options.Port = port 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/node/protocol.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package node 6 | 7 | import protocol "github.com/atomix/atomix/protocols/rsm/api/v1" 8 | 9 | type Protocol interface { 10 | Partitions() []Partition 11 | Partition(partitionID protocol.PartitionID) (Partition, bool) 12 | } 13 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/statemachine/codec.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package statemachine 6 | 7 | type Codec[I, O any] interface { 8 | DecodeInput([]byte) (I, error) 9 | EncodeOutput(O) ([]byte, error) 10 | } 11 | 12 | type AnyCodec Codec[any, any] 13 | 14 | type EncodeFunc[T any] func(T) ([]byte, error) 15 | 16 | type DecodeFunc[T any] func([]byte) (T, error) 17 | 18 | func NewCodec[I, O any](decoder DecodeFunc[I], encoder EncodeFunc[O]) Codec[I, O] { 19 | return &codec[I, O]{ 20 | encoder: encoder, 21 | decoder: decoder, 22 | } 23 | } 24 | 25 | type codec[I, O any] struct { 26 | decoder DecodeFunc[I] 27 | encoder EncodeFunc[O] 28 | } 29 | 30 | func (c *codec[I, O]) DecodeInput(bytes []byte) (I, error) { 31 | return c.decoder(bytes) 32 | } 33 | 34 | func (c *codec[I, O]) EncodeOutput(output O) ([]byte, error) { 35 | return c.encoder(output) 36 | } 37 | -------------------------------------------------------------------------------- /protocols/rsm/pkg/statemachine/scheduler_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package statemachine 6 | 7 | import ( 8 | "github.com/stretchr/testify/assert" 9 | "testing" 10 | "time" 11 | ) 12 | 13 | func TestScheduler(t *testing.T) { 14 | scheduler := newScheduler() 15 | 16 | ran := false 17 | scheduler.Schedule(time.UnixMilli(1), func() { 18 | ran = true 19 | }) 20 | scheduler.tick(time.UnixMilli(1)) 21 | assert.Equal(t, time.UnixMilli(1), scheduler.Time()) 22 | assert.True(t, ran) 23 | 24 | ran = false 25 | scheduler.Schedule(time.UnixMilli(2), func() { 26 | ran = true 27 | }) 28 | scheduler.tick(time.UnixMilli(3)) 29 | assert.Equal(t, time.UnixMilli(3), scheduler.Time()) 30 | assert.True(t, ran) 31 | 32 | ran = false 33 | scheduler.tick(time.UnixMilli(2)) 34 | assert.Equal(t, time.UnixMilli(3), scheduler.Time()) 35 | assert.False(t, ran) 36 | 37 | ran = false 38 | cancel := scheduler.Schedule(time.UnixMilli(5), func() { 39 | ran = true 40 | }) 41 | scheduler.tick(time.UnixMilli(4)) 42 | assert.Equal(t, time.UnixMilli(4), scheduler.Time()) 43 | assert.False(t, ran) 44 | cancel() 45 | scheduler.tick(time.UnixMilli(5)) 46 | assert.False(t, ran) 47 | } 48 | -------------------------------------------------------------------------------- /runtime/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Runtime 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'runtime/**' 13 | pull_request: 14 | paths: 15 | - 'runtime/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: runtime 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: runtime 32 | -------------------------------------------------------------------------------- /runtime/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | build: test 6 | go build ./... 7 | 8 | .PHONY: test 9 | test: 10 | go test github.com/atomix/atomix/runtime/pkg/... -p 1 11 | -------------------------------------------------------------------------------- /runtime/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Runtime 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/runtime-verify.yml)](https://github.com/atomix/atomix/actions/workflows/runtime-verify.yml) 9 | ![Go Version](https://img.shields.io/github/go-mod/go-version/atomix/atomix?label=go%20version&filename=runtime%2Fgo.mod) 10 | 11 | The runtime is a Go runtime library that provides the interfaces and utilities required to create drivers for 12 | interacting with data stores. 13 | -------------------------------------------------------------------------------- /runtime/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/atomix/atomix/runtime 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/atomix/atomix/api v1.1.0 7 | github.com/cenkalti/backoff v2.2.1+incompatible 8 | github.com/gogo/protobuf v1.3.2 9 | github.com/mitchellh/go-homedir v1.1.0 10 | github.com/stretchr/testify v1.8.0 11 | go.uber.org/zap v1.24.0 12 | google.golang.org/grpc v1.46.0 13 | gopkg.in/yaml.v3 v3.0.1 14 | ) 15 | 16 | require ( 17 | github.com/davecgh/go-spew v1.1.1 // indirect 18 | github.com/golang/protobuf v1.5.2 // indirect 19 | github.com/pmezard/go-difflib v1.0.0 // indirect 20 | go.uber.org/atomic v1.7.0 // indirect 21 | go.uber.org/multierr v1.6.0 // indirect 22 | golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect 23 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect 24 | golang.org/x/text v0.3.7 // indirect 25 | google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect 26 | google.golang.org/protobuf v1.28.0 // indirect 27 | ) 28 | -------------------------------------------------------------------------------- /runtime/pkg/driver/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package driver 6 | 7 | import ( 8 | "context" 9 | ) 10 | 11 | // Driver is the primary interface for implementing storage drivers 12 | type Driver interface{} 13 | 14 | // Conn is a connection to a store 15 | // Implement the Configurator interface to support configuration changes to an existing connection 16 | type Conn interface { 17 | Closer 18 | } 19 | 20 | // Connector is an interface for connecting to a store 21 | type Connector[T any] interface { 22 | Connect(ctx context.Context, spec T) (Conn, error) 23 | } 24 | 25 | // Configurator is an interface for supporting configuration changes on an existing Conn 26 | type Configurator[T any] interface { 27 | Configure(ctx context.Context, spec T) error 28 | } 29 | 30 | // Closer is an interface for closing connections 31 | type Closer interface { 32 | Close(ctx context.Context) error 33 | } 34 | -------------------------------------------------------------------------------- /runtime/pkg/logging/test.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | loggers: 6 | root: 7 | level: info 8 | output: 9 | stdout: 10 | sink: stdout 11 | file: 12 | sink: file 13 | test/1: 14 | level: debug 15 | test/2: 16 | level: warn 17 | output: 18 | stdout-1: 19 | sink: stdout-1 20 | level: info 21 | test/2/3: 22 | level: info 23 | test/3: 24 | level: info 25 | output: 26 | stdout: 27 | level: info 28 | stdout-1: 29 | sink: stdout-1 30 | level: warn 31 | test/kafka: 32 | level: info 33 | output: 34 | kafka: 35 | sink: kafka-1 36 | sinks: 37 | stdout: 38 | encoding: console 39 | stdout: {} 40 | stdout-1: 41 | encoding: json 42 | stdout: {} 43 | file: 44 | encoding: json 45 | file: 46 | path: test.log -------------------------------------------------------------------------------- /runtime/pkg/network/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package network 6 | 7 | type Options struct { 8 | Network Driver 9 | Host string 10 | Port int 11 | } 12 | 13 | func (o *Options) apply(opts ...Option) { 14 | o.Network = NewDefaultDriver() 15 | for _, opt := range opts { 16 | opt(o) 17 | } 18 | } 19 | 20 | type Option = func(*Options) 21 | 22 | func WithOptions(opts Options) Option { 23 | return func(options *Options) { 24 | *options = opts 25 | } 26 | } 27 | 28 | func WithDriver(network Driver) Option { 29 | return func(options *Options) { 30 | options.Network = network 31 | } 32 | } 33 | 34 | func WithHost(host string) Option { 35 | return func(options *Options) { 36 | options.Host = host 37 | } 38 | } 39 | 40 | func WithPort(port int) Option { 41 | return func(options *Options) { 42 | options.Port = port 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /runtime/pkg/network/service.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package network 6 | 7 | import ( 8 | "fmt" 9 | "github.com/atomix/atomix/runtime/pkg/logging" 10 | "google.golang.org/grpc" 11 | "os" 12 | ) 13 | 14 | var log = logging.GetLogger() 15 | 16 | type Service interface { 17 | Start() error 18 | Stop() error 19 | } 20 | 21 | func NewService(server *grpc.Server, opts ...Option) Service { 22 | var options Options 23 | options.apply(opts...) 24 | return &grpcService{ 25 | Options: options, 26 | server: server, 27 | } 28 | } 29 | 30 | type grpcService struct { 31 | Options 32 | server *grpc.Server 33 | } 34 | 35 | func (p *grpcService) Start() error { 36 | log.Info("Starting service") 37 | address := fmt.Sprintf("%s:%d", p.Host, p.Port) 38 | lis, err := p.Network.Listen(address) 39 | if err != nil { 40 | return err 41 | } 42 | 43 | go func() { 44 | if err := p.server.Serve(lis); err != nil { 45 | fmt.Println(err) 46 | os.Exit(1) 47 | } 48 | }() 49 | return nil 50 | } 51 | 52 | func (p *grpcService) Stop() error { 53 | log.Info("Stopping service") 54 | p.server.Stop() 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /runtime/pkg/runtime/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package runtime 6 | 7 | import ( 8 | "github.com/atomix/atomix/runtime/pkg/network" 9 | ) 10 | 11 | const ( 12 | defaultPort = 5679 13 | ) 14 | 15 | type Options struct { 16 | ServiceOptions 17 | } 18 | 19 | func (o *Options) apply(opts ...Option) { 20 | o.Network = network.NewDefaultDriver() 21 | o.Port = defaultPort 22 | for _, opt := range opts { 23 | opt(o) 24 | } 25 | } 26 | 27 | type Option = func(*Options) 28 | 29 | type ServiceOptions struct { 30 | Network network.Driver 31 | Host string 32 | Port int 33 | } 34 | 35 | func WithOptions(opts Options) Option { 36 | return func(options *Options) { 37 | *options = opts 38 | } 39 | } 40 | 41 | func WithNetwork(driver network.Driver) Option { 42 | return func(options *Options) { 43 | options.Network = driver 44 | } 45 | } 46 | 47 | func WithHost(host string) Option { 48 | return func(options *Options) { 49 | options.Host = host 50 | } 51 | } 52 | 53 | func WithPort(port int) Option { 54 | return func(options *Options) { 55 | options.Port = port 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /runtime/pkg/runtime/service.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package runtime 6 | 7 | import ( 8 | runtimeapiv1 "github.com/atomix/atomix/api/runtime/v1" 9 | "github.com/atomix/atomix/runtime/pkg/network" 10 | runtimev1 "github.com/atomix/atomix/runtime/pkg/runtime/v1" 11 | "github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors" 12 | "google.golang.org/grpc" 13 | ) 14 | 15 | type Service struct { 16 | network.Service 17 | Options 18 | } 19 | 20 | func NewService(runtime *runtimev1.Runtime, opts ...Option) network.Service { 21 | var options Options 22 | options.apply(opts...) 23 | server := grpc.NewServer( 24 | grpc.UnaryInterceptor(interceptors.ErrorHandlingUnaryServerInterceptor()), 25 | grpc.StreamInterceptor(interceptors.ErrorHandlingStreamServerInterceptor())) 26 | runtimeapiv1.RegisterRuntimeServer(server, runtimev1.NewRuntimeServer(runtime)) 27 | return &Service{ 28 | Options: options, 29 | Service: network.NewService(server, 30 | network.WithDriver(options.Network), 31 | network.WithHost(options.Host), 32 | network.WithPort(options.Port)), 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /runtime/pkg/runtime/v1/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | import ( 8 | "context" 9 | "github.com/atomix/atomix/api/errors" 10 | runtimev1 "github.com/atomix/atomix/api/runtime/v1" 11 | "github.com/atomix/atomix/runtime/pkg/driver" 12 | ) 13 | 14 | type DriverProvider interface { 15 | LoadDriver(ctx context.Context, driverID runtimev1.DriverID) (driver.Driver, error) 16 | } 17 | 18 | func newStaticDriverProvider(drivers map[runtimev1.DriverID]driver.Driver) DriverProvider { 19 | return &staticDriverProvider{ 20 | drivers: drivers, 21 | } 22 | } 23 | 24 | type staticDriverProvider struct { 25 | drivers map[runtimev1.DriverID]driver.Driver 26 | } 27 | 28 | func (p *staticDriverProvider) LoadDriver(_ context.Context, driverID runtimev1.DriverID) (driver.Driver, error) { 29 | driver, ok := p.drivers[driverID] 30 | if !ok { 31 | return nil, errors.NewNotFound("driver %s not found", driverID) 32 | } 33 | return driver, nil 34 | } 35 | 36 | var _ DriverProvider = (*staticDriverProvider)(nil) 37 | -------------------------------------------------------------------------------- /sidecar/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Sidecar 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'sidecar/**' 13 | pull_request: 14 | paths: 15 | - 'sidecar/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: sidecar 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: sidecar 32 | chart: chart 33 | -------------------------------------------------------------------------------- /sidecar/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: sidecar controller 7 | 8 | sidecar: 9 | docker build . -f build/sidecar/Dockerfile -t atomix/sidecar 10 | 11 | controller: 12 | docker build . -f build/controller/Dockerfile -t atomix/sidecar-controller 13 | 14 | kind: sidecar-kind controller-kind 15 | 16 | sidecar-kind: sidecar 17 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 18 | kind load docker-image atomix/sidecar:latest 19 | 20 | controller-kind: controller 21 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 22 | kind load docker-image atomix/sidecar-controller:latest 23 | 24 | .PHONY: test 25 | test: 26 | go test github.com/atomix/atomix/sidecar/pkg/... 27 | ct install --namespace kube-system --charts ./chart --helm-extra-set-args '--set image.pullPolicy=Never --set init.image.pullPolicy=Never --set test.image.pullPolicy=Never --set test.enabled=true' 28 | -------------------------------------------------------------------------------- /sidecar/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix Sidecar 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/sidecar-verify.yml)](https://github.com/atomix/atomix/actions/workflows/sidecar-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/sidecar-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/sidecar-test.yml) 10 | [![Image](https://img.shields.io/docker/v/atomix/sidecar?label=release)](https://hub.docker.com/repository/docker/atomix/sidecar) 11 | -------------------------------------------------------------------------------- /sidecar/build/controller-test/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd/atomix-sidecar-controller-test ./cmd/atomix-sidecar-controller-test 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar-controller-test -o ./bin/atomix-sidecar-controller-test 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-sidecar-controller-test /usr/local/bin/atomix-sidecar-controller-test 28 | 29 | ENTRYPOINT ["atomix-sidecar-controller-test"] 30 | -------------------------------------------------------------------------------- /sidecar/build/controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd ./cmd 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-sidecar-controller -o ./bin/atomix-sidecar-controller 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-sidecar-controller /usr/local/bin/atomix-sidecar-controller 28 | 29 | ENTRYPOINT ["atomix-sidecar-controller"] 30 | -------------------------------------------------------------------------------- /sidecar/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v2 6 | name: atomix-sidecar-controller 7 | description: The sidecar controller provides injection of the Atomix sidecar into Kubernetes pods. 8 | kubeVersion: ">=1.17.0" 9 | type: application 10 | # The 0.0.0 version is a placeholder. The 'version' and 'appVersion' keys are 11 | # set to the version specified by the tag when the chart is packaged for release. 12 | version: 0.0.0 13 | appVersion: latest 14 | keywords: 15 | - atomix 16 | home: https://atomix.io 17 | maintainers: 18 | - name: Jordan Halterman 19 | email: jordan.halterman@intel.com 20 | -------------------------------------------------------------------------------- /sidecar/chart/templates/clusterrole.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: rbac.authorization.k8s.io/v1 6 | kind: ClusterRole 7 | metadata: 8 | creationTimestamp: null 9 | name: {{ template "atomix-sidecar-controller.fullname" . }} 10 | rules: 11 | - apiGroups: 12 | - "" 13 | resources: 14 | - pods 15 | - pods/status 16 | - configmaps 17 | - events 18 | verbs: 19 | - '*' 20 | - apiGroups: 21 | - "" 22 | resources: 23 | - namespaces 24 | - serviceaccounts 25 | verbs: 26 | {{- if .Values.test.enabled }} 27 | - '*' 28 | {{- else }} 29 | - get 30 | - list 31 | - watch 32 | {{- end }} 33 | - apiGroups: 34 | - policy 35 | resources: 36 | - poddisruptionbudgets 37 | verbs: 38 | - '*' 39 | - apiGroups: 40 | - atomix.io 41 | resources: 42 | - '*' 43 | verbs: 44 | - '*' 45 | - apiGroups: 46 | - admissionregistration.k8s.io 47 | resources: 48 | - mutatingwebhookconfigurations 49 | verbs: 50 | - get 51 | - list 52 | - watch 53 | - update -------------------------------------------------------------------------------- /sidecar/chart/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: {{ template "atomix-sidecar-controller.fullname" . }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: {{ template "atomix-sidecar-controller.fullname" . }} 12 | namespace: {{ .Release.Namespace }} 13 | roleRef: 14 | kind: ClusterRole 15 | name: {{ template "atomix-sidecar-controller.fullname" . }} 16 | apiGroup: rbac.authorization.k8s.io -------------------------------------------------------------------------------- /sidecar/chart/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: {{ template "atomix-sidecar-controller.fullname" . }}-config 9 | data: 10 | logging.yaml: |- 11 | loggers: 12 | root: 13 | level: {{ .Values.logging.rootLevel }} 14 | output: 15 | stdout: 16 | sink: stdout 17 | {{ toYaml .Values.logging.loggers | indent 6 }} 18 | sinks: 19 | stdout: 20 | encoding: {{ .Values.logging.encoding }} 21 | stdout: {} -------------------------------------------------------------------------------- /sidecar/chart/templates/mutatingwebhookconfiguration.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: admissionregistration.k8s.io/v1 6 | kind: MutatingWebhookConfiguration 7 | metadata: 8 | name: {{ template "atomix-sidecar-controller.fullname" . }} 9 | webhooks: 10 | - name: injector.sidecar.atomix.io 11 | # Match only pods that opt-in to Atomix with the sidecar.atomix.io/inject label 12 | objectSelector: 13 | matchLabels: 14 | sidecar.atomix.io/inject: "true" 15 | rules: 16 | # TODO: Support UPDATE operations for pods 17 | - operations: [ "CREATE" ] 18 | apiGroups: [ "" ] 19 | apiVersions: [ "v1" ] 20 | resources: [ "pods" ] 21 | scope: Namespaced 22 | clientConfig: 23 | service: 24 | name: {{ template "atomix-sidecar-controller.fullname" . }} 25 | namespace: {{ .Release.Namespace }} 26 | path: /inject-sidecar 27 | admissionReviewVersions: [ "v1beta1" ] 28 | sideEffects: None 29 | failurePolicy: Fail 30 | timeoutSeconds: 10 -------------------------------------------------------------------------------- /sidecar/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ template "atomix-sidecar-controller.fullname" . }} 9 | labels: 10 | name: {{ template "atomix-sidecar-controller.fullname" . }} 11 | spec: 12 | selector: 13 | name: {{ template "atomix-sidecar-controller.fullname" . }} 14 | ports: 15 | - name: webhook 16 | port: 443 17 | targetPort: 443 -------------------------------------------------------------------------------- /sidecar/chart/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: {{ template "atomix-sidecar-controller.fullname" . }} 9 | namespace: {{ .Release.Namespace }} -------------------------------------------------------------------------------- /sidecar/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | replicas: 1 6 | 7 | image: 8 | repository: atomix/sidecar-controller 9 | tag: "" 10 | pullPolicy: "" 11 | pullSecrets: [] 12 | 13 | init: 14 | image: 15 | repository: atomix/controller-init 16 | tag: "" 17 | pullPolicy: "" 18 | pullSecrets: [] 19 | 20 | sidecar: 21 | image: 22 | repository: atomix/sidecar 23 | tag: "" 24 | pullSecrets: [] 25 | 26 | test: 27 | enabled: false 28 | timeout: 5m 29 | image: 30 | repository: atomix/sidecar-controller-test 31 | tag: "" 32 | pullPolicy: "" 33 | pullSecrets: [] 34 | 35 | logging: 36 | rootLevel: info 37 | encoding: console 38 | loggers: 39 | github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors: 40 | level: error 41 | -------------------------------------------------------------------------------- /sidecar/pkg/sidecar/driver.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package sidecar 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | "github.com/atomix/atomix/api/errors" 11 | runtimev1 "github.com/atomix/atomix/api/runtime/v1" 12 | "github.com/atomix/atomix/runtime/pkg/driver" 13 | runtime "github.com/atomix/atomix/runtime/pkg/runtime/v1" 14 | "os" 15 | "path/filepath" 16 | "plugin" 17 | ) 18 | 19 | const driverSymName = "Plugin" 20 | 21 | func NewDriverProvider(path string) runtime.DriverProvider { 22 | return &pluginDriverProvider{ 23 | path: path, 24 | } 25 | } 26 | 27 | type pluginDriverProvider struct { 28 | path string 29 | } 30 | 31 | func (p *pluginDriverProvider) LoadDriver(_ context.Context, driverID runtimev1.DriverID) (driver.Driver, error) { 32 | path := filepath.Join(p.path, fmt.Sprintf("%s@%s.so", driverID.Name, driverID.APIVersion)) 33 | driverPlugin, err := plugin.Open(path) 34 | if err != nil { 35 | if os.IsNotExist(err) { 36 | return nil, errors.NewNotFound(err.Error()) 37 | } 38 | return nil, errors.NewUnknown(err.Error()) 39 | } 40 | driverSym, err := driverPlugin.Lookup(driverSymName) 41 | if err != nil { 42 | return nil, errors.NewNotFound(err.Error()) 43 | } 44 | return *driverSym.(*driver.Driver), nil 45 | } 46 | 47 | var _ runtime.DriverProvider = (*pluginDriverProvider)(nil) 48 | -------------------------------------------------------------------------------- /sidecar/pkg/sidecar/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package sidecar 6 | 7 | import ( 8 | "github.com/atomix/atomix/runtime/pkg/network" 9 | ) 10 | 11 | const ( 12 | defaultPort = 5678 13 | ) 14 | 15 | type Options struct { 16 | ServiceOptions 17 | } 18 | 19 | func (o *Options) apply(opts ...Option) { 20 | o.Network = network.NewDefaultDriver() 21 | o.Port = defaultPort 22 | for _, opt := range opts { 23 | opt(o) 24 | } 25 | } 26 | 27 | type Option = func(*Options) 28 | 29 | type ServiceOptions struct { 30 | Network network.Driver 31 | Host string 32 | Port int 33 | } 34 | 35 | func WithOptions(opts Options) Option { 36 | return func(options *Options) { 37 | *options = opts 38 | } 39 | } 40 | 41 | func WithNetwork(driver network.Driver) Option { 42 | return func(options *Options) { 43 | options.Network = driver 44 | } 45 | } 46 | 47 | func WithHost(host string) Option { 48 | return func(options *Options) { 49 | options.Host = host 50 | } 51 | } 52 | 53 | func WithPort(port int) Option { 54 | return func(options *Options) { 55 | options.Port = port 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /stores/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | $(MAKE) -C raft build 8 | $(MAKE) -C pod-memory build 9 | $(MAKE) -C shared-memory build 10 | 11 | .PHONY: test 12 | test: 13 | $(MAKE) -C raft test 14 | $(MAKE) -C pod-memory test 15 | $(MAKE) -C shared-memory test 16 | 17 | .PHONY: kind 18 | kind: 19 | $(MAKE) -C raft kind 20 | $(MAKE) -C pod-memory kind 21 | $(MAKE) -C shared-memory kind 22 | -------------------------------------------------------------------------------- /stores/pod-memory/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify pod-memory Store 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'stores/pod-memory/**' 13 | pull_request: 14 | paths: 15 | - 'stores/pod-memory/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: stores/pod-memory 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: stores/pod-memory 32 | chart: chart 33 | -------------------------------------------------------------------------------- /stores/pod-memory/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: controller 7 | 8 | controller: 9 | docker build . -f build/controller/Dockerfile -t atomix/pod-memory-controller 10 | 11 | kind: controller 12 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 13 | kind load docker-image atomix/pod-memory-controller:latest 14 | 15 | .PHONY: test 16 | test: 17 | go test github.com/atomix/atomix/stores/pod-memory/pkg/... 18 | -------------------------------------------------------------------------------- /stores/pod-memory/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Pod-local Memory Store 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-pod-memory-verify.yml)](https://github.com/atomix/atomix/actions/workflows/stores-pod-memory-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-pod-memory-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/stores-pod-memory-test.yml) 10 | [![Image](https://img.shields.io/docker/v/atomix/pod-memory-controller?label=release)](https://hub.docker.com/repository/docker/atomix/pod-memory-controller) 11 | 12 | This module provides the control plane for pod-local storage. 13 | -------------------------------------------------------------------------------- /stores/pod-memory/build/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 -------------------------------------------------------------------------------- /stores/pod-memory/build/controller-test/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd/atomix-pod-memory-controller-test ./cmd/atomix-pod-memory-controller-test 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-pod-memory-controller-test -o ./bin/atomix-pod-memory-controller-test 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-pod-memory-controller-test /usr/local/bin/atomix-pod-memory-controller-test 28 | 29 | ENTRYPOINT ["atomix-pod-memory-controller-test"] 30 | -------------------------------------------------------------------------------- /stores/pod-memory/build/controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd/atomix-pod-memory-controller ./cmd/atomix-pod-memory-controller 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-pod-memory-controller -o ./bin/atomix-pod-memory-controller 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-pod-memory-controller /usr/local/bin/atomix-pod-memory-controller 28 | 29 | ENTRYPOINT ["atomix-pod-memory-controller"] 30 | -------------------------------------------------------------------------------- /stores/pod-memory/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v2 6 | name: atomix-pod-memory-controller 7 | description: The pod memory controller extends the Kubernetes API with custom resources for pod-local shared memory stores. 8 | kubeVersion: ">=1.17.0" 9 | type: application 10 | # The 0.0.0 version is a placeholder. The 'version' and 'appVersion' keys are 11 | # set to the version specified by the tag when the chart is packaged for release. 12 | version: 0.0.0 13 | keywords: 14 | - atomix 15 | - memory 16 | home: https://atomix.io 17 | maintainers: 18 | - name: Jordan Halterman 19 | email: jordan.halterman@intel.com 20 | -------------------------------------------------------------------------------- /stores/pod-memory/chart/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Atomix MultiRaft Storage Controller 7 | 8 | Provides a [Helm] chart for deploying [Atomix] on [Kubernetes]. 9 | 10 | To install the chart, run `helm install` from the root: 11 | 12 | ```bash 13 | helm install atomix-pod-memory-controller . 14 | ``` 15 | 16 | [Helm]: https://helm.sh/ 17 | [Kubernetes]: https://kubernetes.io 18 | [Atomix]: https://atomix.io 19 | -------------------------------------------------------------------------------- /stores/pod-memory/chart/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 12 | namespace: {{ .Release.Namespace }} 13 | roleRef: 14 | kind: ClusterRole 15 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 16 | apiGroup: rbac.authorization.k8s.io -------------------------------------------------------------------------------- /stores/pod-memory/chart/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: {{ template "atomix-pod-memory-controller.fullname" . }}-config 9 | data: 10 | {{ (.Files.Glob "crds/podmemory.atomix.io/*.yaml").AsConfig | indent 2 }} 11 | logging.yaml: |- 12 | loggers: 13 | root: 14 | level: {{ .Values.logging.rootLevel }} 15 | output: 16 | stdout: 17 | sink: stdout 18 | {{ toYaml .Values.logging.loggers | indent 6 }} 19 | sinks: 20 | stdout: 21 | encoding: {{ .Values.logging.encoding }} 22 | stdout: {} -------------------------------------------------------------------------------- /stores/pod-memory/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 9 | labels: 10 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 11 | spec: 12 | selector: 13 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 14 | ports: 15 | - name: webhook 16 | port: 443 17 | targetPort: 443 -------------------------------------------------------------------------------- /stores/pod-memory/chart/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: {{ template "atomix-pod-memory-controller.fullname" . }} 9 | namespace: {{ .Release.Namespace }} -------------------------------------------------------------------------------- /stores/pod-memory/chart/templates/tests/crds.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | {{- if .Values.test.enabled }} 6 | apiVersion: v1 7 | kind: Pod 8 | metadata: 9 | name: {{ template "atomix-pod-memory-controller.fullname" . }}-test 10 | labels: 11 | name: {{ template "atomix-pod-memory-controller.fullname" . }}-test 12 | annotations: 13 | helm.sh/hook: test 14 | spec: 15 | serviceAccountName: {{ template "atomix-pod-memory-controller.fullname" . }} 16 | containers: 17 | - name: atomix-pod-memory-test 18 | {{- if .Values.test.image.tag }} 19 | image: {{ printf "%s:%s" .Values.test.image.repository .Values.test.image.tag }} 20 | {{- else if .Chart.AppVersion }} 21 | image: {{ printf "%s:%s" .Values.test.image.repository .Chart.AppVersion }} 22 | {{- else }} 23 | image: {{ .Values.test.image.repository }} 24 | {{- end }} 25 | imagePullPolicy: {{ .Values.test.image.pullPolicy }} 26 | args: 27 | - --timeout 28 | - {{ .Values.test.timeout }} 29 | env: 30 | - name: TEST_NAME 31 | valueFrom: 32 | fieldRef: 33 | fieldPath: metadata.name 34 | restartPolicy: Never 35 | {{- end }} 36 | -------------------------------------------------------------------------------- /stores/pod-memory/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | replicas: 1 6 | 7 | image: 8 | repository: atomix/pod-memory-controller 9 | tag: "" 10 | pullPolicy: "" 11 | pullSecrets: [] 12 | 13 | init: 14 | image: 15 | repository: atomix/controller-init 16 | tag: "" 17 | pullPolicy: "" 18 | pullSecrets: [] 19 | 20 | test: 21 | enabled: false 22 | timeout: 5m 23 | image: 24 | repository: atomix/pod-memory-controller-test 25 | tag: "" 26 | pullPolicy: "" 27 | pullSecrets: [] 28 | 29 | logging: 30 | rootLevel: info 31 | encoding: console 32 | loggers: 33 | github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors: 34 | level: error 35 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/apis/addtoscheme_podmemory_v1beta1.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package apis 6 | 7 | import ( 8 | podmemoryv1beta1 "github.com/atomix/atomix/stores/pod-memory/pkg/apis/podmemory/v1beta1" 9 | ) 10 | 11 | func init() { 12 | // register the types with the Scheme so the components can map objects to GroupVersionKinds and back 13 | AddToSchemes = append(AddToSchemes, podmemoryv1beta1.SchemeBuilder.AddToScheme) 14 | } 15 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/apis/apis.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package apis 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/runtime" 9 | ) 10 | 11 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 12 | var AddToSchemes runtime.SchemeBuilder 13 | 14 | // AddToScheme adds all Resources to the Scheme 15 | func AddToScheme(s *runtime.Scheme) error { 16 | return AddToSchemes.AddToScheme(s) 17 | } 18 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/apis/podmemory/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1beta1 contains API Schema definitions for the podmemory v1beta1 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=podmemory.atomix.io 8 | package v1beta1 9 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated clientset. 7 | package versioned 8 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated fake clientset. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package contains the scheme of the automatically generated clientset. 7 | package scheme 8 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/typed/podmemory/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v1beta1 8 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/typed/podmemory/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/typed/podmemory/v1beta1/fake/fake_podmemory_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v1beta1 "github.com/atomix/atomix/stores/pod-memory/pkg/client/clientset/versioned/typed/podmemory/v1beta1" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakePodmemoryV1beta1 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakePodmemoryV1beta1) PodMemoryStores(namespace string) v1beta1.PodMemoryStoreInterface { 19 | return &FakePodMemoryStores{c, namespace} 20 | } 21 | 22 | // RESTClient returns a RESTClient that is used to communicate 23 | // with API server by this client implementation. 24 | func (c *FakePodmemoryV1beta1) RESTClient() rest.Interface { 25 | var ret *rest.RESTClient 26 | return ret 27 | } 28 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/client/clientset/versioned/typed/podmemory/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v1beta1 7 | 8 | type PodMemoryStoreExpansion interface{} 9 | -------------------------------------------------------------------------------- /stores/pod-memory/pkg/controller/podmemory/v1beta1/controller.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1beta1 6 | 7 | import ( 8 | "github.com/atomix/atomix/runtime/pkg/logging" 9 | "sigs.k8s.io/controller-runtime/pkg/manager" 10 | ) 11 | 12 | var log = logging.GetLogger() 13 | 14 | // AddControllers adds podmemory controllers to the manager 15 | func AddControllers(mgr manager.Manager) error { 16 | if err := addPodMemoryStoreController(mgr); err != nil { 17 | return err 18 | } 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /stores/raft/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Raft Store 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'stores/raft/**' 13 | pull_request: 14 | paths: 15 | - 'stores/raft/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: stores/raft 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: stores/raft 32 | chart: chart 33 | -------------------------------------------------------------------------------- /stores/raft/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: controller node 7 | 8 | controller: 9 | docker build . -f build/controller/Dockerfile -t atomix/raft-controller 10 | 11 | node: 12 | docker build . -f build/node/Dockerfile -t atomix/raft-node 13 | 14 | kind: controller-kind node-kind 15 | 16 | controller-kind: controller 17 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 18 | kind load docker-image atomix/raft-controller:latest 19 | 20 | node-kind: node 21 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 22 | kind load docker-image atomix/raft-node:latest 23 | 24 | .PHONY: test 25 | test: 26 | go test github.com/atomix/atomix/stores/raft/pkg/... 27 | 28 | .PHONY: api 29 | api: 30 | @find ./api -name '*.pb.go' -delete 31 | docker run -i \ 32 | -v `pwd`:/build \ 33 | atomix/codegen:go-latest \ 34 | --proto-path ./api --go-path ./api --import-path github.com/atomix/atomix/stores/raft/api 35 | -------------------------------------------------------------------------------- /stores/raft/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Raft Consensus Store 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-raft-verify.yml)](https://github.com/atomix/atomix/actions/workflows/stores-raft-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-raft-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/stores-raft-test.yml) 10 | [![Image](https://img.shields.io/docker/v/atomix/raft-controller?label=release)](https://hub.docker.com/repository/docker/atomix/raft-controller) 11 | 12 | This module provides the control plane and node image for Raft consensus storage. 13 | -------------------------------------------------------------------------------- /stores/raft/api/v1/raft.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1 6 | 7 | type Index uint64 8 | 9 | type Term uint64 10 | 11 | type MemberID uint32 12 | 13 | type GroupID uint32 14 | 15 | type SequenceNum uint64 16 | -------------------------------------------------------------------------------- /stores/raft/build/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 -------------------------------------------------------------------------------- /stores/raft/build/controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./api ./api 15 | COPY ./cmd/atomix-raft-controller ./cmd/atomix-raft-controller 16 | COPY ./pkg ./pkg 17 | 18 | RUN atomix build ./cmd/atomix-raft-controller -o ./bin/atomix-raft-controller 19 | 20 | FROM alpine:3.15 21 | 22 | RUN apk add libc6-compat 23 | 24 | RUN addgroup -S atomix && adduser -S -G atomix atomix 25 | 26 | USER atomix 27 | 28 | COPY --from=build /build/bin/atomix-raft-controller /usr/local/bin/atomix-raft-controller 29 | 30 | ENTRYPOINT ["atomix-raft-controller"] 31 | -------------------------------------------------------------------------------- /stores/raft/build/node/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./api ./api 15 | COPY ./cmd/atomix-raft-node ./cmd/atomix-raft-node 16 | COPY ./pkg ./pkg 17 | 18 | RUN atomix build ./cmd/atomix-raft-node -o ./bin/atomix-raft-node 19 | 20 | FROM alpine:3.15 21 | 22 | RUN apk add libc6-compat bash 23 | 24 | RUN addgroup -S atomix && adduser -S -G atomix atomix 25 | 26 | USER atomix 27 | 28 | COPY --from=build /build/bin/atomix-raft-node /usr/local/bin/atomix-raft-node 29 | 30 | ENTRYPOINT ["atomix-raft-node"] 31 | -------------------------------------------------------------------------------- /stores/raft/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v2 6 | name: atomix-raft-controller 7 | description: The Raft controller extends the Kubernetes API with custom resources for Raft stores. 8 | kubeVersion: ">=1.17.0" 9 | type: application 10 | # The 0.0.0 version is a placeholder. The 'version' and 'appVersion' keys are 11 | # set to the version specified by the tag when the chart is packaged for release. 12 | version: 0.0.0 13 | keywords: 14 | - atomix 15 | - raft 16 | - multiraft 17 | - consensus 18 | home: https://atomix.io 19 | maintainers: 20 | - name: Jordan Halterman 21 | email: jordan.halterman@intel.com 22 | -------------------------------------------------------------------------------- /stores/raft/chart/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Atomix MultiRaft Storage Controller 7 | 8 | Provides a [Helm] chart for deploying [Atomix] on [Kubernetes]. 9 | 10 | To install the chart, run `helm install` from the root: 11 | 12 | ```bash 13 | helm install atomix-raft-controller . 14 | ``` 15 | 16 | [Helm]: https://helm.sh/ 17 | [Kubernetes]: https://kubernetes.io 18 | [Atomix]: https://atomix.io 19 | -------------------------------------------------------------------------------- /stores/raft/chart/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: {{ template "atomix-raft-controller.fullname" . }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: {{ template "atomix-raft-controller.fullname" . }} 12 | namespace: {{ .Release.Namespace }} 13 | roleRef: 14 | kind: ClusterRole 15 | name: {{ template "atomix-raft-controller.fullname" . }} 16 | apiGroup: rbac.authorization.k8s.io -------------------------------------------------------------------------------- /stores/raft/chart/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: {{ template "atomix-raft-controller.fullname" . }}-config 9 | data: 10 | {{ (.Files.Glob "crds/raft.atomix.io/*.yaml").AsConfig | indent 2 }} 11 | logging.yaml: |- 12 | loggers: 13 | root: 14 | level: {{ .Values.logging.rootLevel }} 15 | output: 16 | stdout: 17 | sink: stdout 18 | {{ toYaml .Values.logging.loggers | indent 6 }} 19 | sinks: 20 | stdout: 21 | encoding: {{ .Values.logging.encoding }} 22 | stdout: {} -------------------------------------------------------------------------------- /stores/raft/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ template "atomix-raft-controller.fullname" . }} 9 | labels: 10 | name: {{ template "atomix-raft-controller.fullname" . }} 11 | spec: 12 | selector: 13 | name: {{ template "atomix-raft-controller.fullname" . }} 14 | ports: 15 | - name: webhook 16 | port: 443 17 | targetPort: 443 -------------------------------------------------------------------------------- /stores/raft/chart/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: {{ template "atomix-raft-controller.fullname" . }} 9 | namespace: {{ .Release.Namespace }} -------------------------------------------------------------------------------- /stores/raft/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | replicas: 1 6 | 7 | image: 8 | repository: atomix/raft-controller 9 | tag: "" 10 | pullPolicy: "" 11 | pullSecrets: [] 12 | 13 | init: 14 | image: 15 | repository: atomix/controller-init 16 | tag: "" 17 | pullPolicy: "" 18 | pullSecrets: [] 19 | 20 | node: 21 | image: 22 | repository: atomix/raft-node 23 | tag: "" 24 | pullPolicy: "" 25 | pullSecrets: [] 26 | 27 | test: 28 | enabled: false 29 | timeout: 5m 30 | image: 31 | repository: atomix/raft-controller-test 32 | tag: "" 33 | pullPolicy: "" 34 | pullSecrets: [] 35 | 36 | logging: 37 | rootLevel: info 38 | encoding: console 39 | loggers: 40 | github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors: 41 | level: error 42 | -------------------------------------------------------------------------------- /stores/raft/pkg/apis/apis.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package apis 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/runtime" 9 | ) 10 | 11 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 12 | var AddToSchemes runtime.SchemeBuilder 13 | 14 | // AddToScheme adds all Resources to the Scheme 15 | func AddToScheme(s *runtime.Scheme) error { 16 | if err := AddToSchemes.AddToScheme(s); err != nil { 17 | return err 18 | } 19 | if err := RegisterConversions(s); err != nil { 20 | return err 21 | } 22 | return nil 23 | } 24 | 25 | func RegisterConversions(s *runtime.Scheme) error { 26 | if err := registerConversions_v1beta2(s); err != nil { 27 | return err 28 | } 29 | if err := registerConversions_v1beta3(s); err != nil { 30 | return err 31 | } 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /stores/raft/pkg/apis/raft/v1beta2/config.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1beta2 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/api/resource" 9 | ) 10 | 11 | // RaftConfig is the configuration of a Raft group 12 | type RaftConfig struct { 13 | ElectionRTT *uint64 `json:"electionRTT,omitempty"` 14 | HeartbeatRTT *uint64 `json:"heartbeatRTT,omitempty"` 15 | SnapshotEntries *int64 `json:"snapshotEntries,omitempty"` 16 | CompactionOverhead *int64 `json:"compactionOverhead,omitempty"` 17 | MaxInMemLogSize *resource.Quantity `json:"maxInMemLogSize,omitempty"` 18 | } 19 | 20 | // LoggingConfig logging configuration 21 | type LoggingConfig struct { 22 | Encoding string `json:"encoding"` 23 | RootLevel string `json:"rootLevel"` 24 | Loggers []LoggerConfig `json:"loggers"` 25 | } 26 | 27 | // LoggerConfig is the configuration for a logger 28 | type LoggerConfig struct { 29 | Name string `json:"name"` 30 | Level *string `json:"level"` 31 | } 32 | -------------------------------------------------------------------------------- /stores/raft/pkg/apis/raft/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1beta2 contains API Schema definitions for the raft v1beta2 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=raft.atomix.io 8 | package v1beta2 9 | -------------------------------------------------------------------------------- /stores/raft/pkg/apis/raft/v1beta3/config.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1beta3 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/api/resource" 9 | ) 10 | 11 | // RaftConfig is the configuration of a Raft group 12 | type RaftConfig struct { 13 | ElectionRTT *int64 `json:"electionRTT,omitempty"` 14 | HeartbeatRTT *int64 `json:"heartbeatRTT,omitempty"` 15 | SnapshotEntries *int64 `json:"snapshotEntries,omitempty"` 16 | CompactionOverhead *int64 `json:"compactionOverhead,omitempty"` 17 | MaxInMemLogSize *resource.Quantity `json:"maxInMemLogSize,omitempty"` 18 | } 19 | 20 | // LoggingConfig logging configuration 21 | type LoggingConfig struct { 22 | Encoding *string `json:"encoding"` 23 | RootLevel *string `json:"rootLevel"` 24 | Loggers []LoggerConfig `json:"loggers"` 25 | } 26 | 27 | // LoggerConfig is the configuration for a logger 28 | type LoggerConfig struct { 29 | Name string `json:"name"` 30 | Level *string `json:"level"` 31 | } 32 | -------------------------------------------------------------------------------- /stores/raft/pkg/apis/raft/v1beta3/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1beta3 contains API Schema definitions for the raft v1beta3 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=raft.atomix.io 8 | package v1beta3 9 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated clientset. 7 | package versioned 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated fake clientset. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package contains the scheme of the automatically generated clientset. 7 | package scheme 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v1beta2 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta2/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta2/fake/fake_raft_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v1beta2 "github.com/atomix/atomix/stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta2" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeRaftV1beta2 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeRaftV1beta2) RaftClusters(namespace string) v1beta2.RaftClusterInterface { 19 | return &FakeRaftClusters{c, namespace} 20 | } 21 | 22 | func (c *FakeRaftV1beta2) RaftPartitions(namespace string) v1beta2.RaftPartitionInterface { 23 | return &FakeRaftPartitions{c, namespace} 24 | } 25 | 26 | func (c *FakeRaftV1beta2) RaftReplicas(namespace string) v1beta2.RaftReplicaInterface { 27 | return &FakeRaftReplicas{c, namespace} 28 | } 29 | 30 | func (c *FakeRaftV1beta2) RaftStores(namespace string) v1beta2.RaftStoreInterface { 31 | return &FakeRaftStores{c, namespace} 32 | } 33 | 34 | // RESTClient returns a RESTClient that is used to communicate 35 | // with API server by this client implementation. 36 | func (c *FakeRaftV1beta2) RESTClient() rest.Interface { 37 | var ret *rest.RESTClient 38 | return ret 39 | } 40 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta2/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v1beta2 7 | 8 | type RaftClusterExpansion interface{} 9 | 10 | type RaftPartitionExpansion interface{} 11 | 12 | type RaftReplicaExpansion interface{} 13 | 14 | type RaftStoreExpansion interface{} 15 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta3/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v1beta3 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta3/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta3/fake/fake_raft_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v1beta3 "github.com/atomix/atomix/stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta3" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeRaftV1beta3 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeRaftV1beta3) RaftClusters(namespace string) v1beta3.RaftClusterInterface { 19 | return &FakeRaftClusters{c, namespace} 20 | } 21 | 22 | func (c *FakeRaftV1beta3) RaftPartitions(namespace string) v1beta3.RaftPartitionInterface { 23 | return &FakeRaftPartitions{c, namespace} 24 | } 25 | 26 | func (c *FakeRaftV1beta3) RaftReplicas(namespace string) v1beta3.RaftReplicaInterface { 27 | return &FakeRaftReplicas{c, namespace} 28 | } 29 | 30 | func (c *FakeRaftV1beta3) RaftStores(namespace string) v1beta3.RaftStoreInterface { 31 | return &FakeRaftStores{c, namespace} 32 | } 33 | 34 | // RESTClient returns a RESTClient that is used to communicate 35 | // with API server by this client implementation. 36 | func (c *FakeRaftV1beta3) RESTClient() rest.Interface { 37 | var ret *rest.RESTClient 38 | return ret 39 | } 40 | -------------------------------------------------------------------------------- /stores/raft/pkg/client/clientset/versioned/typed/raft/v1beta3/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v1beta3 7 | 8 | type RaftClusterExpansion interface{} 9 | 10 | type RaftPartitionExpansion interface{} 11 | 12 | type RaftReplicaExpansion interface{} 13 | 14 | type RaftStoreExpansion interface{} 15 | -------------------------------------------------------------------------------- /stores/raft/pkg/raft/options.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package raft 6 | 7 | const ( 8 | defaultPort = 8080 9 | ) 10 | 11 | type Options struct { 12 | Host string 13 | Port int 14 | } 15 | 16 | func (o *Options) apply(opts ...Option) { 17 | o.Port = defaultPort 18 | for _, opt := range opts { 19 | opt(o) 20 | } 21 | } 22 | 23 | type Option func(*Options) 24 | 25 | func WithOptions(opts Options) Option { 26 | return func(options *Options) { 27 | *options = opts 28 | } 29 | } 30 | 31 | func WithHost(host string) Option { 32 | return func(options *Options) { 33 | options.Host = host 34 | } 35 | } 36 | 37 | func WithPort(port int) Option { 38 | return func(options *Options) { 39 | options.Port = port 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /stores/shared-memory/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify shared-memory Store 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'stores/shared-memory/**' 13 | pull_request: 14 | paths: 15 | - 'stores/shared-memory/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: stores/shared-memory 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: stores/shared-memory 32 | chart: chart 33 | -------------------------------------------------------------------------------- /stores/shared-memory/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: controller node 7 | 8 | controller: 9 | docker build . -f build/controller/Dockerfile -t atomix/shared-memory-controller 10 | 11 | node: 12 | docker build . -f build/node/Dockerfile -t atomix/shared-memory-node 13 | 14 | kind: controller-kind node-kind 15 | 16 | controller-kind: controller 17 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 18 | kind load docker-image atomix/shared-memory-controller:latest 19 | 20 | node-kind: node 21 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 22 | kind load docker-image atomix/shared-memory-node:latest 23 | 24 | .PHONY: test 25 | test: 26 | go test github.com/atomix/atomix/stores/shared-memory/pkg/... 27 | -------------------------------------------------------------------------------- /stores/shared-memory/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Shared Memory Store 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-shared-memory-verify.yml)](https://github.com/atomix/atomix/actions/workflows/stores-shared-memory-verify.yml) 9 | [![Integration Tests](https://img.shields.io/github/actions/workflow/status/atomix/atomix/stores-shared-memory-test.yml?label=integration%20tests)](https://github.com/atomix/atomix/actions/workflows/stores-shared-memory-test.yml) 10 | [![Image](https://img.shields.io/docker/v/atomix/shared-memory-controller?label=release)](https://hub.docker.com/repository/docker/atomix/shared-memory-controller) 11 | 12 | This module provides the control plane and node image for shared memory storage. 13 | -------------------------------------------------------------------------------- /stores/shared-memory/build/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 -------------------------------------------------------------------------------- /stores/shared-memory/build/controller-test/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd/atomix-shared-memory-controller-test ./cmd/atomix-shared-memory-controller-test 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-shared-memory-controller-test -o ./bin/atomix-shared-memory-controller-test 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-shared-memory-controller-test /usr/local/bin/atomix-shared-memory-controller-test 28 | 29 | ENTRYPOINT ["atomix-shared-memory-controller-test"] 30 | -------------------------------------------------------------------------------- /stores/shared-memory/build/controller/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd/atomix-shared-memory-controller ./cmd/atomix-shared-memory-controller 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-shared-memory-controller -o ./bin/atomix-shared-memory-controller 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-shared-memory-controller /usr/local/bin/atomix-shared-memory-controller 28 | 29 | ENTRYPOINT ["atomix-shared-memory-controller"] 30 | -------------------------------------------------------------------------------- /stores/shared-memory/build/node/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | FROM atomix/build AS build 6 | 7 | RUN mkdir /build 8 | WORKDIR /build 9 | 10 | COPY go.mod go.sum ./ 11 | 12 | RUN go mod download 13 | 14 | COPY ./cmd ./cmd 15 | COPY ./pkg ./pkg 16 | 17 | RUN atomix build ./cmd/atomix-shared-memory-node -o ./bin/atomix-shared-memory-node 18 | 19 | FROM alpine:3.15 20 | 21 | RUN apk add libc6-compat bash 22 | 23 | RUN addgroup -S atomix && adduser -S -G atomix atomix 24 | 25 | USER atomix 26 | 27 | COPY --from=build /build/bin/atomix-shared-memory-node /usr/local/bin/atomix-shared-memory-node 28 | 29 | ENTRYPOINT ["atomix-shared-memory-node"] 30 | -------------------------------------------------------------------------------- /stores/shared-memory/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v2 6 | name: atomix-shared-memory-controller 7 | description: The shared memory controller extends the Kubernetes API with custom resources for memory stores. 8 | kubeVersion: ">=1.17.0" 9 | type: application 10 | # The 0.0.0 version is a placeholder. The 'version' and 'appVersion' keys are 11 | # set to the version specified by the tag when the chart is packaged for release. 12 | version: 0.0.0 13 | appVersion: latest 14 | keywords: 15 | - atomix 16 | - memory 17 | - cache 18 | home: https://atomix.io 19 | maintainers: 20 | - name: Jordan Halterman 21 | email: jordan.halterman@intel.com 22 | -------------------------------------------------------------------------------- /stores/shared-memory/chart/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Atomix MultiRaft Storage Controller 7 | 8 | Provides a [Helm] chart for deploying [Atomix] on [Kubernetes]. 9 | 10 | To install the chart, run `helm install` from the root: 11 | 12 | ```bash 13 | helm install atomix-shared-memory-controller . 14 | ``` 15 | 16 | [Helm]: https://helm.sh/ 17 | [Kubernetes]: https://kubernetes.io 18 | [Atomix]: https://atomix.io 19 | -------------------------------------------------------------------------------- /stores/shared-memory/chart/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 12 | namespace: {{ .Release.Namespace }} 13 | roleRef: 14 | kind: ClusterRole 15 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 16 | apiGroup: rbac.authorization.k8s.io -------------------------------------------------------------------------------- /stores/shared-memory/chart/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: {{ template "atomix-shared-memory-controller.fullname" . }}-config 9 | data: 10 | {{ (.Files.Glob "crds/sharedmemory.atomix.io/*.yaml").AsConfig | indent 2 }} 11 | logging.yaml: |- 12 | loggers: 13 | root: 14 | level: {{ .Values.logging.rootLevel }} 15 | output: 16 | stdout: 17 | sink: stdout 18 | {{ toYaml .Values.logging.loggers | indent 6 }} 19 | sinks: 20 | stdout: 21 | encoding: {{ .Values.logging.encoding }} 22 | stdout: {} -------------------------------------------------------------------------------- /stores/shared-memory/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 9 | labels: 10 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 11 | spec: 12 | selector: 13 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 14 | ports: 15 | - name: webhook 16 | port: 443 17 | targetPort: 443 -------------------------------------------------------------------------------- /stores/shared-memory/chart/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: {{ template "atomix-shared-memory-controller.fullname" . }} 9 | namespace: {{ .Release.Namespace }} -------------------------------------------------------------------------------- /stores/shared-memory/chart/templates/tests/crds.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | {{- if .Values.test.enabled }} 6 | apiVersion: v1 7 | kind: Pod 8 | metadata: 9 | name: {{ template "atomix-shared-memory-controller.fullname" . }}-test 10 | labels: 11 | name: {{ template "atomix-shared-memory-controller.fullname" . }}-test 12 | annotations: 13 | helm.sh/hook: test 14 | spec: 15 | serviceAccountName: {{ template "atomix-shared-memory-controller.fullname" . }} 16 | containers: 17 | - name: atomix-shared-memory-test 18 | {{- if .Values.test.image.tag }} 19 | image: {{ printf "%s:%s" .Values.test.image.repository .Values.test.image.tag }} 20 | {{- else if .Chart.AppVersion }} 21 | image: {{ printf "%s:%s" .Values.test.image.repository .Chart.AppVersion }} 22 | {{- else }} 23 | image: {{ .Values.test.image.repository }} 24 | {{- end }} 25 | imagePullPolicy: {{ .Values.test.image.pullPolicy }} 26 | args: 27 | - --timeout 28 | - {{ .Values.test.timeout }} 29 | env: 30 | - name: TEST_NAME 31 | valueFrom: 32 | fieldRef: 33 | fieldPath: metadata.name 34 | restartPolicy: Never 35 | {{- end }} 36 | -------------------------------------------------------------------------------- /stores/shared-memory/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | replicas: 1 6 | 7 | image: 8 | repository: atomix/shared-memory-controller 9 | tag: "" 10 | pullPolicy: "" 11 | pullSecrets: [] 12 | 13 | init: 14 | image: 15 | repository: atomix/controller-init 16 | tag: "" 17 | pullPolicy: "" 18 | pullSecrets: [] 19 | 20 | node: 21 | image: 22 | repository: atomix/shared-memory-node 23 | tag: "" 24 | pullPolicy: "" 25 | pullSecrets: [] 26 | 27 | test: 28 | enabled: false 29 | timeout: 5m 30 | image: 31 | repository: atomix/shared-memory-controller-test 32 | tag: "" 33 | pullPolicy: "" 34 | pullSecrets: [] 35 | 36 | logging: 37 | rootLevel: info 38 | encoding: console 39 | loggers: 40 | github.com/atomix/atomix/runtime/pkg/utils/grpc/interceptors: 41 | level: error 42 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/apis/apis.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package apis 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/runtime" 9 | ) 10 | 11 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 12 | var AddToSchemes runtime.SchemeBuilder 13 | 14 | // AddToScheme adds all Resources to the Scheme 15 | func AddToScheme(s *runtime.Scheme) error { 16 | if err := AddToSchemes.AddToScheme(s); err != nil { 17 | return err 18 | } 19 | if err := RegisterConversions(s); err != nil { 20 | return err 21 | } 22 | return nil 23 | } 24 | 25 | func RegisterConversions(s *runtime.Scheme) error { 26 | if err := registerConversions_v1beta1(s); err != nil { 27 | return err 28 | } 29 | if err := registerConversions_v1beta2(s); err != nil { 30 | return err 31 | } 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/apis/sharedmemory/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1beta1 contains API Schema definitions for the sharedmemory v1beta1 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=sharedmemory.atomix.io 8 | package v1beta1 9 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/apis/sharedmemory/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1beta2 contains API Schema definitions for the sharedmemory v1beta2 API group 6 | // +k8s:deepcopy-gen=package,register 7 | // +groupName=sharedmemory.atomix.io 8 | package v1beta2 9 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated clientset. 7 | package versioned 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated fake clientset. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package contains the scheme of the automatically generated clientset. 7 | package scheme 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v1beta1 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta1/fake/fake_sharedmemory_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v1beta1 "github.com/atomix/atomix/stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta1" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeSharedmemoryV1beta1 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeSharedmemoryV1beta1) SharedMemoryStores(namespace string) v1beta1.SharedMemoryStoreInterface { 19 | return &FakeSharedMemoryStores{c, namespace} 20 | } 21 | 22 | // RESTClient returns a RESTClient that is used to communicate 23 | // with API server by this client implementation. 24 | func (c *FakeSharedmemoryV1beta1) RESTClient() rest.Interface { 25 | var ret *rest.RESTClient 26 | return ret 27 | } 28 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v1beta1 7 | 8 | type SharedMemoryStoreExpansion interface{} 9 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // This package has the automatically generated typed clients. 7 | package v1beta2 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta2/fake/doc.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | // Package fake has the automatically generated clients. 7 | package fake 8 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta2/fake/fake_sharedmemory_client.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package fake 7 | 8 | import ( 9 | v1beta2 "github.com/atomix/atomix/stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta2" 10 | rest "k8s.io/client-go/rest" 11 | testing "k8s.io/client-go/testing" 12 | ) 13 | 14 | type FakeSharedmemoryV1beta2 struct { 15 | *testing.Fake 16 | } 17 | 18 | func (c *FakeSharedmemoryV1beta2) SharedMemoryStores(namespace string) v1beta2.SharedMemoryStoreInterface { 19 | return &FakeSharedMemoryStores{c, namespace} 20 | } 21 | 22 | // RESTClient returns a RESTClient that is used to communicate 23 | // with API server by this client implementation. 24 | func (c *FakeSharedmemoryV1beta2) RESTClient() rest.Interface { 25 | var ret *rest.RESTClient 26 | return ret 27 | } 28 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/client/clientset/versioned/typed/sharedmemory/v1beta2/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // Code generated by client-gen. DO NOT EDIT. 5 | 6 | package v1beta2 7 | 8 | type SharedMemoryStoreExpansion interface{} 9 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/controller/sharedmemory/v1beta2/controller.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1beta2 6 | 7 | import ( 8 | "github.com/atomix/atomix/runtime/pkg/logging" 9 | "sigs.k8s.io/controller-runtime/pkg/manager" 10 | ) 11 | 12 | var log = logging.GetLogger() 13 | 14 | // AddControllers adds memory controllers to the manager 15 | func AddControllers(mgr manager.Manager) error { 16 | if err := addSharedMemoryStoreController(mgr); err != nil { 17 | return err 18 | } 19 | if err := addSharedMemoryStoreConverter(mgr); err != nil { 20 | return err 21 | } 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /stores/shared-memory/pkg/node/config.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package node 6 | 7 | type Config struct { 8 | Server ServerConfig `json:"server" yaml:"server"` 9 | } 10 | 11 | type ServerConfig struct { 12 | ReadBufferSize *int `json:"readBufferSize" yaml:"readBufferSize"` 13 | WriteBufferSize *int `json:"writeBufferSize" yaml:"writeBufferSize"` 14 | MaxRecvMsgSize *int `json:"maxRecvMsgSize" yaml:"maxRecvMsgSize"` 15 | MaxSendMsgSize *int `json:"maxSendMsgSize" yaml:"maxSendMsgSize"` 16 | NumStreamWorkers *uint32 `json:"numStreamWorkers" yaml:"numStreamWorkers"` 17 | MaxConcurrentStreams *uint32 `json:"maxConcurrentStreams" yaml:"maxConcurrentStreams"` 18 | } 19 | -------------------------------------------------------------------------------- /testing/.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | name: Verify Integration Tests 6 | 7 | on: 8 | push: 9 | branches: 10 | - 'master' 11 | paths: 12 | - 'testing/**' 13 | pull_request: 14 | paths: 15 | - 'testing/**' 16 | workflow_dispatch: 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test: 24 | uses: ./.github/workflows/test.yml 25 | with: 26 | component: testing 27 | 28 | lint: 29 | uses: ./.github/workflows/lint.yml 30 | with: 31 | component: testing 32 | -------------------------------------------------------------------------------- /testing/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present Intel Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | .PHONY: build 6 | build: 7 | docker build . -f build/Dockerfile -t atomix/bench 8 | 9 | kind: 10 | @if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi 11 | kind load docker-image atomix/bench:latest 12 | 13 | .PHONY: test 14 | test: 15 | go test github.com/atomix/atomix/bench/... 16 | -------------------------------------------------------------------------------- /testing/README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Atomix Integration Tests 7 | 8 | [![Build](https://img.shields.io/github/actions/workflow/status/atomix/atomix/testing-verify.yml)](https://github.com/atomix/atomix/actions/workflows/testing-verify.yml) 9 | 10 | The testing module provides test and benchmark suites for Atomix primitives. 11 | --------------------------------------------------------------------------------