diff --git a/argocd-deploys/argo-redis/argo-redis.yaml b/argocd-deploys/argo-redis/argo-redis.yaml new file mode 100644 index 0000000..ac66d36 --- /dev/null +++ b/argocd-deploys/argo-redis/argo-redis.yaml @@ -0,0 +1,21 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-redis + namespace: argocd +spec: + project: default + source: + repoURL: git@github.com:natan-dias/my-devops-repo.git + targetRevision: feature-new-app + path: infra/redis + destination: + server: 'https://kubernetes.default.svc' + namespace: redis + syncPolicy: + syncOptions: + - CreateNamespace=true + - PruneLast=true + automated: + selfHeal: true + prune: true \ No newline at end of file diff --git a/infra/redis/README.md b/infra/redis/README.md new file mode 100644 index 0000000..fa15e35 --- /dev/null +++ b/infra/redis/README.md @@ -0,0 +1,20 @@ +# Redis local implementation + +I have implemented this small redis instance locally just for some tests. Tried to implement using ingress, but it did not work, so I am using, for now, a nodeport deployment. + +For that I have added toleration just to keep the deployment on the same node. + +- Taint + +> k taint node ${KIND-WORKER-NAME} node=infra:NoSchedule + +- Toleration + +``` +spec: + tolerations: + - key: node + operator: Equal + value: infra + effect: NoSchedule +``` \ No newline at end of file diff --git a/infra/redis/kustomization.yaml b/infra/redis/kustomization.yaml new file mode 100644 index 0000000..ce7c98d --- /dev/null +++ b/infra/redis/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: redis +resources: +- redis-storage.yaml +- redis-service.yaml +- redis-deployment.yaml \ No newline at end of file diff --git a/infra/redis/redis-deployment.yaml b/infra/redis/redis-deployment.yaml new file mode 100644 index 0000000..4a831a0 --- /dev/null +++ b/infra/redis/redis-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-deployment + namespace: redis +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + tolerations: + - key: node + operator: Equal + value: infra + effect: NoSchedule + containers: + - name: redis + image: redis:6.2.5 + ports: + - containerPort: 6379 + volumeMounts: + - name: redis-data + mountPath: /data + volumes: + - name: redis-data + persistentVolumeClaim: + claimName: redis-pvc \ No newline at end of file diff --git a/infra/redis/redis-service.yaml b/infra/redis/redis-service.yaml new file mode 100644 index 0000000..bb97832 --- /dev/null +++ b/infra/redis/redis-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-service + namespace: redis +spec: + selector: + app: redis + ports: + - name: redis + port: 6379 + targetPort: 6379 + nodePort: 30010 + type: NodePort \ No newline at end of file diff --git a/infra/redis/redis-storage.yaml b/infra/redis/redis-storage.yaml new file mode 100644 index 0000000..47212de --- /dev/null +++ b/infra/redis/redis-storage.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: redis-pv +spec: + capacity: + storage: 200Mi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + hostPath: + path: /data/redis + storageClassName: data +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-pvc + namespace: redis +spec: + storageClassName: "data" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 200Mi \ No newline at end of file