From fa182588747df8adadc88005055213c2724faf25 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 30 Jan 2018 12:54:10 +0100 Subject: [PATCH] Use redis package instead of various multiple packages --- examples/bind-config/README.md | 4 ++-- examples/bind-config/habitat.yml | 7 +++---- examples/bind/README.md | 2 +- examples/bind/habitat.yml | 8 ++++---- examples/config/README.md | 6 +++--- examples/config/habitat.yml | 15 ++++++++------- examples/encrypted/habitat.yml | 6 +++--- examples/leader/README.md | 2 +- examples/leader/habitat.yml | 4 ++-- examples/namespaced/habitat.yml | 6 +++--- examples/standalone/README.md | 2 +- examples/standalone/habitat.yml | 6 +++--- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/bind-config/README.md b/examples/bind-config/README.md index 4ffdd26f..39a2da17 100644 --- a/examples/bind-config/README.md +++ b/examples/bind-config/README.md @@ -1,6 +1,6 @@ # Runtime binding + initial configuration -This demonstrates how to run two Habitat Services with a [binding](https://www.habitat.sh/docs/run-packages-binding/) between them, with initial configuration used to override the port of the PostgreSQL Habitat service. It also displays how different fields in the manifest file can be combined. +This demonstrates how to run two Habitat Services with a [binding](https://www.habitat.sh/docs/run-packages-binding/) between them, with initial configuration used to override the port of the redis Habitat service. It also displays how different fields in the manifest file can be combined. ## Workflow @@ -10,6 +10,6 @@ After the Habitat operator is up and running, execute the following command from kubectl create -f examples/bind-config/habitat.yml ``` -This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a PostgreSQL database. The Go server will display the database port number that was overriden by the initial configuration. +This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a Redis database. The Go server will display the database port number that was overriden by the initial configuration. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP. diff --git a/examples/bind-config/habitat.yml b/examples/bind-config/habitat.yml index a0c3496e..feb856bd 100644 --- a/examples/bind-config/habitat.yml +++ b/examples/bind-config/habitat.yml @@ -6,18 +6,17 @@ type: Opaque data: # Each item needs to be encoded in base64, as Kubernetes expects that encoding. # Plain text content of the secret: "port = 4444" - # This overrides the port set in the postgresql Habitat service. + # This overrides the port set in the Redis Habitat service. user.toml: cG9ydCA9IDQ0NDQ= --- apiVersion: habitat.sh/v1beta1 -kind: Habitat metadata: name: example-bind-configured-db-service spec: - image: kinvolk/postgresql-hab + image: kinvolk/redis-hab count: 1 service: - name: postgresql + name: redis # Name of the secret. # This is mounted inside of the pod as a user.toml file. configSecretName: user-toml-secret diff --git a/examples/bind/README.md b/examples/bind/README.md index 5ec1b363..dfff085b 100644 --- a/examples/bind/README.md +++ b/examples/bind/README.md @@ -10,6 +10,6 @@ After the Habitat operator is up and running, execute the following command from kubectl create -f examples/bind/habitat.yml ``` -This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a PostgreSQL database. The Go server will display the port number the database listens on. +This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a Redis database. The Go server will display the port number the database listens on. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP. diff --git a/examples/bind/habitat.yml b/examples/bind/habitat.yml index 6e2014e8..189f1f52 100644 --- a/examples/bind/habitat.yml +++ b/examples/bind/habitat.yml @@ -3,10 +3,10 @@ kind: Habitat metadata: name: db spec: - image: kinvolk/postgresql-hab + image: kinvolk/redis-hab count: 1 service: - name: postgresql + name: redis topology: standalone --- apiVersion: habitat.sh/v1beta1 @@ -23,7 +23,7 @@ spec: # Name is the name of the bind specified in the Habitat configuration files. - name: db # Service is the name of the service this bind refers to. - service: postgresql + service: redis # Group is the group of the service this bind refers to. group: default --- @@ -33,7 +33,7 @@ metadata: name: go-service spec: selector: - habitat-name: go + habitat-name: web-app type: NodePort ports: - name: web diff --git a/examples/config/README.md b/examples/config/README.md index a1f92b3b..afee160f 100644 --- a/examples/config/README.md +++ b/examples/config/README.md @@ -1,6 +1,6 @@ # Initial configuration -This example demostrates how initial configuration works with the Habitat operator. With the manifest file we deploy a `"Hello world."` Node.js Habitat service. +This example demostrates how initial configuration works with the Habitat operator. With the manifest file we deploy a Redis Habitat service. NOTE: Adding secret configuration to the `default.toml` is discouraged, as it will be uploaded as a docker image. Instead use the initial configuration `user.toml` file. ## Workflow @@ -9,8 +9,8 @@ After the Habitat operator is up and running, execute the following command from `kubectl create -f examples/config/habitat.yml` -This will create a [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the configurations and a simple Node.js application that will display a msg. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP. -Initially our app is configured to display the msg `"Hello world."`. Because we override this with the Secret we just created, our app will instead display `Hello from our Habitat-Operator!`. +This will create a [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the configurations and a Redis database. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP. +Initially the Redis database is configured to be in protected mode. Because we override this with the Secret we just created, our db will not be in this mode anymore. ## Deletion diff --git a/examples/config/habitat.yml b/examples/config/habitat.yml index ef3fb05d..f0f7522e 100644 --- a/examples/config/habitat.yml +++ b/examples/config/habitat.yml @@ -6,27 +6,27 @@ type: Opaque data: # Each item needs to be encoded in base64, as Kubernetes # expects that encoding. - # Plain text content: "message = 'Hello from our Habitat-Operator!'" - user.toml: bWVzc2FnZSA9ICdIZWxsbyBmcm9tIG91ciBIYWJpdGF0LU9wZXJhdG9yISc= + # Plain text content: protected-mode = "no" + user.toml: cHJvdGVjdGVkLW1vZGUgPSAibm8i --- apiVersion: habitat.sh/v1beta1 kind: Habitat metadata: name: example-configured-habitat spec: - image: kinvolk/nodejs-hab + image: kinvolk/redis-hab count: 1 service: - name: mytutorialapp + name: db topology: standalone - group: nodejs + group: redisdb # Create Secret with the initial configuration you want. configSecretName: user-toml-secret --- apiVersion: v1 kind: Service metadata: - name: mytutorialapp + name: db spec: selector: habitat-name: example-configured-habitat @@ -35,7 +35,8 @@ spec: # This endpoint displays the message from the secret - name: web nodePort: 30001 - port: 5555 + # This is the default port as set in default.toml + port: 6379 protocol: TCP # This endpoint exposes the Habitat supervisor API - name: http-gateway diff --git a/examples/encrypted/habitat.yml b/examples/encrypted/habitat.yml index a063a6c1..b1c6cf8c 100644 --- a/examples/encrypted/habitat.yml +++ b/examples/encrypted/habitat.yml @@ -16,11 +16,11 @@ kind: Habitat metadata: name: example-encrypted-habitat spec: - # the core/nginx habitat service packaged as a Docker image - image: kinvolk/consul-hab + # the core/redis habitat service packaged as a Docker image + image: kinvolk/redis-hab count: 3 service: - name: consul + name: redis topology: leader # the name of the secret containing the ring key ringSecretName: example-encrypted-ring-20170829113029 diff --git a/examples/leader/README.md b/examples/leader/README.md index a0fe50e7..8b7b692a 100644 --- a/examples/leader/README.md +++ b/examples/leader/README.md @@ -8,6 +8,6 @@ Simply run: `kubectl create -f examples/leader/habitat.yml`. -This will deploy 3 instances of consul Habitat service. +This will deploy 3 instances of Redis Habitat service. Note: Whenever creating a `leader` topology specify instance `count` of 3 or more and would be best if the number is odd, this is so the election can take place. diff --git a/examples/leader/habitat.yml b/examples/leader/habitat.yml index 86d21413..0e6537b6 100644 --- a/examples/leader/habitat.yml +++ b/examples/leader/habitat.yml @@ -3,8 +3,8 @@ kind: Habitat metadata: name: example-leader-follower-habitat spec: - # the core/consul habitat service packaged as a Docker image - image: kinvolk/consul-hab + # the core/redis habitat service packaged as a Docker image + image: kinvolk/redis-hab # count must be at least 3 for a leader-follower topology count: 3 service: diff --git a/examples/namespaced/habitat.yml b/examples/namespaced/habitat.yml index c52ee954..078fbbc1 100644 --- a/examples/namespaced/habitat.yml +++ b/examples/namespaced/habitat.yml @@ -9,11 +9,11 @@ metadata: name: example-namespaced-habitat namespace: example-namespace spec: - # the core/nginx habitat service packaged as a Docker image - image: kinvolk/nginx-hab + # the core/redis habitat service packaged as a Docker image + image: kinvolk/redis-hab count: 1 service: - name: nginx + name: redis topology: standalone # if not present, defaults to "default" group: foobar diff --git a/examples/standalone/README.md b/examples/standalone/README.md index 05a76aaf..71b72f37 100644 --- a/examples/standalone/README.md +++ b/examples/standalone/README.md @@ -9,4 +9,4 @@ Simply run: `kubectl create -f examples/standalone/habitat.yml`. -This will deploy an instance of an nginx Habitat service. +This will deploy an instance of a redis Habitat service. diff --git a/examples/standalone/habitat.yml b/examples/standalone/habitat.yml index 0b43f9cb..3dfa0f86 100644 --- a/examples/standalone/habitat.yml +++ b/examples/standalone/habitat.yml @@ -3,11 +3,11 @@ kind: Habitat metadata: name: example-standalone-habitat spec: - # the core/nginx habitat service packaged as a Docker image - image: kinvolk/nginx-hab + # the core/redis habitat service packaged as a Docker image + image: kinvolk/redis-hab count: 1 service: - name: nginx + name: redis topology: standalone # if not present, defaults to "default" group: foobar