在部署时自动改变Openshift杆

时间:2017-11-23 11:01:25

标签: openshift grafana

我使用提供的Openshift PaaS部署Grafana应用程序图片。

我想在Grafana中添加一个插件,方法是将某些文件添加到文件系统或调用grafana-cli命令。

我设法通过oc CLI通过单极手动完成。我不知道的是如何让它持久。我想通过在实例化Openshift极点时应用它。除了为此提供自定义图像之外,我找不到其他方法。

是否支持将文件添加到现有预定义图像的方法? 或者在部署后在杆上调用命令?我尝试了post post钩子但看起来文件系统还没有(或者我不知道如何使用这个钩子)

1 个答案:

答案 0 :(得分:0)

部署后生命周期挂钩在其自己的容器中运行,具有自己的文件系统,而不是应用程序的容器。你想看一个postStart钩子。

$ oc explain dc.spec.template.spec.containers.lifecycle
RESOURCE: lifecycle <Object>

DESCRIPTION:
     Actions that the management system should take in response to container
     lifecycle events. Cannot be updated.

    Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.

FIELDS:
   postStart    <Object>
     PostStart is called immediately after a container is created. If the
     handler fails, the container is terminated and restarted according to its
     restart policy. Other management of the container blocks until the hook
     completes. More info:
     http://kubernetes.io/docs/user-guide/container-environment#hook-details

   preStop  <Object>
     PreStop is called immediately before a container is terminated. The
     container is terminated after the handler completes. The reason for
     termination is passed to the handler. Regardless of the outcome of the
     handler, the container is eventually terminated. Other management of the
     container blocks until the hook completes. More info:
     http://kubernetes.io/docs/user-guide/container-environment#hook-details