Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microdc/k8s-dynamodb-operator
A Kubernetes DynamoDB operator
https://github.com/microdc/k8s-dynamodb-operator
Last synced: 1 day ago
JSON representation
A Kubernetes DynamoDB operator
- Host: GitHub
- URL: https://github.com/microdc/k8s-dynamodb-operator
- Owner: microdc
- License: apache-2.0
- Archived: true
- Created: 2018-02-16T13:13:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T14:34:36.000Z (over 6 years ago)
- Last Synced: 2024-05-22T13:33:03.067Z (6 months ago)
- Language: Shell
- Size: 23.4 KB
- Stars: 5
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# microdc-k8s-dynamodb-operator
A kubernetes controller for creating/deleting dynamodb tables based on the [side8/k8s-operator](https://github.com/side8/k8s-operator)Available on [Docker hub](https://hub.docker.com/r/microdc/k8s-dynamodb-controller/)
### Build docker container
```
$ export VERSION="0.1.0"
$ docker build . --tag "microdc/k8s-dynamodb-controller:${VERSION}" --tag "microdc/k8s-dynamodb-controller:latest"
```### Prerequisites
* An AWS user or role with admin permissions on DynamoDB. kube2iam works very well for this.
* The operator running in the cluster with a serviceAccountName with permissions to the DynamoDB CRD, events and ConfigMaps. `operator.yaml` is a good reference example.### Example DynamoDB Table
To create a table using the example yaml config follow these steps.
1. Build the container above and deploy to your cluster. It will need a role able to perform cluster updates
2. Apply the `test-table` yaml config:
```
kubectl apply -f example/Table.yaml
```
3. Check the table configuration both on the dynamodb object and the created ConfigMap:
```
kubectl get dynamodb test-table -o json | jq '.status'
kubectl describe configmap dynamodb-test-table
```
4. Use the ConfigMap to configure containers:
```
...
env:
- name: TEST_TABLE
valueFrom:
configMapKeyRef:
name: dynamodb-test-table
key: TableName
```5. Make some changes. The format mirrors the AWS API so adding more AttributeDeffinitions should be as simple as extending the array in the yaml.
```
$ kubectl edit dynamodb test-table
...
spec:
...
AttributeDefinitions:
...
- AttributeName: active
AttributeType: "N"
```
6. clean up
```
$ kubectl delete dynamodb test-table
```### Tests
Requires: shellcheck and yamllint
Tests run at container build. test.sh can bes used for local command line testing.