经过Idea进行Kubernetes YAML开发

<div class="htmledit_views" id="content_views"> <p style="margin-left:0px;"><span style="color:#333333;">即将推出的<a href="https://www.jetbrains.com/idea/nextversion/" rel="nofollow" target="_blank">IntelliJ IDEA 2018.1</a>&nbsp;Ultimate Edition经过全新的<a href="https://plugins.jetbrains.com/plugin/10485-kubernetes" rel="nofollow" target="_blank">Kubernetes插件</a>为Kubernetes引入了初步支持。新插件支持从v1.5到最近发布的v1.9&nbsp;的<em>Kubernetes</em>资源文件。</span></p>html

<p style="margin-left:0px;"><span style="color:#333333;"><em><a href="https://kubernetes.io/" rel="nofollow" target="_blank">Kubernetes</a></em>的IntelliJ IDEA加强功能包括:代码完成,检查,<em>Kubernetes资源</em>文件的快速修复,<em>装订线中的</em>图标以便于导航,弹出文档和实时模板。继续阅读以获取更多详细信息和屏幕截图</span></p>api

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/ij_ku1.png" rel="nofollow" target="_blank"><img alt="ij_ku1" class="alignnone size-full wp-image-17364" height="400" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/ij_ku1.png" width="800"></a></span></p>编辑器

<p style="margin-left:0px;"><span style="color:#333333;">请注意,<em>Kubernetes</em>插件未捆绑,所以在使用此新功能以前,您须要安装插件。转到首选项|&nbsp;插件|&nbsp;Kubernetes插件,或从<a href="https://plugins.jetbrains.com/plugin/10485-kubernetes" rel="nofollow" target="_blank">网站</a>下载插件。</span></p>ide

<p style="margin-left:0px;"><span style="color:#333333;">新的<em>Kubernetes</em>插件兼容全部付费的JetBrains IDE:PhpStorm,WebStorm,PyCharm Professional,RubyMine,AppCode,CLion,GoLand和DataGrip。</span></p>网站

<p style="margin-left:0px;"><span style="color:#333333;">一旦<em>Kubernetes</em>安装插件,您能够建立和编辑<em>YAML</em>和<em>JSON Kubernetes资源</em>在IntelliJ IDEA的文件。新插件将查找文件中是否存在<em>apiVersion</em>和<em>kind</em>字段,若是存在这些字段,则会将此类文件视为<em>Kubernetes资源</em>文件。</span></p>idea

<p style="margin-left:0px;"><span style="color:#333333;">使用<em>Kubernetes资源</em>文件可能具备挑战性,由于您须要包含全部必填字段,这些字段因应用的<em>Kubernetes</em>API版本和种类类型而异。这意味着在建立<em>Kubernetes资源</em>文件时,<em>必须</em>常常查阅<em>Kubernetes</em>文档。为了让您更容易使用Kubernetes,新插件有一整套改进。</span></p>spa

<p style="margin-left:0px;"><span style="color:#333333;">首先,Kubernetes插件有一个内置的<em>实时模板</em>,可让您快速建立所需的<em>YAML Kubernetes</em>资源文件类型:</span></p>.net

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/2018-03-02-14_52_26.gif" rel="nofollow" target="_blank"><img alt="2018-03-02 14_52_26" class="alignnone wp-image-17385" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/2018-03-02-14_52_26.gif" width="750"></a></span></p>插件

<p style="margin-left:0px;"><span style="color:#333333;">新插件如今包含几个预约义的<em>Kubernetes</em>模板,您能够经过键入其缩写来调用必要的<em>Live Template</em>。</span></p>orm

