github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/3-create-a-jackal-package/2-jackal-components.md (about) 1 import Properties from '@site/src/components/SchemaItemProperties'; 2 import ExampleYAML from '@site/src/components/ExampleYAML'; 3 import Tabs from '@theme/Tabs'; 4 import TabItem from '@theme/TabItem'; 5 6 # Package Components 7 8 :::note 9 10 The following examples are not all-inclusive and are only meant to showcase the different types of resources that can be defined in a component. For a full list of fields and their options, please see the [component schema documentation](4-jackal-schema.md#components). 11 12 ::: 13 14 ## Overview 15 16 The actual capabilities that Jackal Packages provided are defined within named components. 17 18 These components define what dependencies they have along with a declarative definition of how they should be deployed. 19 20 Each package can have as many components as the package creator wants but a package isn't anything without at least one component. 21 22 Fully defined examples of components can be found in the [examples section](/examples/) of the documentation. 23 24 ## Common Component Fields 25 26 There are certain fields that will be common across all component definitions. These fields are: 27 28 <Properties item="JackalComponent" invert include={["files","charts","manifests","images","repos","dataInjections","extensions","scripts","actions"]} /> 29 30 ### Actions 31 32 <Properties item="JackalComponent" include={["actions"]} /> 33 34 Component actions are explored in the [component actions documentation](7-component-actions.md). 35 36 ### Files 37 38 <Properties item="JackalComponent" include={["files"]} /> 39 40 Files can be: 41 42 - Relative paths to either a file or directory (from the `jackal.yaml` file) 43 - A remote URL (http/https) 44 - Verified using the `shasum` field for data integrity (optional and only available for files) 45 46 #### File Examples 47 48 <Tabs queryString="file-examples"> 49 <TabItem value="Local"> 50 <ExampleYAML src={require('../../examples/component-actions/jackal.yaml')} component="on-deploy-with-template-use-of-variable" /> 51 </TabItem> 52 <TabItem value="Remote with SHA sums"> 53 <ExampleYAML src={require('../../packages/distros/k3s/jackal.yaml')} component="k3s" /> 54 </TabItem> 55 </Tabs> 56 57 ### Helm Charts 58 59 <Properties item="JackalComponent" include={["charts"]} /> 60 61 Charts using the `localPath` key can be: 62 63 - Relative paths to either a file or directory (from the `jackal.yaml` file) 64 65 Charts using the `url` key can be: 66 67 - A remote URL (http/https) to a Git repository 68 - A remote URL (oci://) to an OCI registry 69 - A remote URL (http/https) to a Helm repository 70 71 :::note 72 73 To use a private Helm repository the repo must be added to Helm. You can add a repo to Helm with the [`helm repo add`](https://helm.sh/docs/helm/helm_repo_add/) command or the internal [`jackal tools helm repo add`](../2-the-jackal-cli/100-cli-commands/jackal_tools_helm_repo_add.md) command. 74 75 ::: 76 77 #### Chart Examples 78 79 <ExampleYAML src={require('../../examples/helm-charts/jackal.yaml')} component="demo-helm-charts" /> 80 81 ### Kubernetes Manifests 82 83 <Properties item="JackalComponent" include={["manifests"]} /> 84 85 Manifests under the `files` key can be: 86 87 - Relative paths to a Kubernetes manifest file (from the `jackal.yaml` file) 88 - Verified using the `url@shasum` syntax for data integrity (optional and only for remote URLs) 89 90 Manifests under the `kustomizations` key can be: 91 92 - Any valid Kustomize reference both local and [remote](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md) (ie. anything you could do a `kustomize build` on) 93 94 :::note 95 96 Jackal dynamically generates a Helm Chart from the named manifest entries that you specify. This means that any given set of files under a manifest entry will be applied according to [Helm Chart template and manifest install ordering](https://github.com/helm/helm/blob/main/pkg/releaseutil/manifest_sorter.go#L78) and not necessarily in the order that files are declared. If ordering is important, consider moving each file into its own manifest entry in the `manifests` array. 97 98 ::: 99 100 #### Manifest Examples 101 102 <Tabs queryString="manifest-examples"> 103 <TabItem value="Local"> 104 <ExampleYAML src={require('../../examples/manifests/jackal.yaml')} component="httpd-local" /> 105 </TabItem> 106 <TabItem value="Remote"> 107 <ExampleYAML src={require('../../examples/manifests/jackal.yaml')} component="nginx-remote" /> 108 </TabItem> 109 <TabItem value="Kustomizations"> 110 111 :::info 112 113 Kustomizations are handled a bit differently than normal manifests in that Jackal will automatically run `kustomize build` on them during `jackal package create`, thus rendering the Kustomization into a single manifest file. This prevents needing to grab any remote Kustomization resources during `jackal package deploy` but also means that any Jackal [`variables`](../../examples/variables/README.md#deploy-time-variables-and-constants) will only apply to the rendered manifest not the `kustomize build` process. 114 115 ::: 116 117 <ExampleYAML src={require('../../examples/manifests/jackal.yaml')} component="podinfo-kustomize" /> 118 </TabItem> 119 </Tabs> 120 121 ### Container Images 122 123 <Properties item="JackalComponent" include={["images"]} /> 124 125 Images can either be discovered manually, or automatically by using [`jackal dev find-images`](../2-the-jackal-cli/100-cli-commands/jackal_dev_find-images.md). 126 127 :::note 128 129 `jackal dev find-images` will find images for most standard manifests, kustomizations, and helm charts, however some images cannot be discovered this way as some upstream resources (like operators) may bury image definitions inside. For these images, `jackal dev find-images` also offers support for the draft [Helm Improvement Proposal 15](https://github.com/helm/community/blob/main/hips/hip-0015.md) which allows chart creators to annotate any hidden images in their charts along with the [values conditions](https://github.com/helm/community/issues/277) that will cause those images to be used. 130 131 ::: 132 133 #### Image Examples 134 135 <ExampleYAML src={require('../../examples/podinfo-flux/jackal.yaml')} component="flux" /> 136 137 ### Git Repositories 138 139 The [`git-data`](/examples/git-data/) example provides an in-depth explanation of how to include Git repositories in your Jackal package to be pushed to the internal/external Git server. 140 141 The [`podinfo-flux`](/examples/podinfo-flux/) example showcases a simple GitOps workflow using Flux and Jackal. 142 143 <Properties item="JackalComponent" include={["repos"]} /> 144 145 #### Repository Examples 146 147 <Tabs queryString="git-repo-examples"> 148 <TabItem value="Full Mirror"> 149 <ExampleYAML src={require('../../examples/git-data/jackal.yaml')} component="full-repo" /> 150 </TabItem> 151 <TabItem value="Specific Tag"> 152 <ExampleYAML src={require('../../examples/git-data/jackal.yaml')} component="specific-tag" /> 153 </TabItem> 154 <TabItem value="Specific Branch"> 155 <ExampleYAML src={require('../../examples/git-data/jackal.yaml')} component="specific-branch" /> 156 </TabItem> 157 <TabItem value="Specific Hash"> 158 <ExampleYAML src={require('../../examples/git-data/jackal.yaml')} component="specific-hash" /> 159 </TabItem> 160 </Tabs> 161 162 ### Data Injections 163 164 <Properties item="JackalComponent" include={["dataInjections"]} /> 165 166 <ExampleYAML src={require('../../examples/kiwix/jackal.yaml')} component="kiwix-serve" /> 167 168 ### Component Imports 169 170 <Properties item="JackalComponent" include={["import"]} /> 171 172 <Tabs queryString="import-examples"> 173 <TabItem value="Local Path"> 174 <ExampleYAML src={require('../../examples/composable-packages/jackal.yaml')} component="local-games-path" /> 175 </TabItem> 176 <TabItem value="OCI URL"> 177 <ExampleYAML src={require('../../examples/composable-packages/jackal.yaml')} component="oci-games-url" /> 178 </TabItem> 179 </Tabs> 180 181 :::note 182 183 During composition, Jackal will merge the imported component with the component that is importing it. This means that if the importing component defines a field that the imported component also defines, the value from the importing component will be used and override. 184 185 This process will also merge `variables` and `constants` defined in the imported component's `jackal.yaml` with the importing component. The same override rules apply here as well. 186 187 ::: 188 189 ### Extensions 190 191 <Properties item="JackalComponent" include={["extensions"]} /> 192 193 <ExampleYAML src={require('../../examples/big-bang/jackal.yaml')} component="bigbang" /> 194 195 ## Deploying Components 196 197 When deploying a Jackal package, components are deployed in the order they are defined in the `jackal.yaml`. 198 199 The `jackal.yaml` configuration for each component also defines whether the component is 'required' or not. 'Required' components are always deployed without any additional user interaction while optional components are printed out in an interactive prompt asking the user if they wish to the deploy the component. 200 201 If you already know which components you want to deploy, you can do so without getting prompted by passing the components as a comma-separated list to the `--components` flag during the deploy command. 202 203 ```bash 204 # deploy all required components, prompting for optional components and variables 205 $ jackal package deploy ./path/to/package.tar.zst 206 207 # deploy all required components, ignoring optional components and variable prompts 208 $ jackal package deploy ./path/to/package.tar.zst --confirm 209 210 # deploy optional-component-1 and optional-component-2 components whether they are required or not 211 $ jackal package deploy ./path/to/package.tar.zst --components=optional-component-1,optional-component-2 212 ``` 213 214 :::tip 215 216 You can deploy components in a package using globbing as well. The following would deploy all components regardless of optional status: 217 218 ```bash 219 # deploy optional-component-1 and optional-component-2 components whether they are required or not 220 $ jackal package deploy ./path/to/package.tar.zst --components=* 221 ``` 222 223 If you have any `default` components in a package definition you can also exclude those from the CLI with a leading dash (`-`) (similar to how you can exclude search terms in a search engine). 224 225 ```bash 226 # deploy optional-component-1 but exclude default-component-1 227 $ jackal package deploy ./path/to/package.tar.zst --components=optional-component-1,-default-component-1 228 ``` 229 230 :::