github.com/Microsoft/fabrikate@v0.0.0-20190420002442-bff75be28d02/docs/component.md (about) 1 ## Component Object Model 2 3 A deployment definition in Fabrikate is specified via one or more component.yaml/json files. Each of these file contains a 4 specification of a component with the following schema: 5 6 * `name`: A free form text name for this component. This name is used to refer to the component in [config specifications](./config). 7 8 * `generator`: Method used to generate the resource manifests for this particular component. Currently, `static` (file based), `helm` (helm based), and `component` are supported values. 9 10 * `source`: The source for this component. This can be a URL in the case of remote components or a local path to specify a local filesystem component. 11 12 * `method`: The method by which this component is sourced. Currently, only `git` and `local` are supported values. 13 14 * `path`: For some components, like ones generated with `helm`, the desired target of the component might not be located at the root of the repo. Path enables you to specify the relative `path` to this target from the root of the `source`. 15 16 * `version`: For git `method` components, this specifies a specific commit SHA hash that the component should be locked to, enabling you to lock the component to a consistent version. 17 18 * `branch`: For git `method` components, this specifies the branch that should be checked out after the git `source` is cloned. 19 20 * `hooks`: Hooks enable you to execute one or more shell commands before or after the following component lifecycle events: `before-install`, `before-generate`, `after-install`, `after-generate`. 21 22 * `repositories`: A field of key/value pairs consisting of a set of helm repositories that should be added. 23 24 * `subcomponents`: Zero or more subcomponents that define how to build the resource manifests that make up this component. These subcomponents are components themselves and have exactly the same schema as above. 25 26 ## Examples 27 28 ### Prometheus Grafana 29 30 This [component specification](https://github.com/timfpark/fabrikate-prometheus-grafana) generates static manifests for the `grafana` and `prometheus` namespaces and then remotely sources two helm charts for prometheus and grafana respectively. 31 32 ```yaml 33 name: "prometheus-grafana" 34 generator: "static" 35 path: "./manifests" 36 subcomponents: 37 - name: "grafana" 38 generator: "helm" 39 source: "https://github.com/helm/charts" 40 method: "git" 41 path: "stable/grafana" 42 - name: "prometheus" 43 generator: "helm" 44 source: "https://github.com/helm/charts" 45 method: "git" 46 path: "stable/prometheus" 47 ``` 48 49 ### Istio 50 51 This [component specification](https://github.com/evanlouie/fabrikate-istio) utilizes hooks to download and unpack an Istio release and then reference it with a local path. 52 53 ```yaml 54 name: istio 55 generator: helm 56 path: "./tmp/istio-1.1.2/install/kubernetes/helm/istio" 57 hooks: 58 before-install: 59 - curl -Lv https://github.com/istio/istio/releases/download/1.1.2/istio-1.1.2-linux.tar.gz -o istio.tar.gz 60 - mkdir -p tmp 61 - tar xvf istio.tar.gz -C tmp 62 after-install: 63 - rm istio.tar.gz 64 subcomponents: 65 - name: istio-namespace 66 generator: static 67 path: ./manifests 68 - name: istio-crd # 1.1 split out CRDs to seperate chart 69 generator: helm 70 path: "./tmp/istio-1.1.2/install/kubernetes/helm/istio-init" 71 ``` 72 73 ### Jaeger 74 75 This [component specification](https://github.com/bnookala/fabrikate-jaeger) is specified in JSON and also utilizes a `repositories` field to add the incubator repo to helm. 76 77 ```json 78 { 79 "name": "fabrikate-jaeger", 80 "generator": "static", 81 "path": "./manifests", 82 "subcomponents": [ 83 { 84 "name": "jaeger", 85 "generator": "helm", 86 "repositories": { 87 "incubator": "https://kubernetes-charts-incubator.storage.googleapis.com/" 88 }, 89 "source": "https://github.com/helm/charts", 90 "method": "git", 91 "path": "incubator/jaeger" 92 } 93 ] 94 } 95 ```