зеркало из https://github.com/microsoft/fabrikate.git
Add Install YAML Test
This commit is contained in:
Родитель
95b2ff7147
Коммит
2d4d25a167
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGenerate(t *testing.T) {
|
||||
func TestGenerateJSON(t *testing.T) {
|
||||
components, err := Generate("../test/fixtures/generate", "prod")
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
@ -25,3 +25,20 @@ func TestGenerate(t *testing.T) {
|
|||
assert.Equal(t, "kibana", components[5].Name)
|
||||
assert.Equal(t, 1595, len(components[5].Manifest))
|
||||
}
|
||||
|
||||
func TestGenerateYAML(t *testing.T) {
|
||||
components, err := Generate("../test/fixtures/generate-yaml", "prod")
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, 3, len(components))
|
||||
|
||||
assert.Equal(t, "prometheus-grafana", components[0].Name)
|
||||
assert.Equal(t, 125, len(components[0].Manifest))
|
||||
|
||||
assert.Equal(t, "grafana", components[1].Name)
|
||||
assert.Equal(t, 8159, len(components[1].Manifest))
|
||||
|
||||
assert.Equal(t, "prometheus", components[2].Name)
|
||||
assert.Equal(t, 21023, len(components[2].Manifest))
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestInstall(t *testing.T) {
|
||||
func TestInstallJSON(t *testing.T) {
|
||||
err := Install("../test/fixtures/install")
|
||||
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestInstallYaml(t *testing.T) {
|
||||
func TestInstallYAML(t *testing.T) {
|
||||
err := Install("../test/fixtures/install-yaml")
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -51,6 +51,7 @@ func GenerateHelmComponent(component *core.Component) (manifest string, err erro
|
|||
|
||||
configYaml, err := yaml.Marshal(&component.Config.Config)
|
||||
if err != nil {
|
||||
log.Errorf("marshalling config yaml for helm generated component '%s' failed with: %s\n", component.Name, err.Error())
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -71,6 +72,7 @@ func GenerateHelmComponent(component *core.Component) (manifest string, err erro
|
|||
manifests, err := exec.Command("docker", "run", "--rm", "-v", volumeMount, "alpine/helm:latest", "template", "/app/chart", "--values", "/app/chart/overriddenValues.yaml", "--name", name).Output()
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("helm template failed with: %s\n", err.Error())
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
name: "elasticsearch-fluentd-kibana"
|
||||
generator: "static"
|
||||
path: "./manifests"
|
||||
subcomponents:
|
||||
- name: "grafana"
|
||||
generator: "helm"
|
||||
repo: "https://github.com/helm/charts"
|
||||
path: "stable/grafana"
|
||||
- name: "prometheus"
|
||||
generator: "helm"
|
||||
repo: "https://github.com/helm/charts"
|
||||
path: "stable/prometheus"
|
|
@ -0,0 +1,52 @@
|
|||
config:
|
||||
subcomponents:
|
||||
prometheus:
|
||||
config:
|
||||
namespace: "prometheus"
|
||||
adminUser: "ops"
|
||||
alertmanager:
|
||||
persistentVolume:
|
||||
storageClass: "default"
|
||||
server:
|
||||
persistentVolume:
|
||||
storageClass": "default"
|
||||
grafana:
|
||||
config:
|
||||
namespace: "grafana"
|
||||
datasources:
|
||||
datasources.yaml:
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
url: http://prometheus-server.prometheus.svc.cluster.local
|
||||
access: proxy
|
||||
isDefault: true
|
||||
dashboardProviders:
|
||||
dashboardproviders.yaml:
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: default
|
||||
orgId: 1
|
||||
folder:
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards/default
|
||||
dashboards:
|
||||
default:
|
||||
cluster-metrics:
|
||||
gnetId: 6417
|
||||
revision: 1
|
||||
datasource: Prometheus
|
||||
persistent-volumes:
|
||||
gnetId: 6739
|
||||
revision: 1
|
||||
datasource: Prometheus
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClassName: default
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 4Gi
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: grafana
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: prometheus
|
Загрузка…
Ссылка в новой задаче