@spinnaker/kubernetes 0.0.0-main-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.md +1663 -0
  2. package/LICENSE.txt +203 -0
  3. package/dist/help/kubernetes.help.d.ts +1 -0
  4. package/dist/index.d.ts +7 -0
  5. package/dist/index.js +6024 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/instance/details/details.controller.d.ts +1 -0
  8. package/dist/instance/index.d.ts +1 -0
  9. package/dist/interfaces/index.d.ts +1 -0
  10. package/dist/interfaces/infrastructure.types.d.ts +24 -0
  11. package/dist/kubernetes.module.d.ts +6 -0
  12. package/dist/loadBalancer/details/details.controller.d.ts +1 -0
  13. package/dist/loadBalancer/index.d.ts +1 -0
  14. package/dist/loadBalancer/transformer.d.ts +1 -0
  15. package/dist/manifest/IManifestCoordinates.d.ts +5 -0
  16. package/dist/manifest/ManifestImageDetails.d.ts +18 -0
  17. package/dist/manifest/ManifestKindSearch.d.ts +13 -0
  18. package/dist/manifest/ManifestLabels.d.ts +15 -0
  19. package/dist/manifest/ManifestQos.d.ts +15 -0
  20. package/dist/manifest/ManifestResources.d.ts +35 -0
  21. package/dist/manifest/ManifestSource.d.ts +4 -0
  22. package/dist/manifest/annotationCustomSections.component.d.ts +1 -0
  23. package/dist/manifest/artifact/artifact.component.d.ts +1 -0
  24. package/dist/manifest/delete/delete.controller.d.ts +12 -0
  25. package/dist/manifest/delete/deleteOptionsForm.component.d.ts +1 -0
  26. package/dist/manifest/editor/json/JsonEditor.d.ts +12 -0
  27. package/dist/manifest/editor/json/jsonEditor.component.d.ts +1 -0
  28. package/dist/manifest/index.d.ts +10 -0
  29. package/dist/manifest/manifest.service.d.ts +25 -0
  30. package/dist/manifest/manifestCommandBuilder.service.d.ts +30 -0
  31. package/dist/manifest/manifestEvents.component.d.ts +1 -0
  32. package/dist/manifest/manifestImageDetails.component.d.ts +1 -0
  33. package/dist/manifest/manifestLabels.component.d.ts +1 -0
  34. package/dist/manifest/manifestQos.component.d.ts +1 -0
  35. package/dist/manifest/manifestResources.component.d.ts +1 -0
  36. package/dist/manifest/rollout/RollingRestart.d.ts +1 -0
  37. package/dist/manifest/rollout/pause.controller.d.ts +1 -0
  38. package/dist/manifest/rollout/resume.controller.d.ts +1 -0
  39. package/dist/manifest/rollout/undo.controller.d.ts +1 -0
  40. package/dist/manifest/scale/ScaleSettingsForm.d.ts +10 -0
  41. package/dist/manifest/scale/scale.controller.d.ts +8 -0
  42. package/dist/manifest/scale/scaleSettingsForm.component.d.ts +1 -0
  43. package/dist/manifest/selector/IManifestLabelSelector.d.ts +9 -0
  44. package/dist/manifest/selector/IManifestSelector.d.ts +30 -0
  45. package/dist/manifest/selector/ManifestSelector.d.ts +46 -0
  46. package/dist/manifest/selector/labelEditor/LabelEditor.d.ts +15 -0
  47. package/dist/manifest/selector/selector.component.d.ts +1 -0
  48. package/dist/manifest/status/ManifestCondition.d.ts +13 -0
  49. package/dist/manifest/status/condition.component.d.ts +1 -0
  50. package/dist/manifest/status/status.component.d.ts +1 -0
  51. package/dist/manifest/traffic/ManifestTrafficService.d.ts +12 -0
  52. package/dist/manifest/wizard/BasicSettings.d.ts +17 -0
  53. package/dist/manifest/wizard/ManifestEntry.d.ts +16 -0
  54. package/dist/manifest/wizard/ManifestWizard.d.ts +22 -0
  55. package/dist/pipelines/stages/ManifestCoordinates.d.ts +31 -0
  56. package/dist/pipelines/stages/ManifestExecutionDetails.d.ts +69 -0
  57. package/dist/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.d.ts +18 -0
  58. package/dist/pipelines/stages/deleteManifest/DeleteManifestStageConfig.d.ts +14 -0
  59. package/dist/pipelines/stages/deleteManifest/deleteManifestStage.d.ts +1 -0
  60. package/dist/pipelines/stages/deployManifest/CopyFromTemplateButton.d.ts +15 -0
  61. package/dist/pipelines/stages/deployManifest/DeployManifestStageConfig.d.ts +15 -0
  62. package/dist/pipelines/stages/deployManifest/DeployManifestStageForm.d.ts +31 -0
  63. package/dist/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.d.ts +17 -0
  64. package/dist/pipelines/stages/deployManifest/ManifestCopier.d.ts +36 -0
  65. package/dist/pipelines/stages/deployManifest/ManifestDeploymentOptions.d.ts +34 -0
  66. package/dist/pipelines/stages/deployManifest/NamespaceSelector.d.ts +16 -0
  67. package/dist/pipelines/stages/deployManifest/deployManifest.validator.d.ts +2 -0
  68. package/dist/pipelines/stages/deployManifest/deployManifestStage.d.ts +1 -0
  69. package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatus.d.ts +23 -0
  70. package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.d.ts +8 -0
  71. package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.d.ts +20 -0
  72. package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.d.ts +9 -0
  73. package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.d.ts +8 -0
  74. package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.d.ts +3 -0
  75. package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.d.ts +7 -0
  76. package/dist/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.d.ts +1 -0
  77. package/dist/pipelines/stages/index.d.ts +8 -0
  78. package/dist/pipelines/stages/patchManifest/PatchManifestOptionsForm.d.ts +8 -0
  79. package/dist/pipelines/stages/patchManifest/PatchManifestStageConfig.d.ts +7 -0
  80. package/dist/pipelines/stages/patchManifest/PatchManifestStageForm.d.ts +21 -0
  81. package/dist/pipelines/stages/patchManifest/patchManifestStage.d.ts +4 -0
  82. package/dist/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.d.ts +13 -0
  83. package/dist/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.d.ts +4 -0
  84. package/dist/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.d.ts +31 -0
  85. package/dist/pipelines/stages/runJob/RunJobExecutionDetails.d.ts +7 -0
  86. package/dist/pipelines/stages/runJob/runJobStage.d.ts +1 -0
  87. package/dist/pipelines/stages/scaleManifest/ScaleManifestConfig.d.ts +3 -0
  88. package/dist/pipelines/stages/scaleManifest/ScaleManifestStageForm.d.ts +7 -0
  89. package/dist/pipelines/stages/scaleManifest/scaleManifestStage.d.ts +1 -0
  90. package/dist/pipelines/stages/traffic/ManifestTrafficStageConfig.d.ts +11 -0
  91. package/dist/pipelines/stages/traffic/disableManifest.stage.d.ts +1 -0
  92. package/dist/pipelines/stages/traffic/enableManifest.stage.d.ts +1 -0
  93. package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.d.ts +3 -0
  94. package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.d.ts +7 -0
  95. package/dist/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.d.ts +1 -0
  96. package/dist/pipelines/stages/validators/manifestSelectorValidators.d.ts +2 -0
  97. package/dist/pipelines/validation/manifestSelector.validator.d.ts +8 -0
  98. package/dist/rawResource/component/K8sResources.d.ts +25 -0
  99. package/dist/rawResource/component/K8sResourcesFilters.d.ts +20 -0
  100. package/dist/rawResource/component/RawResourceUtils.d.ts +5 -0
  101. package/dist/rawResource/component/group/RawResouceGroup.d.ts +15 -0
  102. package/dist/rawResource/component/group/RawResource.d.ts +12 -0
  103. package/dist/rawResource/component/group/RawResourceDetails.d.ts +32 -0
  104. package/dist/rawResource/component/group/RawResourceGroups.d.ts +14 -0
  105. package/dist/rawResource/controller/FiltersPubSub.d.ts +12 -0
  106. package/dist/rawResource/index.d.ts +1 -0
  107. package/dist/rawResource/model/resource.d.ts +17 -0
  108. package/dist/rawResource/rawResource.dataSource.d.ts +2 -0
  109. package/dist/rawResource/rawResource.module.d.ts +1 -0
  110. package/dist/rawResource/rawResource.states.d.ts +6 -0
  111. package/dist/resources/ResourceDetails.d.ts +17 -0
  112. package/dist/resources/resources.state.d.ts +7 -0
  113. package/dist/rolloutStrategy/bluegreen.strategy.d.ts +2 -0
  114. package/dist/rolloutStrategy/highlander.strategy.d.ts +2 -0
  115. package/dist/rolloutStrategy/index.d.ts +1 -0
  116. package/dist/rolloutStrategy/none.strategy.d.ts +2 -0
  117. package/dist/rolloutStrategy/redblack.strategy.d.ts +2 -0
  118. package/dist/securityGroup/details/details.controller.d.ts +1 -0
  119. package/dist/securityGroup/index.d.ts +1 -0
  120. package/dist/securityGroup/securityGroup.reader.d.ts +4 -0
  121. package/dist/securityGroup/transformer.d.ts +1 -0
  122. package/dist/serverGroup/details/details.controller.d.ts +1 -0
  123. package/dist/serverGroup/details/resize/resize.controller.d.ts +1 -0
  124. package/dist/serverGroup/index.d.ts +4 -0
  125. package/dist/serverGroup/serverGroupCommandBuilder.service.d.ts +6 -0
  126. package/dist/serverGroup/serverGroupTransformer.service.d.ts +6 -0
  127. package/dist/serverGroupManager/details/details.controller.d.ts +1 -0
  128. package/dist/serverGroupManager/index.d.ts +1 -0
  129. package/dist/validation/applicationName.validator.d.ts +9 -0
  130. package/package.json +58 -0
  131. package/src/help/kubernetes.help.ts +236 -0
  132. package/src/index.ts +7 -0
  133. package/src/instance/details/details.controller.ts +186 -0
  134. package/src/instance/details/details.html +80 -0
  135. package/src/instance/index.ts +1 -0
  136. package/src/interfaces/index.ts +1 -0
  137. package/src/interfaces/infrastructure.types.ts +35 -0
  138. package/src/kubernetes.module.ts +144 -0
  139. package/src/loadBalancer/details/details.controller.ts +101 -0
  140. package/src/loadBalancer/details/details.html +187 -0
  141. package/src/loadBalancer/index.ts +1 -0
  142. package/src/loadBalancer/transformer.ts +60 -0
  143. package/src/logo/kubernetes.icon.svg +102 -0
  144. package/src/logo/kubernetes.logo.less +6 -0
  145. package/src/logo/kubernetes.logo.svg +1 -0
  146. package/src/manifest/IManifestCoordinates.ts +5 -0
  147. package/src/manifest/ManifestImageDetails.spec.tsx +76 -0
  148. package/src/manifest/ManifestImageDetails.tsx +64 -0
  149. package/src/manifest/ManifestKindSearch.tsx +31 -0
  150. package/src/manifest/ManifestLabels.tsx +31 -0
  151. package/src/manifest/ManifestQos.tsx +68 -0
  152. package/src/manifest/ManifestResources.tsx +69 -0
  153. package/src/manifest/ManifestSource.ts +4 -0
  154. package/src/manifest/annotationCustomSections.component.ts +114 -0
  155. package/src/manifest/artifact/artifact.component.ts +23 -0
  156. package/src/manifest/delete/delete.controller.ts +80 -0
  157. package/src/manifest/delete/delete.html +42 -0
  158. package/src/manifest/delete/deleteOptionsForm.component.ts +52 -0
  159. package/src/manifest/editor/json/JsonEditor.tsx +56 -0
  160. package/src/manifest/editor/json/jsonEditor.component.ts +12 -0
  161. package/src/manifest/index.ts +10 -0
  162. package/src/manifest/manifest.service.ts +90 -0
  163. package/src/manifest/manifestCommandBuilder.service.ts +126 -0
  164. package/src/manifest/manifestEvents.component.ts +12 -0
  165. package/src/manifest/manifestImageDetails.component.ts +12 -0
  166. package/src/manifest/manifestLabels.component.ts +12 -0
  167. package/src/manifest/manifestLabels.less +3 -0
  168. package/src/manifest/manifestQos.component.ts +12 -0
  169. package/src/manifest/manifestResources.component.ts +12 -0
  170. package/src/manifest/rollout/RollingRestart.tsx +54 -0
  171. package/src/manifest/rollout/pause.controller.ts +66 -0
  172. package/src/manifest/rollout/pause.html +28 -0
  173. package/src/manifest/rollout/resume.controller.ts +66 -0
  174. package/src/manifest/rollout/resume.html +28 -0
  175. package/src/manifest/rollout/undo.controller.ts +74 -0
  176. package/src/manifest/rollout/undo.html +44 -0
  177. package/src/manifest/scale/ScaleSettingsForm.tsx +43 -0
  178. package/src/manifest/scale/scale.controller.ts +75 -0
  179. package/src/manifest/scale/scale.html +32 -0
  180. package/src/manifest/scale/scaleSettingsForm.component.ts +11 -0
  181. package/src/manifest/selector/IManifestLabelSelector.ts +19 -0
  182. package/src/manifest/selector/IManifestSelector.ts +64 -0
  183. package/src/manifest/selector/ManifestSelector.spec.tsx +414 -0
  184. package/src/manifest/selector/ManifestSelector.tsx +424 -0
  185. package/src/manifest/selector/labelEditor/LabelEditor.spec.tsx +81 -0
  186. package/src/manifest/selector/labelEditor/LabelEditor.tsx +126 -0
  187. package/src/manifest/selector/labelEditor/labelEditor.less +3 -0
  188. package/src/manifest/selector/selector.component.ts +17 -0
  189. package/src/manifest/status/ManifestCondition.tsx +32 -0
  190. package/src/manifest/status/condition.component.ts +12 -0
  191. package/src/manifest/status/status.component.ts +36 -0
  192. package/src/manifest/traffic/ManifestTrafficService.spec.ts +30 -0
  193. package/src/manifest/traffic/ManifestTrafficService.ts +67 -0
  194. package/src/manifest/wizard/BasicSettings.tsx +57 -0
  195. package/src/manifest/wizard/ManifestEntry.tsx +46 -0
  196. package/src/manifest/wizard/ManifestWizard.tsx +94 -0
  197. package/src/pipelines/stages/ManifestCoordinates.spec.tsx +90 -0
  198. package/src/pipelines/stages/ManifestCoordinates.tsx +128 -0
  199. package/src/pipelines/stages/ManifestExecutionDetails.tsx +58 -0
  200. package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.spec.tsx +85 -0
  201. package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.tsx +87 -0
  202. package/src/pipelines/stages/deleteManifest/DeleteManifestStageConfig.tsx +62 -0
  203. package/src/pipelines/stages/deleteManifest/deleteManifestOptionsForm.less +9 -0
  204. package/src/pipelines/stages/deleteManifest/deleteManifestStage.ts +21 -0
  205. package/src/pipelines/stages/deployManifest/CopyFromTemplateButton.tsx +45 -0
  206. package/src/pipelines/stages/deployManifest/DeployManifestStageConfig.tsx +77 -0
  207. package/src/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +265 -0
  208. package/src/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.tsx +69 -0
  209. package/src/pipelines/stages/deployManifest/ManifestCopier.spec.ts +110 -0
  210. package/src/pipelines/stages/deployManifest/ManifestCopier.tsx +222 -0
  211. package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.spec.tsx +75 -0
  212. package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.tsx +203 -0
  213. package/src/pipelines/stages/deployManifest/NamespaceSelector.tsx +40 -0
  214. package/src/pipelines/stages/deployManifest/deployManifest.validator.ts +38 -0
  215. package/src/pipelines/stages/deployManifest/deployManifestStage.ts +28 -0
  216. package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.less +11 -0
  217. package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.tsx +120 -0
  218. package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.tsx +47 -0
  219. package/src/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.tsx +92 -0
  220. package/src/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.tsx +87 -0
  221. package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.less +24 -0
  222. package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.tsx +46 -0
  223. package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.tsx +35 -0
  224. package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.tsx +37 -0
  225. package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.ts +21 -0
  226. package/src/pipelines/stages/index.ts +8 -0
  227. package/src/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx +35 -0
  228. package/src/pipelines/stages/patchManifest/PatchManifestStageConfig.tsx +57 -0
  229. package/src/pipelines/stages/patchManifest/PatchManifestStageForm.tsx +157 -0
  230. package/src/pipelines/stages/patchManifest/patchManifestStage.ts +30 -0
  231. package/src/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.tsx +46 -0
  232. package/src/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.ts +20 -0
  233. package/src/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.tsx +242 -0
  234. package/src/pipelines/stages/runJob/RunJobExecutionDetails.tsx +67 -0
  235. package/src/pipelines/stages/runJob/runJobStage.ts +39 -0
  236. package/src/pipelines/stages/scaleManifest/ScaleManifestConfig.tsx +38 -0
  237. package/src/pipelines/stages/scaleManifest/ScaleManifestStageForm.tsx +46 -0
  238. package/src/pipelines/stages/scaleManifest/scaleManifestStage.ts +24 -0
  239. package/src/pipelines/stages/traffic/ManifestTrafficStageConfig.tsx +44 -0
  240. package/src/pipelines/stages/traffic/disableManifest.stage.ts +26 -0
  241. package/src/pipelines/stages/traffic/enableManifest.stage.ts +26 -0
  242. package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.tsx +37 -0
  243. package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.tsx +60 -0
  244. package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts +21 -0
  245. package/src/pipelines/stages/validators/manifestSelectorValidators.ts +43 -0
  246. package/src/pipelines/validation/manifestSelector.validator.ts +36 -0
  247. package/src/rawResource/component/K8sResources.less +9 -0
  248. package/src/rawResource/component/K8sResources.tsx +112 -0
  249. package/src/rawResource/component/K8sResourcesFilters.tsx +112 -0
  250. package/src/rawResource/component/RawResourceUtils.ts +19 -0
  251. package/src/rawResource/component/group/RawResouceGroup.tsx +41 -0
  252. package/src/rawResource/component/group/RawResource.less +79 -0
  253. package/src/rawResource/component/group/RawResource.tsx +51 -0
  254. package/src/rawResource/component/group/RawResourceDetails.tsx +236 -0
  255. package/src/rawResource/component/group/RawResourceGroups.tsx +53 -0
  256. package/src/rawResource/controller/FiltersPubSub.ts +35 -0
  257. package/src/rawResource/index.ts +1 -0
  258. package/src/rawResource/model/resource.ts +18 -0
  259. package/src/rawResource/rawResource.dataSource.ts +39 -0
  260. package/src/rawResource/rawResource.module.ts +8 -0
  261. package/src/rawResource/rawResource.states.ts +64 -0
  262. package/src/resources/ResourceDetails.tsx +121 -0
  263. package/src/resources/resources.state.ts +45 -0
  264. package/src/rolloutStrategy/bluegreen.strategy.ts +7 -0
  265. package/src/rolloutStrategy/highlander.strategy.ts +7 -0
  266. package/src/rolloutStrategy/index.ts +6 -0
  267. package/src/rolloutStrategy/none.strategy.ts +8 -0
  268. package/src/rolloutStrategy/redblack.strategy.ts +7 -0
  269. package/src/securityGroup/details/details.controller.ts +118 -0
  270. package/src/securityGroup/details/details.html +91 -0
  271. package/src/securityGroup/index.ts +1 -0
  272. package/src/securityGroup/securityGroup.reader.ts +11 -0
  273. package/src/securityGroup/transformer.ts +19 -0
  274. package/src/serverGroup/details/details.controller.ts +207 -0
  275. package/src/serverGroup/details/details.html +153 -0
  276. package/src/serverGroup/details/resize/resize.controller.ts +73 -0
  277. package/src/serverGroup/details/resize/resize.html +57 -0
  278. package/src/serverGroup/index.ts +4 -0
  279. package/src/serverGroup/serverGroupCommandBuilder.service.ts +18 -0
  280. package/src/serverGroup/serverGroupTransformer.service.spec.ts +67 -0
  281. package/src/serverGroup/serverGroupTransformer.service.ts +34 -0
  282. package/src/serverGroupManager/details/details.controller.ts +191 -0
  283. package/src/serverGroupManager/details/details.html +136 -0
  284. package/src/serverGroupManager/index.ts +1 -0
  285. package/src/validation/applicationName.validator.spec.ts +19 -0
  286. package/src/validation/applicationName.validator.ts +44 -0
