You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nocalhost's development configuration supports multiple developing ways, such as ConfigMap, Annotations, etc. In fact, these configuration methods ** also suit for ** deployment configuration. But some functions need to be implemented through the K8s adminssion WebHook. In Nocalhost, a component called `Nocalhost-Dep`plays this role, and `Nocalhost Server`will automatically deploy this component for you. if you do not use `Nocalhost Server`, then additional deployment of `Nocalhost Dep`is required.
[What deployment configurations does Nocalhost provide?](config-deployment-spec.md)introduces which deployment configurations require additional deployment of `Nocalhost Dep`.
24
24
25
25
:::
26
26
27
27
<br/>
28
28
29
29
******
30
30
31
-
## 使用 ConfigMap 配置部署配置
31
+
## Using ConfigMap to make deployment configuration
To make a simple deployment configuration is mentioned in [Introduction to Deployment Configuration --- Nocalhost Basic Deployment Configuration](config-deployment-quickstart.md). Combining with [What configuration methods are supported by Nocalhost-place the configuration in configmap](configure-en.md#configuration-in-configmap), we can get the configuration:
The content of the deployment configuration itself will not be repeated here. let's take a look at `charts/bookinfo/templates/nocalhost-app-config.yaml`.
59
56
60
57
```yaml
61
58
apiVersion: v1
@@ -77,7 +74,7 @@ data:
77
74
78
75
:::danger
79
76
80
-
这个 ConfigMap 需要最先被提交的 Api Server,如在 Helm 的应用场景下,它应该被声明为 `pre-install`
77
+
This ConfigMap requires to apply to Api Server first. For example, in the Helm application scenario, it should be declared as `pre-install`.
It introduces `.Values.nocalhost.config.path` to render the main body of the deployment configuration. The configuration is actually declared in `./charts/bookinfo/example/config-from-cm/nocalhost-full-config.yaml`, which is a standard Nocalhost deployment configuration without any additional modification:
92
89
93
90
```yaml
94
91
application:
@@ -154,21 +151,21 @@ application:
154
151
155
152
******
156
153
157
-
## 使用 Annotations 配置部署配置
154
+
## Using Annotations to make the deployment configuration
The method of usage is exactly the same as [Which configuration methods Nocalhost supports-place the configuration in annotations](configure-en.md#configuration-in-annotations).
Since Annotations closely follow the workload, some configurations at the application level are not supported. Only the configurations under `application.services` is supported.
We specified `values-annotation-config.yaml` as Values.yaml, which specifies the rendering of the local configuration file to the Annotations of the workload. Take `./charts/bookinfo/templates/microservice-details.yaml` as an example:
Helm will render the path configured by `.Values.nocalhost.annotations.path.details` into yaml, whose content is as follows, that is, `./charts/bookinfo/example/config-from-annotations/details.yaml` specified in Values :
Some functions of the deployment configuration rely on the **Nocalhost-Dep component**. If you use Nocalhost Server, we will automatically install this component for you. Otherwise an additional installation is required.
If the **Nocalhost-Dep component** is not installed, some functions will be restricted. This article will mark those functions that need **Nocalhost-Dep**.
25
25
26
26
:::
27
27
28
-
## 启动顺序依赖控制 ([组件依赖](#danger))
29
-
范例:
28
+
## Startup dependency control ([component dependency](#danger))
When a resource declares `dependLabelSelector` in the deployment configuration, the characters in the `pods` array represent the labels of the pods to be waited for. The format is key-value pairs. The characters in the `jobs` array represent the labels of the jods to be waited for. The format is also key-value pairs.
Both `pods` and `jobs` are optional. When you actually deploy your application, it will generate an `initContainer` for the specified workload, wait for the status of all pods matching the label to be `Ready`, and wait for the status of all jobs matching the label to be `Succeeded`.
Injecting global variables needs to be declared at the level of `application`. During the deployment, it will inject the corresponding environment variables into all deployed `Deployment`, `DaemonSet`, `ReplicaSet`, `StatefulSet`, `Job`, and `CronJob`.
82
+
83
+
:::tip Injecting variables supports two kinds syntax, which can be mixed
84
+
85
+
- The first one is to declare key-value pairs directly
86
+
- The second is to declare an env file relative to `config.yaml`, the content is line-by-line `Key=Value`:
The container-level variable injection is declared in `application.services[*].containers[*].install`, indicating that the corresponding variables are injected into the corresponding container during deployment. The rules of `env` and `envFrom` are in line with the application level's.
The configuration rules are similar to the container and variable injection declarations, and need to be configured in `application.services[*].containers[*].install`.
The port forwarding after installation is as it's name implies. After the application is installed, it can automatically forward port to the local for some services. For instance, database, MQ and other commonly used services' ports are suitable for automatic forwarding and configuration rules after installation. The port forwarding rules are consistent with K8s, namely `local port: container port`.
Nocalhost supports injecting various hooks in the life cycle of the application. **Hooks currently only support Job**, where `path` is the RawManifest **relative to the home directory**, which must be the job type. `weight` is the weight. The lower ones are executed first.
Hook is similar to Helm's Hook. Hook itself is to make up for the shortcomings of non-Helm applications, so ** Helm-type applications cannot configure Hook (You can use Helm's Hook directly)**.
- `onPostInstall`发生在应用部署之后,当所有资源都提交到 K8s Api Server,会执行此 Job,状态为 `Successed` 后,部署成功。否则将回滚,执行卸载操作。
220
+
:::info The explanation of Hook
221
+
222
+
- `onPreInstall`occurs before the employment of the application, including performing some initialization operations such as clusters and databases. The deployment will start after the job status is `Successed`. If it fails, the installation will be terminated.
223
+
- `onPostInstall`occurs after the application is deployed. When all resources are submitted to the K8s Api Server, this job will be executed. After the status is `Successed`, the deployment is successful. Otherwise, it will roll back and perform the uninstall operation.
0 commit comments