<p style="margin-left:0px;"><span style="color:#333333;">若是要添加本身的<em>实时模板</em>或自定义现有<em>模板</em>,请转到<em>“首选项”|&nbsp;实时模板|&nbsp;Kubernetes。</em></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">代码完成如今适用于<em>YAML Kubernetes</em>资源文件。Kubernetes插件提供了您能够在资源中使用的正确值。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/KubCompletion-1.gif" rel="nofollow" target="_blank"><img alt="KubCompletion(1)" class="alignnone wp-image-17394" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/KubCompletion-1.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">为了帮助您真正快速为Kubernetes&nbsp;建立所需的<em>YAML定义</em>文件,请开始键入所需的密钥并调用Smart Completion。新插件将自动完成如下全部级别的全部必需键。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/SmartDeep.gif" rel="nofollow" target="_blank"><img alt="SmartDeep" class="alignnone wp-image-17393" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/SmartDeep.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">对于<em>YAML Kubernetes资源</em>文件,该插件提供了在标签订义和标签选择器之间导航的功能。使用装订线中的图标。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image10.gif" rel="nofollow" target="_blank"><img alt="image10" class="alignnone wp-image-17378" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image10.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">若是标签与键和值的直接匹配,您还能够从标签选择器导航并跳转到编辑器内的标签订义。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image15.gif" rel="nofollow" target="_blank"><img alt="image15" class="alignnone size-full wp-image-17379" height="600" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image15.gif" width="1200"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">当您重命名<em>YAML Kubernetes</em>文件中的键或值时,该插件还将重命名它们的全部用法。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image8.gif" rel="nofollow" target="_blank"><img alt="image8" class="alignnone wp-image-17377" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image8.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">每当您选择已弃用的<em>Kubernetes</em>属性时,Kubernetes插件都会提醒您<em>(</em>仅适用于<em>YAML文件</em><em>)。</em></span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image12.png" rel="nofollow" target="_blank"><img alt="image12" class="alignnone wp-image-17372" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image12.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">除此以外,若是您尝试使用不适用于具备应用的<em>apiVersion</em>和<em>kind</em>的指定元素的属性,您将收到<em>YAML</em>文件的警告<em>。</em></span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image7.png" rel="nofollow" target="_blank"><img alt="image7" class="alignnone wp-image-17371" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image7.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">该插件突出显示<em>YAML Kubernetes资源</em>定义文件中缺乏键的元素,并提供快速修复以添加所需的键<em>。</em></span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image13.gif" rel="nofollow" target="_blank"><img alt="image13" class="alignnone wp-image-17381" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image13.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">此领域的另外一个加强功能是IntelliJ IDEA如今会警告您冗余密钥。使用提供的快速修复程序删除<em>YAML Kubernetes资源</em>文件中的冗余密钥。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;">咱们的新插件还检测<em>YAML Kubernetes</em>资源文件中的不可编辑键,并在编辑器中突出显示它们。请注意,经过方便的快速修复,能够轻松地从当前<em>YAML&nbsp;</em>文件中删除全部此类只读密钥。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image5.gif" rel="nofollow" target="_blank"><img alt="图像5" class="alignnone wp-image-17370" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image5.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">IDE预览<em>YAML Kubernetes</em>文件中折叠区域的重要信息。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/2018-03-02-16_52_37.gif" rel="nofollow" target="_blank"><img alt="2018-03-02 16_52_37" class="alignnone wp-image-17396" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/2018-03-02-16_52_37.gif" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">您还能够经过按<em>^ J</em>(macOS)或<em>Ctrl + Q</em>(<em>Windows</em>和<em>Linux</em>)调用<em>YAML</em>或<em>Kubernetes资源</em>文件中的任何键的文档。单击<em>快速文档查找中</em>的超连接以导航到更详细的信息。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image14.png" rel="nofollow" target="_blank"><img alt="image14" class="alignnone wp-image-17373" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image14.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><strong>支持</strong><em><strong>JSON Kubernetes资源文件</strong></em></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">虽然不是JSON格式<a href="https://kubernetes.io/docs/concepts/configuration/overview/" rel="nofollow" target="_blank">建议</a>为<em>Kubernetes资源</em>文件时,它仍然被Kubernetes支持。新插件基于JSON模式功能为JSON&nbsp;<em>Kubernetes资源</em>文件提供了一些有限的支持。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;">目前,只有代码完成可用于<em>JSON Kubernetes资源</em>文件。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image2.png" rel="nofollow" target="_blank"><img alt="图像2" class="alignnone wp-image-17367" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image2.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">新插件根据<em>JSON模式</em>验证当前键,并在使用不正确的属性或值时提醒您。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image16.png" rel="nofollow" target="_blank"><img alt="image16" class="alignnone wp-image-17375" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image16.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">此外,插件会突出显示缺乏必需属性的元素,而后建议您应添加的相应属性。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image1.png" rel="nofollow" target="_blank"><img alt="此搜索" class="alignnone wp-image-17365" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image1.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">在<em>JSON Kubernetes</em>文件中也检测到重复的属性。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image4.png" rel="nofollow" target="_blank"><img alt="图像4" class="alignnone wp-image-17369" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image4.png" width="750"></a></span></p>

<p style="margin-left:0px;"><span style="color:#333333;">该<em>快速查找文档</em>也可用于<em>JSON Kubernetes资源</em>文件。</span></p>

<p style="margin-left:0px;"><span style="color:#333333;"><a href="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image3.png" rel="nofollow" target="_blank"><img alt="图像3" class="alignnone wp-image-17368" height="300" src="https://d3nmt5vlzunoa1.cloudfront.net/idea/files/2018/03/image3.png" width="750"></a></span></p> </div> 原文地址:https://blog.csdn.net/ccc7574/article/details/85679015

相关文章
相关标签/搜索