@@ -0,0 +1,68 @@
1
+ import { get } from 'lodash';
2
+ import React from 'react';
3
+
4
+ import { HoverablePopover } from '@spinnaker/core';
5
+
6
+ import './manifestLabels.less';
7
+
8
+ // TODO(dpeach) https://github.com/spinnaker/spinnaker/issues/3239
9
+ export interface IManifestQosProps {
10
+ manifest?: {
11
+ status?: {
12
+ qosClass?: string;
13
+ };
14
+ };
15
+ }
16
+
17
+ export class ManifestQos extends React.Component<IManifestQosProps> {
18
+ private qosClass(): string {
19
+ return get(this.props, ['manifest', 'status', 'qosClass'], 'Unknown');
20
+ }
21
+
22
+ private qosStyle(): string {
23
+ const qosClass = this.qosClass();
24
+ if (qosClass === 'Guaranteed') {
25
+ return 'success';
26
+ } else if (qosClass === 'BestEffort') {
27
+ return 'alert';
28
+ } else {
29
+ return 'warn';
30
+ }
31
+ }
32
+
33
+ private description = () => {
34
+ return (
35
+ <div>
36
+ <p>There are three QOS (Quality of Service) classes:</p>
37
+ <p>
38
+ <b>Guaranteed</b>: Pods are considered highest-priority, and will only be killed if they exceed their resource
39
+ requests when other containers require their resources.
40
+ </p>
41
+ <p>
42
+ <b>Burstable</b>: Pods have some minimum guaranteed resources and can exceed them, but are more likely to be
43
+ killed than <b>Guaranteed</b> pods.
44
+ </p>
45
+ <p>
46
+ <b>BestEffort</b>: These are the lowest-priority pods, and will be the first to be evicted when resources run
47
+ out.
48
+ </p>
49
+ <p>
50
+ To understand how to set the QOS class of a pod, read{' '}
51
+ <a href="https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/">
52
+ the Kubernetes documentation
53
+ </a>
54
+ .
55
+ </p>
56
+ </div>
57
+ );
58
+ };
59
+
60
+ public render() {
61
+ const style = `sp-badge ${this.qosStyle()}`;
62
+ return (
63
+ <HoverablePopover Component={this.description} title="QOS Class" className={`ephemeral-popover`}>
64
+ <div className={style}>{this.qosClass()}</div>
65
+ </HoverablePopover>
66
+ );
67
+ }
68
+ }
@@ -0,0 +1,69 @@
1
+ import { get } from 'lodash';
2
+ import React from 'react';
3
+
4
+ export interface IManifestResources {
5
+ cpu?: string;
6
+ memory?: string;
7
+ }
8
+
9
+ // TODO(dpeach) https://github.com/spinnaker/spinnaker/issues/3239
10
+ export interface IManifestResourceProps {
11
+ manifest?: {
12
+ spec?: {
13
+ containers?: [
14
+ {
15
+ name?: string;
16
+ resources?: {
17
+ limits?: IManifestResources;
18
+ requests?: IManifestResources;
19
+ };
20
+ },
21
+ ];
22
+ };
23
+ status?: {
24
+ qosClass?: string;
25
+ };
26
+ };
27
+ metrics?: [
28
+ {
29
+ containerName?: string;
30
+ metrics?: IPodMetricsMap;
31
+ },
32
+ ];
33
+ }
34
+
35
+ export interface IPodMetricsMap {
36
+ [key: string]: string;
37
+ }
38
+
39
+ export class ManifestResources extends React.Component<IManifestResourceProps> {
40
+ public render() {
41
+ const containers = get(this.props, ['manifest', 'spec', 'containers'], []);
42
+ const metrics = get(this.props, ['metrics'], []);
43
+
44
+ if (!metrics) {
45
+ return <div>No metrics reported.</div>;
46
+ }
47
+ const containerToMetricMap = metrics.reduce((acc, val) => {
48
+ acc[val.containerName] = { metrics: val.metrics };
49
+ return acc;
50
+ }, {});
51
+
52
+ return (
53
+ <div>
54
+ {containers.map((c, i) => (
55
+ <div key={c.name}>
56
+ Resource usage for <b>{c.name}</b>
57
+ <dl className="dl-horizontal dl-narrow">
58
+ <dt>CPU</dt>
59
+ <dd>{get(containerToMetricMap, [c.name, 'metrics', 'CPU(cores)'], 'Unknown')}</dd>
60
+ <dt>MEMORY</dt>
61
+ <dd>{get(containerToMetricMap, [c.name, 'metrics', 'MEMORY(bytes)'], 'Unknown')}</dd>
62
+ </dl>
63
+ {i < containers.length - 1 ? <hr /> : ''}
64
+ </div>
65
+ ))}
66
+ </div>
67
+ );
68
+ }
69
+ }
@@ -0,0 +1,4 @@
1
+ export enum ManifestSource {
2
+ TEXT = 'text',
3
+ ARTIFACT = 'artifact',
4
+ }
@@ -0,0 +1,114 @@
1
+ import type { IComponentOptions, IController, IInterpolateService, ISCEService } from 'angular';
2
+ import { module } from 'angular';
3
+ import DOMPurify from 'dompurify';
4
+ import { get, partition } from 'lodash';
5
+
6
+ interface IAnnotationsMap {
7
+ [key: string]: string;
8
+ }
9
+
10
+ interface ICustomSection {
11
+ title: string;
12
+ key: string;
13
+ isHtml: boolean;
14
+ content: string;
15
+ }
16
+
17
+ interface ICustomSectionMap {
18
+ [key: string]: ICustomSection[];
19
+ }
20
+
21
+ class KubernetesAnnotationCustomSections implements IController {
22
+ private resource: any;
23
+ public manifest: any;
24
+ public customSections: ICustomSectionMap;
25
+
26
+ public static $inject = ['$sce', '$interpolate'];
27
+ constructor(private $sce: ISCEService, private $interpolate: IInterpolateService) {}
28
+
29
+ public $onInit() {
30
+ const annotations: IAnnotationsMap = get(this, ['manifest', 'metadata', 'annotations']);
31
+ if (annotations == null) {
32
+ return;
33
+ }
34
+ this.populateCustomSections(annotations);
35
+ }
36
+
37
+ private populateCustomSections(annotations: IAnnotationsMap) {
38
+ const customSections: ICustomSectionMap = Object.keys(annotations).reduce(
39
+ (memo: ICustomSectionMap, annotationKey: string) => {
40
+ const entry = this.annotationToEntry(annotations[annotationKey], annotationKey);
41
+ if (entry != null && entry.title) {
42
+ memo[entry.title] = memo[entry.title] || [];
43
+ memo[entry.title].push(entry);
44
+ }
45
+ return memo;
46
+ },
47
+ {},
48
+ );
49
+ // Sort section contents such that text entries appear before HTML entries.
50
+ this.customSections = Object.keys(customSections).reduce((memo: ICustomSectionMap, sectionTitle: string) => {
51
+ const entriesHtmlText = partition(customSections[sectionTitle], (section) => section.isHtml);
52
+ memo[sectionTitle] = entriesHtmlText[1].concat(entriesHtmlText[0]);
53
+ return memo;
54
+ }, {});
55
+ }
56
+
57
+ private annotationToEntry(content: string, annotationKey: string): ICustomSection {
58
+ const parsed = this.parseAnnotationKey(annotationKey);
59
+ if (parsed == null) {
60
+ return null;
61
+ }
62
+ if (this.resource && content.includes('{{')) {
63
+ content = this.$interpolate(content)({ ...this.resource, manifest: this.manifest });
64
+ }
65
+ return {
66
+ title: parsed.title.replace(/-/g, ' ').trim(),
67
+ key: parsed.key.replace(/-/g, ' ').trim(),
68
+ content: parsed.isHtml ? this.sanitizeContent(content) : content,
69
+ isHtml: parsed.isHtml,
70
+ };
71
+ }
72
+
73
+ private parseAnnotationKey(annotationKey: string): { title: string; key: string; isHtml: boolean } {
74
+ const keyParts = /([^.]+)\.details\.(html\.)?spinnaker\.io(?:\/(.*))?/.exec(annotationKey);
75
+ if (keyParts == null || keyParts.length !== 4) {
76
+ return null;
77
+ }
78
+ return {
79
+ title: keyParts[1] || '',
80
+ key: keyParts[3] || '',
81
+ isHtml: !!keyParts[2],
82
+ };
83
+ }
84
+
85
+ private sanitizeContent(unsanitized: string): any {
86
+ const sanitized = DOMPurify.sanitize(unsanitized, {
87
+ ADD_ATTR: ['target'],
88
+ });
89
+ return this.$sce.trustAsHtml(sanitized);
90
+ }
91
+ }
92
+
93
+ const kubernetesAnnotationCustomSectionsComponent: IComponentOptions = {
94
+ bindings: { manifest: '<', resource: '<' },
95
+ controller: ['$sce', '$interpolate', KubernetesAnnotationCustomSections],
96
+ controllerAs: 'ctrl',
97
+ template: `
98
+ <collapsible-section expanded="true" ng-if="ctrl.manifest" ng-repeat="(section, entries) in ctrl.customSections" heading="{{ section }}">
99
+ <div ng-repeat="entry in entries">
100
+ <div ng-if="entry.isHtml" ng-bind-html="entry.content"></div>
101
+ <div ng-if="!entry.isHtml">
102
+ <span ng-if="entry.key" style="font-weight:bold">{{ entry.key }}</span>
103
+ <span>{{ entry.content }}</span>
104
+ </div>
105
+ </div>
106
+ </collapsible-section>
107
+ `,
108
+ };
109
+
110
+ export const KUBERNETES_ANNOTATION_CUSTOM_SECTIONS = 'spinnaker.kubernetes.v2.manifest.annotation.custom.sections';
111
+ module(KUBERNETES_ANNOTATION_CUSTOM_SECTIONS, []).component(
112
+ 'kubernetesAnnotationCustomSections',
113
+ kubernetesAnnotationCustomSectionsComponent,
114
+ );
@@ -0,0 +1,23 @@
1
+ import type { IComponentOptions, IController } from 'angular';
2
+ import { module } from 'angular';
3
+
4
+ import type { IArtifact } from '@spinnaker/core';
5
+
6
+ class KubernetesManifestArtifactCtrl implements IController {
7
+ public artifact: IArtifact;
8
+ }
9
+
10
+ const kubernetesManifestArtifactComponent: IComponentOptions = {
11
+ bindings: { artifact: '<' },
12
+ controller: KubernetesManifestArtifactCtrl,
13
+ controllerAs: 'ctrl',
14
+ template: `
15
+ <span>
16
+ <b>{{ctrl.artifact.type}}</b>
17
+ <i>{{ctrl.artifact.reference}}</i>
18
+ </span>
19
+ `,
20
+ };
21
+
22
+ export const KUBERNETES_MANIFEST_ARTIFACT = 'spinnaker.kubernetes.v2.manifest.artifact.component';
23
+ module(KUBERNETES_MANIFEST_ARTIFACT, []).component('kubernetesManifestArtifact', kubernetesManifestArtifactComponent);
@@ -0,0 +1,80 @@
1
+ import type { IController } from 'angular';
2
+ import { copy, module } from 'angular';
3
+ import type { IModalServiceInstance } from 'angular-ui-bootstrap';
4
+
5
+ import type { Application } from '@spinnaker/core';
6
+ import { ManifestWriter, TaskMonitor } from '@spinnaker/core';
7
+ import type { IManifestCoordinates } from '../IManifestCoordinates';
8
+ import { KUBERNETES_DELETE_MANIFEST_OPTIONS_FORM } from './deleteOptionsForm.component';
9
+
10
+ export interface IDeleteCommand {
11
+ manifestName: string;
12
+ location: string;
13
+ account: string;
14
+ reason: string;
15
+ options: IDeleteOptions;
16
+ }
17
+
18
+ export interface IDeleteOptions {
19
+ gracePeriodSeconds?: number;
20
+ cascading: boolean;
21
+ }
22
+
23
+ class KubernetesManifestDeleteController implements IController {
24
+ public taskMonitor: TaskMonitor;
25
+ public command: IDeleteCommand;
26
+ public verification = {
27
+ verified: false,
28
+ };
29
+
30
+ public static $inject = ['coordinates', '$uibModalInstance', 'application', 'manifestController'];
31
+ constructor(
32
+ coordinates: IManifestCoordinates,
33
+ private $uibModalInstance: IModalServiceInstance,
34
+ private application: Application,
35
+ public manifestController: string,
36
+ ) {
37
+ this.taskMonitor = new TaskMonitor({
38
+ title: `Deleting ${coordinates.name} in ${coordinates.namespace}`,
39
+ application,
40
+ modalInstance: $uibModalInstance,
41
+ });
42
+
43
+ this.command = {
44
+ manifestName: coordinates.name,
45
+ location: coordinates.namespace,
46
+ account: coordinates.account,
47
+ reason: null,
48
+ options: {
49
+ cascading: true,
50
+ },
51
+ };
52
+ }
53
+
54
+ public isValid(): boolean {
55
+ return this.verification.verified;
56
+ }
57
+
58
+ public cancel(): void {
59
+ this.$uibModalInstance.dismiss();
60
+ }
61
+
62
+ public delete(): void {
63
+ this.taskMonitor.submit(() => {
64
+ const payload = copy(this.command) as any;
65
+ payload.cloudProvider = 'kubernetes';
66
+ // cascading is the kubectl term (more familiar) orphanDependants is the k8s server term
67
+ payload.options.orphanDependants = !payload.options.cascading;
68
+ delete payload.options.cascading;
69
+
70
+ return ManifestWriter.deleteManifest(payload, this.application);
71
+ });
72
+ }
73
+ }
74
+
75
+ export const KUBERNETES_MANIFEST_DELETE_CTRL = 'spinnaker.kubernetes.v2.manifest.delete.controller';
76
+
77
+ module(KUBERNETES_MANIFEST_DELETE_CTRL, [KUBERNETES_DELETE_MANIFEST_OPTIONS_FORM]).controller(
78
+ 'kubernetesV2ManifestDeleteCtrl',
79
+ KubernetesManifestDeleteController,
80
+ );
@@ -0,0 +1,42 @@
1
+ <div modal-page class="confirmation-modal">
2
+ <task-monitor monitor="ctrl.taskMonitor"></task-monitor>
3
+ <form role="form" name="deleteForm">
4
+ <modal-close dismiss="$dismiss()"></modal-close>
5
+ <div class="modal-header">
6
+ <h4 class="modal-title">Delete {{ctrl.command.manifestName | robotToHuman}} in {{ctrl.command.location}}</h4>
7
+ </div>
8
+ <div ng-if="ctrl.manifestController">
9
+ <div class="alert alert-warning">
10
+ Manifest is controlled by
11
+ <a
12
+ ui-sref="^.serverGroupManager({
13
+ accountId: ctrl.command.account,
14
+ region: ctrl.command.location,
15
+ serverGroupManager: ctrl.manifestController,
16
+ provider: 'kubernetes'})"
17
+ >
18
+ {{ctrl.manifestController | robotToHuman }}
19
+ </a>
20
+ and may be recreated after deletion.
21
+ </div>
22
+ </div>
23
+ <div class="modal-body confirmation-modal">
24
+ <kubernetes-delete-manifest-options-form options="ctrl.command.options"></kubernetes-delete-manifest-options-form>
25
+ <task-reason command="ctrl.command"></task-reason>
26
+ </div>
27
+ <div class="modal-footer">
28
+ <user-verification account="ctrl.command.account" verification="ctrl.verification"></user-verification>
29
+ <button type="submit" ng-click="ctrl.delete()" style="display: none"></button>
30
+ <!-- Allows form submission via enter keypress-->
31
+ <button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button>
32
+ <button
33
+ type="submit"
34
+ class="btn btn-primary"
35
+ ng-click="ctrl.delete()"
36
+ ng-disabled="!ctrl.isValid() || !deleteForm.$valid"
37
+ >
38
+ Submit
39
+ </button>
40
+ </div>
41
+ </form>
42
+ </div>
@@ -0,0 +1,52 @@
1
+ import type { IComponentOptions, IController } from 'angular';
2
+ import { module } from 'angular';
3
+
4
+ import type { IDeleteOptions } from './delete.controller';
5
+
6
+ class KubernetesDeleteManifestOptionsFormCtrl implements IController {
7
+ public options: IDeleteOptions;
8
+ }
9
+
10
+ const kubernetesDeletManifestOptionsFormComponent: IComponentOptions = {
11
+ bindings: { options: '=' },
12
+ controller: KubernetesDeleteManifestOptionsFormCtrl,
13
+ controllerAs: 'ctrl',
14
+ template: `
15
+ <div class="form-horizontal">
16
+ <div class="form-group form-inline">
17
+ <div class="col-md-3 sm-label-right">
18
+ Cascading
19
+ <help-field key="kubernetes.manifest.delete.cascading"></help-field>
20
+ </div>
21
+ <div class="col-md-3">
22
+ <div class="input-group">
23
+ <input type="checkbox"
24
+ ng-model="ctrl.options.cascading"/>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <div class="form-group form-inline">
29
+ <div class="col-md-3 sm-label-right">
30
+ Grace Period
31
+ <help-field key="kubernetes.manifest.delete.gracePeriod"></help-field>
32
+ </div>
33
+ <div class="col-md-4">
34
+ <div class="input-group">
35
+ <input type="number"
36
+ class="form-control input-sm highlight-pristine"
37
+ ng-model="ctrl.options.gracePeriodSeconds"
38
+ min="0"/>
39
+ <span class="input-group-addon">second<span ng-if="ctrl.options.gracePeriodSeconds !== 1">s</span></span>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ `,
45
+ };
46
+
47
+ export const KUBERNETES_DELETE_MANIFEST_OPTIONS_FORM =
48
+ 'spinnaker.kubernetes.v2.kubernetes.manifest.delete.options.component';
49
+ module(KUBERNETES_DELETE_MANIFEST_OPTIONS_FORM, []).component(
50
+ 'kubernetesDeleteManifestOptionsForm',
51
+ kubernetesDeletManifestOptionsFormComponent,
52
+ );
@@ -0,0 +1,56 @@
1
+ import 'brace/mode/json';
2
+ import 'brace/theme/textmate';
3
+ import { $log } from 'ngimport';
4
+ import React from 'react';
5
+ import AceEditor from 'react-ace';
6
+
7
+ export interface IJsonEditorProps {
8
+ value: string;
9
+ onChange(raw: string, obj: any): void;
10
+ }
11
+
12
+ export const JSON_EDITOR_TAB_SIZE = 2;
13
+
14
+ export class JsonEditor extends React.Component<IJsonEditorProps> {
15
+ private handleChange = (raw: string) => {
16
+ try {
17
+ const obj = JSON.parse(raw);
18
+ this.props.onChange
19
+ ? this.props.onChange(raw, obj)
20
+ : $log.warn('No `onChange` handler provided for JSON editor.');
21
+ } catch (e) {
22
+ this.props.onChange
23
+ ? this.props.onChange(raw, null)
24
+ : $log.warn('No `onChange` handler provided for JSON editor.');
25
+ $log.warn(`Error loading JSON from string ${raw}: `, e);
26
+ }
27
+ };
28
+
29
+ public render = () => {
30
+ return (
31
+ <AceEditor
32
+ mode="json"
33
+ theme="textmate"
34
+ name="json-editor"
35
+ style={{ width: 'inherit' }}
36
+ onChange={this.handleChange}
37
+ fontSize={12}
38
+ showGutter={true}
39
+ cursorStart={0}
40
+ showPrintMargin={false}
41
+ minLines={50}
42
+ maxLines={100}
43
+ highlightActiveLine={true}
44
+ value={this.props.value || undefined}
45
+ setOptions={{
46
+ firstLineNumber: 1,
47
+ tabSize: JSON_EDITOR_TAB_SIZE,
48
+ showLineNumbers: false,
49
+ showFoldWidgets: false,
50
+ }}
51
+ editorProps={{ $blockScrolling: Infinity }}
52
+ className="ace-editor"
53
+ />
54
+ );
55
+ };
56
+ }
@@ -0,0 +1,12 @@
1
+ import { module } from 'angular';
2
+ import { react2angular } from 'react2angular';
3
+
4
+ import { withErrorBoundary } from '@spinnaker/core';
5
+
6
+ import { JsonEditor } from './JsonEditor';
7
+
8
+ export const JSON_EDITOR_COMPONENT = 'spinnaker.kubernetes.jsonEditor.component';
9
+ module(JSON_EDITOR_COMPONENT, []).component(
10
+ 'jsonEditor',
11
+ react2angular(withErrorBoundary(JsonEditor, 'jsonEditor'), ['onChange', 'value']),
12
+ );
@@ -0,0 +1,10 @@
1
+ export * from './manifest.service';
2
+ export * from './manifestCommandBuilder.service';
3
+ export * from './IManifestCoordinates';
4
+ export * from './artifact/artifact.component';
5
+ export * from './delete/delete.controller';
6
+ export * from './rollout/pause.controller';
7
+ export * from './rollout/undo.controller';
8
+ export * from './scale/scale.controller';
9
+ export * from './status/condition.component';
10
+ export * from './status/status.component';
@@ -0,0 +1,90 @@
1
+ import type { Application, IManifest } from '@spinnaker/core';
2
+ import { ManifestReader } from '@spinnaker/core';
3
+
4
+ export interface IStageManifest {
5
+ kind: string;
6
+ apiVersion: string;
7
+ metadata: {
8
+ namespace: string;
9
+ name: string;
10
+ };
11
+ }
12
+
13
+ export interface IManifestParams {
14
+ account: string;
15
+ location: string;
16
+ name: string;
17
+ }
18
+
19
+ export type IManifestCallback = (manifest: IManifest) => void;
20
+
21
+ export class KubernetesManifestService {
22
+ public static subscribe(app: Application, params: IManifestParams, fn: IManifestCallback): () => void {
23
+ KubernetesManifestService.updateManifest(params, fn);
24
+ return app.onRefresh(null, () => KubernetesManifestService.updateManifest(params, fn));
25
+ }
26
+
27
+ private static updateManifest(params: IManifestParams, fn: IManifestCallback) {
28
+ ManifestReader.getManifest(params.account, params.location, params.name).then((manifest) => fn(manifest));
29
+ }
30
+
31
+ public static manifestIdentifier(manifest: IStageManifest) {
32
+ const kind = manifest.kind.toLowerCase();
33
+ // manifest.metadata.namespace doesn't exist if it's a namespace being deployed
34
+ const namespace = (manifest.metadata.namespace || '_').toLowerCase();
35
+ const name = manifest.metadata.name.toLowerCase();
36
+ const apiVersion = (manifest.apiVersion || '_').toLowerCase();
37
+ // assuming this identifier is opaque and not parsed anywhere. Including the
38
+ // apiVersion will prevent collisions with CRD kinds without having any visible
39
+ // effect elsewhere
40
+ return `${namespace} ${kind} ${apiVersion} ${name}`;
41
+ }
42
+
43
+ public static stageManifestToManifestParams(manifest: IStageManifest, account: string): IManifestParams {
44
+ return {
45
+ account,
46
+ name: KubernetesManifestService.scopedKind(manifest) + ' ' + manifest.metadata.name,
47
+ location: manifest.metadata.namespace == null ? '_' : manifest.metadata.namespace,
48
+ };
49
+ }
50
+
51
+ private static apiGroup(manifest: IStageManifest): string {
52
+ const parts = (manifest.apiVersion || '_').split('/');
53
+ if (parts.length < 2) {
54
+ return '';
55
+ }
56
+ return parts[0];
57
+ }
58
+
59
+ private static isCRDGroup(manifest: IStageManifest): boolean {
60
+ return !KubernetesManifestService.BUILT_IN_GROUPS.includes(KubernetesManifestService.apiGroup(manifest));
61
+ }
62
+
63
+ private static scopedKind(manifest: IStageManifest): string {
64
+ if (KubernetesManifestService.isCRDGroup(manifest)) {
65
+ return manifest.kind + '.' + KubernetesManifestService.apiGroup(manifest);
66
+ }
67
+
68
+ return manifest.kind;
69
+ }
70
+
71
+ // from https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/
72
+ private static readonly BUILT_IN_GROUPS = [
73
+ '',
74
+ 'core',
75
+ 'batch',
76
+ 'apps',
77
+ 'extensions',
78
+ 'storage.k8s.io',
79
+ 'apiextensions.k8s.io',
80
+ 'apiregistration.k8s.io',
81
+ 'policy',
82
+ 'scheduling.k8s.io',
83
+ 'settings.k8s.io',
84
+ 'authorization.k8s.io',
85
+ 'authentication.k8s.io',
86
+ 'rbac.authorization.k8s.io',
87
+ 'certifcates.k8s.io',
88
+ 'networking.k8s.io',
89
+ ];
90
+ }