Skip to content

Commit

Permalink
Merge pull request #425 from Xtigyro/feature/add-full-dried-example
Browse files Browse the repository at this point in the history
 Add DRY-ed Example
  • Loading branch information
Sami Alajrami authored Apr 8, 2020
2 parents a47b13c + 85a8247 commit ff00b76
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/how_to/misc/use-dry-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: v3.0.0
---

# Use DRY-ed code in YAML

If you want to use as a baseline or deploy the DRY-ed example, please refer to the provided [app templates](../../../examples/appsTemplates)
11 changes: 11 additions & 0 deletions examples/appsTemplates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DRY-ed Example

## Execution Plan

To deploy the DRY-ed example, the app templates placed in [config](config) and [apps](apps) need to be used. To do so - please run:

```bash
helmsman -apply -f config/helmsman.yaml
```

> **Tip**: That kind of DRY-ed code can be achieved only using YAML desired state files.
2 changes: 2 additions & 0 deletions examples/appsTemplates/apps/puppetserver/common-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
puppetserver:
puppeturl: 'https://github.com/puppetlabs/control-repo.git'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
r10k:
code:
cronJob:
schedule: "*/2 * * * *"
4 changes: 4 additions & 0 deletions examples/appsTemplates/apps/puppetserver/testing-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
r10k:
code:
cronJob:
schedule: "*/1 * * * *"
7 changes: 7 additions & 0 deletions examples/appsTemplates/apps/tomcat/common-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 256Mi
1 change: 1 addition & 0 deletions examples/appsTemplates/apps/tomcat/development-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hostPort: 8009
1 change: 1 addition & 0 deletions examples/appsTemplates/apps/tomcat/testing-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hostPort: 8010
105 changes: 105 additions & 0 deletions examples/appsTemplates/config/helmsman.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
metadata:
scope: "K8s Cluster kind-1"
maintainer: "devops"

settings:
kubeContext: "kind-kind-1" # the name of the context to be created
slackWebhook: "$MY_SLACK_WEBHOOK"

namespaces:
testing:
labels:
env: "testing"
limits:
- type: Container
default:
cpu: "200m"
memory: "250Mi"
defaultRequest:
cpu: "100m"
memory: "150Mi"
- type: Pod
max:
memory: "300Mi"
development:
labels:
env: "development"
limits:
- type: Container
default:
cpu: "300m"
memory: "300Mi"
defaultRequest:
cpu: "200m"
memory: "200Mi"
- type: Pod
max:
memory: "400Mi"

helmRepos:
stable: "https://kubernetes-charts.storage.googleapis.com"

appsTemplates:
common: &common
test: true

testing: &testing
namespace: "testing"
protected: false # defining all "testing" releases to be protected.
wait: true

development: &development
namespace: "development"
protected: true # defining all "development" releases to be protected.
wait: false

puppetserver: &puppetserver
enabled: true
priority: -1
chart: "../../../../puppetserver-helm-chart-1.8.2.tgz" # https://github.com/puppetlabs/pupperware/tree/master/k8s
version: "1.8.2" # chart version
valuesFiles: [
"../apps/puppetserver/common-values.yaml",
]

tomcat: &tomcat
enabled: true
priority: -2
chart: "stable/tomcat"
version: "0.4.0" # chart version
valuesFiles: [
"../apps/tomcat/common-values.yaml",
]

apps:
testing-puppetserver:
<<: *common
<<: *testing
<<: *puppetserver
valuesFiles: [
"../apps/puppetserver/testing-values.yaml",
]

testing-tomcat:
<<: *common
<<: *testing
<<: *tomcat
valuesFiles: [
"../apps/tomcat/testing-values.yaml",
]

development-puppetserver:
<<: *common
<<: *development
<<: *puppetserver
valuesFiles: [
"../apps/puppetserver/development-values.yaml",
]

development-tomcat:
<<: *common
<<: *development
<<: *tomcat
valuesFiles: [
"../apps/tomcat/development-values.yaml",
]

0 comments on commit ff00b76

Please sign in to comment.