@rancher/shell 3.0.5-rc.2 → 3.0.5-rc.5

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 (289) hide show
  1. package/assets/data/aws-regions.json +2 -0
  2. package/assets/images/icons/document.svg +3 -0
  3. package/assets/images/vendor/cognito.svg +1 -0
  4. package/assets/styles/app.scss +1 -0
  5. package/assets/styles/base/_basic.scss +10 -0
  6. package/assets/styles/base/_spacing.scss +29 -0
  7. package/assets/styles/global/_layout.scss +1 -2
  8. package/assets/styles/themes/_dark.scss +25 -0
  9. package/assets/styles/themes/_light.scss +65 -0
  10. package/assets/translations/en-us.yaml +377 -37
  11. package/assets/translations/zh-hans.yaml +8 -15
  12. package/chart/monitoring/index.vue +1 -1
  13. package/components/AsyncButton.vue +2 -0
  14. package/components/Certificates.vue +5 -0
  15. package/components/CodeMirror.vue +3 -3
  16. package/components/CruResource.vue +103 -15
  17. package/components/ExplorerProjectsNamespaces.vue +7 -2
  18. package/components/FilterPanel.vue +156 -0
  19. package/components/FixedBanner.vue +19 -5
  20. package/components/{fleet/ForceDirectedTreeChart/index.vue → ForceDirectedTreeChart.vue} +47 -41
  21. package/components/IconOrSvg.vue +14 -35
  22. package/components/PaginatedResourceTable.vue +7 -0
  23. package/components/PromptRemove.vue +5 -1
  24. package/components/Resource/Detail/Card/PodsCard/Bubble.vue +13 -0
  25. package/components/Resource/Detail/Card/PodsCard/composable.ts +30 -0
  26. package/components/Resource/Detail/Card/PodsCard/index.vue +118 -0
  27. package/components/Resource/Detail/Card/ResourceUsageCard/composable.ts +51 -0
  28. package/components/Resource/Detail/Card/ResourceUsageCard/index.vue +79 -0
  29. package/components/Resource/Detail/Card/Scaler.vue +89 -0
  30. package/components/Resource/Detail/Card/StateCard/composables.ts +112 -0
  31. package/components/Resource/Detail/Card/StateCard/index.vue +39 -0
  32. package/components/Resource/Detail/Card/VerticalGap.vue +11 -0
  33. package/components/Resource/Detail/Card/__tests__/Card.test.ts +36 -0
  34. package/components/Resource/Detail/Card/__tests__/PodsCard.test.ts +84 -0
  35. package/components/Resource/Detail/Card/__tests__/ResourceUsageCard.test.ts +72 -0
  36. package/components/Resource/Detail/Card/__tests__/Scaler.test.ts +87 -0
  37. package/components/Resource/Detail/Card/__tests__/StateCard.test.ts +53 -0
  38. package/components/Resource/Detail/Card/__tests__/VerticalGap.test.ts +14 -0
  39. package/components/Resource/Detail/Card/__tests__/index.test.ts +36 -0
  40. package/components/Resource/Detail/Card/index.vue +56 -0
  41. package/components/Resource/Detail/Metadata/Annotations/__tests__/index.test.ts +19 -0
  42. package/components/Resource/Detail/Metadata/Annotations/composable.ts +12 -0
  43. package/components/Resource/Detail/Metadata/Annotations/index.vue +26 -0
  44. package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/index.test.ts +103 -0
  45. package/components/Resource/Detail/Metadata/IdentifyingInformation/composable.ts +281 -0
  46. package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +111 -0
  47. package/components/Resource/Detail/Metadata/KeyValue.vue +130 -0
  48. package/components/Resource/Detail/Metadata/Labels/__tests__/index.test.ts +18 -0
  49. package/components/Resource/Detail/Metadata/Labels/composable.ts +12 -0
  50. package/components/Resource/Detail/Metadata/Labels/index.vue +27 -0
  51. package/components/Resource/Detail/Metadata/Rectangle.vue +32 -0
  52. package/components/Resource/Detail/Metadata/__tests__/KeyValue.test.ts +107 -0
  53. package/components/Resource/Detail/Metadata/__tests__/Rectangle.test.ts +24 -0
  54. package/components/Resource/Detail/Metadata/__tests__/index.test.ts +91 -0
  55. package/components/Resource/Detail/Metadata/composables.ts +29 -0
  56. package/components/Resource/Detail/Metadata/index.vue +66 -0
  57. package/components/Resource/Detail/Page.vue +22 -0
  58. package/components/Resource/Detail/PercentageBar.vue +40 -0
  59. package/components/Resource/Detail/ResourceRow.vue +119 -0
  60. package/components/Resource/Detail/SpacedRow.vue +14 -0
  61. package/components/Resource/Detail/StatusBar.vue +59 -0
  62. package/components/Resource/Detail/StatusRow.vue +61 -0
  63. package/components/Resource/Detail/TitleBar/Title.vue +13 -0
  64. package/components/Resource/Detail/TitleBar/Top.vue +14 -0
  65. package/components/Resource/Detail/TitleBar/__tests__/Title.test.ts +17 -0
  66. package/components/Resource/Detail/TitleBar/__tests__/Top.test.ts +17 -0
  67. package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +142 -0
  68. package/components/Resource/Detail/TitleBar/composable.ts +31 -0
  69. package/components/Resource/Detail/TitleBar/index.vue +124 -0
  70. package/components/Resource/Detail/Top/index.vue +34 -0
  71. package/components/Resource/Detail/__tests__/Page.test.ts +32 -0
  72. package/components/ResourceDetail/Masthead.vue +0 -1
  73. package/components/ResourceDetail/__tests__/index.test.ts +114 -0
  74. package/components/ResourceDetail/index.vue +64 -562
  75. package/components/ResourceDetail/legacy.vue +545 -0
  76. package/components/ResourceList/index.vue +2 -1
  77. package/components/ResourceTable.vue +41 -7
  78. package/components/SlideInPanelManager.vue +77 -10
  79. package/components/SortableTable/index.vue +13 -2
  80. package/components/SortableTable/selection.js +22 -9
  81. package/components/StatusBadge.vue +6 -4
  82. package/components/SubtleLink.vue +25 -0
  83. package/components/Tabbed/index.vue +6 -0
  84. package/components/Wizard.vue +12 -1
  85. package/components/YamlEditor.vue +1 -1
  86. package/components/__tests__/AsyncButton.test.ts +39 -0
  87. package/components/__tests__/CruResource.test.ts +63 -0
  88. package/components/__tests__/FilterPanel.test.ts +81 -0
  89. package/components/__tests__/PromptModal.test.ts +0 -2
  90. package/components/auth/AuthBanner.vue +2 -3
  91. package/components/auth/RoleDetailEdit.vue +45 -3
  92. package/components/auth/login/oidc.vue +6 -1
  93. package/components/fleet/FleetApplications.vue +181 -0
  94. package/components/fleet/FleetHelmOps.vue +115 -0
  95. package/components/fleet/FleetIntro.vue +58 -28
  96. package/components/fleet/FleetNoWorkspaces.vue +5 -1
  97. package/components/fleet/FleetOCIStorageSecret.vue +171 -0
  98. package/components/fleet/FleetRepos.vue +38 -76
  99. package/components/fleet/FleetResources.vue +50 -22
  100. package/components/fleet/FleetSummary.vue +26 -51
  101. package/components/fleet/__tests__/FleetOCIStorageSecret.test.ts +213 -0
  102. package/components/fleet/__tests__/FleetSummary.test.ts +39 -39
  103. package/components/fleet/dashboard/Empty.vue +73 -0
  104. package/components/fleet/dashboard/ResourceCard.vue +183 -0
  105. package/components/fleet/dashboard/ResourceCardSummary.vue +199 -0
  106. package/components/fleet/dashboard/ResourceDetails.vue +196 -0
  107. package/components/fleet/dashboard/ResourcePanel.vue +376 -0
  108. package/components/form/ArrayList.vue +139 -117
  109. package/components/form/BannerSettings.vue +145 -96
  110. package/components/form/KeyValue.vue +10 -7
  111. package/components/form/LabeledSelect.vue +9 -2
  112. package/components/form/MatchExpressions.vue +5 -1
  113. package/components/form/NameNsDescription.vue +1 -1
  114. package/components/form/ResourceSelector.vue +26 -23
  115. package/components/form/ResourceTabs/index.vue +2 -1
  116. package/components/form/Select.vue +9 -2
  117. package/components/form/SimpleSecretSelector.vue +8 -2
  118. package/components/form/UnitInput.vue +13 -0
  119. package/components/form/ValueFromResource.vue +31 -19
  120. package/components/form/__tests__/ArrayList.test.ts +32 -0
  121. package/components/form/__tests__/KeyValue.test.ts +36 -0
  122. package/components/form/__tests__/LabeledSelect.test.ts +33 -0
  123. package/components/form/__tests__/Select.test.ts +34 -1
  124. package/components/form/__tests__/UnitInput.test.ts +23 -1
  125. package/components/formatter/ClusterLink.vue +5 -8
  126. package/components/formatter/Description.vue +30 -0
  127. package/components/formatter/FleetApplicationClustersReady.vue +77 -0
  128. package/components/formatter/FleetApplicationSource.vue +71 -0
  129. package/components/formatter/FleetSummaryGraph.vue +7 -0
  130. package/components/formatter/__tests__/ClusterLink.test.ts +2 -32
  131. package/components/nav/Header.vue +8 -7
  132. package/components/nav/NamespaceFilter.vue +1 -1
  133. package/components/nav/TopLevelMenu.helper.ts +55 -34
  134. package/components/nav/TopLevelMenu.vue +11 -0
  135. package/components/nav/Type.vue +4 -1
  136. package/components/nav/WindowManager/index.vue +1 -0
  137. package/composables/useI18n.ts +12 -11
  138. package/config/labels-annotations.js +14 -11
  139. package/config/product/auth.js +1 -0
  140. package/config/product/explorer.js +16 -13
  141. package/config/product/fleet.js +70 -17
  142. package/config/product/manager.js +1 -28
  143. package/config/query-params.js +3 -1
  144. package/config/roles.ts +1 -0
  145. package/config/router/routes.js +20 -2
  146. package/config/secret.ts +15 -0
  147. package/config/settings.ts +14 -15
  148. package/config/table-headers.js +59 -27
  149. package/config/types.js +2 -0
  150. package/core/plugin-helpers.ts +3 -2
  151. package/detail/catalog.cattle.io.app.vue +0 -1
  152. package/detail/fleet.cattle.io.cluster.vue +28 -15
  153. package/detail/fleet.cattle.io.gitrepo.vue +10 -1
  154. package/detail/fleet.cattle.io.helmop.vue +157 -0
  155. package/detail/provisioning.cattle.io.cluster.vue +13 -3
  156. package/detail/service.vue +0 -1
  157. package/detail/workload/index.vue +21 -34
  158. package/dialog/ExtensionCatalogUninstallDialog.vue +14 -8
  159. package/dialog/HelmOpForceUpdateDialog.vue +132 -0
  160. package/dialog/RedeployWorkloadDialog.vue +164 -0
  161. package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +56 -67
  162. package/edit/__tests__/service.test.ts +2 -1
  163. package/edit/auth/oidc.vue +159 -93
  164. package/edit/fleet.cattle.io.gitrepo.vue +26 -33
  165. package/edit/fleet.cattle.io.helmop.vue +997 -0
  166. package/edit/management.cattle.io.fleetworkspace.vue +43 -10
  167. package/edit/networking.k8s.io.networkpolicy/PolicyRule.vue +3 -14
  168. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +57 -62
  169. package/edit/networking.k8s.io.networkpolicy/PolicyRules.vue +3 -14
  170. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.test.ts +72 -41
  171. package/edit/networking.k8s.io.networkpolicy/__tests__/utils/mock.json +17 -1
  172. package/edit/networking.k8s.io.networkpolicy/index.vue +18 -30
  173. package/edit/provisioning.cattle.io.cluster/index.vue +21 -73
  174. package/edit/service.vue +13 -28
  175. package/list/fleet.cattle.io.gitrepo.vue +1 -1
  176. package/list/fleet.cattle.io.helmop.vue +108 -0
  177. package/list/namespace.vue +5 -2
  178. package/list/workload.vue +6 -1
  179. package/mixins/auth-config.js +8 -1
  180. package/mixins/preset.js +100 -0
  181. package/mixins/resource-fetch-api-pagination.js +57 -43
  182. package/mixins/resource-fetch.js +15 -6
  183. package/mixins/resource-table-watch.js +45 -0
  184. package/models/__tests__/chart.test.ts +273 -0
  185. package/models/__tests__/fleet.cattle.io.gitrepo.test.ts +1 -1
  186. package/models/__tests__/workload.test.ts +1 -0
  187. package/models/chart.js +144 -2
  188. package/models/cluster/node.js +1 -0
  189. package/models/cluster.js +32 -2
  190. package/models/fleet-application.js +385 -0
  191. package/models/fleet.cattle.io.bundle.js +9 -8
  192. package/models/fleet.cattle.io.gitrepo.js +41 -365
  193. package/models/fleet.cattle.io.helmop.js +228 -0
  194. package/models/management.cattle.io.authconfig.js +1 -0
  195. package/models/management.cattle.io.cluster.js +0 -20
  196. package/models/management.cattle.io.fleetworkspace.js +12 -0
  197. package/models/management.cattle.io.node.js +7 -22
  198. package/models/management.cattle.io.nodepool.js +12 -0
  199. package/models/namespace.js +5 -0
  200. package/models/provisioning.cattle.io.cluster.js +18 -64
  201. package/models/service.js +24 -9
  202. package/models/workload.js +84 -49
  203. package/package.json +2 -1
  204. package/pages/auth/verify.vue +13 -1
  205. package/pages/c/_cluster/apps/charts/AddRepoLink.vue +37 -0
  206. package/pages/c/_cluster/apps/charts/AppChartCardFooter.vue +80 -0
  207. package/pages/c/_cluster/apps/charts/AppChartCardSubHeader.vue +54 -0
  208. package/pages/c/_cluster/apps/charts/StatusLabel.vue +33 -0
  209. package/pages/c/_cluster/apps/charts/index.vue +302 -484
  210. package/pages/c/_cluster/apps/charts/install.vue +0 -1
  211. package/pages/c/_cluster/explorer/EventsTable.vue +1 -1
  212. package/pages/c/_cluster/explorer/index.vue +11 -0
  213. package/pages/c/_cluster/fleet/__tests__/index.test.ts +426 -0
  214. package/pages/c/_cluster/fleet/application/_resource/_id.vue +14 -0
  215. package/pages/c/_cluster/fleet/application/_resource/create.vue +14 -0
  216. package/pages/c/_cluster/fleet/application/create.vue +340 -0
  217. package/pages/c/_cluster/fleet/application/index.vue +139 -0
  218. package/pages/c/_cluster/fleet/graph/config.js +277 -0
  219. package/pages/c/_cluster/fleet/index.vue +772 -330
  220. package/pages/c/_cluster/longhorn/index.vue +2 -2
  221. package/pages/c/_cluster/settings/banners.vue +56 -2
  222. package/pages/c/_cluster/settings/performance.vue +7 -26
  223. package/pages/explorer/resource/detail/configmap.vue +19 -0
  224. package/pages/home.vue +11 -52
  225. package/plugins/clean-html.js +2 -0
  226. package/plugins/dashboard-store/__tests__/actions.test.ts +4 -1
  227. package/plugins/dashboard-store/actions.js +153 -30
  228. package/plugins/dashboard-store/getters.js +108 -24
  229. package/plugins/dashboard-store/mutations.js +61 -12
  230. package/plugins/dashboard-store/resource-class.js +36 -4
  231. package/plugins/steve/__tests__/getters.test.ts +18 -11
  232. package/plugins/steve/__tests__/steve-class.test.ts +1 -0
  233. package/plugins/steve/__tests__/subscribe.spec.ts +66 -1
  234. package/plugins/steve/actions.js +37 -12
  235. package/plugins/steve/getters.js +39 -10
  236. package/plugins/steve/steve-class.js +5 -0
  237. package/plugins/steve/steve-pagination-utils.ts +213 -50
  238. package/plugins/steve/subscribe.js +229 -42
  239. package/plugins/steve/worker/web-worker.advanced.js +3 -1
  240. package/rancher-components/BadgeState/BadgeState.vue +3 -1
  241. package/rancher-components/Banner/Banner.test.ts +51 -3
  242. package/rancher-components/Banner/Banner.vue +28 -6
  243. package/rancher-components/Form/Checkbox/Checkbox.vue +2 -2
  244. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +5 -1
  245. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +21 -1
  246. package/rancher-components/RcItemCard/RcItemCard.test.ts +189 -0
  247. package/rancher-components/RcItemCard/RcItemCard.vue +425 -0
  248. package/rancher-components/RcItemCard/RcItemCardAction.vue +24 -0
  249. package/rancher-components/RcItemCard/index.ts +2 -0
  250. package/store/auth.js +1 -0
  251. package/store/catalog.js +62 -24
  252. package/store/features.js +0 -1
  253. package/store/index.js +33 -14
  254. package/store/slideInPanel.ts +6 -0
  255. package/store/type-map.js +1 -0
  256. package/store/type-map.utils.ts +45 -2
  257. package/types/fleet.d.ts +36 -1
  258. package/types/kube/kube-api.ts +22 -0
  259. package/types/resources/settings.d.ts +19 -5
  260. package/types/shell/index.d.ts +595 -471
  261. package/types/store/dashboard-store.types.ts +41 -4
  262. package/types/store/pagination.types.ts +25 -3
  263. package/types/store/subscribe.types.ts +50 -0
  264. package/utils/auth.js +32 -3
  265. package/utils/cluster.js +24 -20
  266. package/utils/fleet-types.ts +0 -0
  267. package/utils/fleet.ts +200 -1
  268. package/utils/grafana.js +1 -0
  269. package/utils/object.js +0 -12
  270. package/utils/pagination-utils.ts +32 -3
  271. package/utils/pagination-wrapper.ts +132 -50
  272. package/utils/perf-setting.utils.ts +28 -0
  273. package/utils/selector-typed.ts +205 -0
  274. package/utils/selector.js +29 -6
  275. package/utils/settings.ts +4 -1
  276. package/utils/style.ts +39 -0
  277. package/utils/uiplugins.ts +10 -6
  278. package/utils/v-sphere.ts +5 -1
  279. package/utils/validators/formRules/__tests__/index.test.ts +36 -3
  280. package/utils/validators/formRules/index.ts +10 -3
  281. package/utils/window.js +11 -7
  282. package/components/__tests__/ApplicationCard.test.ts +0 -27
  283. package/components/cards/ApplicationCard.vue +0 -145
  284. package/components/fleet/ForceDirectedTreeChart/chartIcons.js +0 -17
  285. package/components/formatter/RKETemplateName.vue +0 -37
  286. package/config/secret.js +0 -14
  287. package/dialog/SaveAsRKETemplateDialog.vue +0 -139
  288. package/pages/c/_cluster/fleet/GitRepoGraphConfig.js +0 -249
  289. /package/{components/form/SSHKnownHosts → dialog}/__tests__/KnownHostsEditDialog.test.ts +0 -0
@@ -0,0 +1,228 @@
1
+ import { parse } from '@shell/utils/url';
2
+ import { insertAt } from '@shell/utils/array';
3
+ import { set } from '@shell/utils/object';
4
+ import { SOURCE_TYPE } from '@shell/config/product/fleet';
5
+ import FleetUtils from '@shell/utils/fleet';
6
+ import { FLEET } from '@shell/config/types';
7
+ import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
8
+ import FleetApplication from '@shell/models/fleet-application';
9
+
10
+ export default class HelmOp extends FleetApplication {
11
+ applyDefaults() {
12
+ const spec = this.spec || {};
13
+ const meta = this.metadata || {};
14
+
15
+ meta.namespace = this.$rootGetters['workspace'];
16
+
17
+ spec.helm = spec.helm || {};
18
+
19
+ spec['correctDrift'] = { enabled: false };
20
+
21
+ set(this, 'spec', spec);
22
+ set(this, 'metadata', meta);
23
+ }
24
+
25
+ get _availableActions() {
26
+ const out = super._availableActions;
27
+
28
+ insertAt(out, 0, {
29
+ action: 'pause',
30
+ label: this.t('fleet.helmOp.actions.pause.label'),
31
+ icon: 'icon icon-pause',
32
+ bulkable: true,
33
+ enabled: !!this.links.update && !this.spec?.paused
34
+ });
35
+
36
+ insertAt(out, 1, {
37
+ action: 'unpause',
38
+ label: this.t('fleet.helmOp.actions.unpause.label'),
39
+ icon: 'icon icon-play',
40
+ bulkable: true,
41
+ enabled: !!this.links.update && this.spec?.paused === true
42
+ });
43
+
44
+ insertAt(out, 2, {
45
+ action: 'enablePollingAction',
46
+ label: this.t('fleet.helmOp.actions.enablePolling.label'),
47
+ icon: 'icon icon-endpoints_connected',
48
+ bulkable: true,
49
+ enabled: !!this.links.update && !!this.spec?.disablePolling
50
+ });
51
+
52
+ insertAt(out, 3, {
53
+ action: 'disablePollingAction',
54
+ label: this.t('fleet.helmOp.actions.disablePolling.label'),
55
+ icon: 'icon icon-endpoints_disconnected',
56
+ bulkable: true,
57
+ enabled: !!this.links.update && !this.spec?.disablePolling
58
+ });
59
+
60
+ insertAt(out, 4, {
61
+ action: 'forceUpdate',
62
+ label: this.t('fleet.helmOp.actions.forceUpdate.label'),
63
+ icon: 'icon icon-refresh',
64
+ bulkable: true,
65
+ bulkAction: 'forceUpdateBulk',
66
+ enabled: !!this.links.update
67
+ });
68
+
69
+ insertAt(out, 5, { divider: true });
70
+
71
+ return out;
72
+ }
73
+
74
+ forceUpdate(resources = [this]) {
75
+ this.$dispatch('promptModal', {
76
+ componentProps: { helmOps: resources },
77
+ component: 'HelmOpForceUpdateDialog'
78
+ });
79
+ }
80
+
81
+ forceUpdateBulk(resources) {
82
+ this.$dispatch('promptModal', {
83
+ componentProps: { helmOps: resources },
84
+ component: 'HelmOpForceUpdateDialog'
85
+ });
86
+ }
87
+
88
+ get dashboardIcon() {
89
+ return FleetUtils.dashboardIcons[FLEET.HELM_OP];
90
+ }
91
+
92
+ get resourceIcon() {
93
+ return FleetUtils.resourceIcons[FLEET.HELM_OP];
94
+ }
95
+
96
+ github(value) {
97
+ const url = (value || '');
98
+
99
+ const matchHttps = url.match(FleetUtils.GIT_HTTPS_REGEX);
100
+
101
+ if (matchHttps) {
102
+ return matchHttps[1];
103
+ }
104
+
105
+ const matchSSH = url.match(FleetUtils.GIT_SSH_REGEX);
106
+
107
+ if (matchSSH) {
108
+ return FleetUtils.parseSSHUrl(matchSSH[0]).repoPath;
109
+ }
110
+
111
+ return false;
112
+ }
113
+
114
+ repoDisplay(repo) {
115
+ if (!repo) {
116
+ return null;
117
+ }
118
+
119
+ const github = this.github(repo);
120
+
121
+ if (github) {
122
+ return github;
123
+ }
124
+
125
+ repo = repo.replace(/.git$/, '');
126
+ repo = repo.replace(/^https:\/\//, '');
127
+ repo = repo.replace(/^oci:\/\//, '');
128
+ repo = repo.replace(/\/+$/, '');
129
+
130
+ return repo;
131
+ }
132
+
133
+ /**
134
+ * Source type examples:
135
+ *
136
+ * tarball:
137
+ * chart: https://github.com/rancher/fleet-helm-charts/releases/download/fleet-0.12.1-beta.2/fleet-0.12.1-beta.2.tgz
138
+ * repo:
139
+ * repo: https://rancher.github.io/fleet-helm-charts/
140
+ * chart: fleet-agent
141
+ * version: 0.12.1-beta.2
142
+ * oci:
143
+ * chart: oci://ghcr.io/rancher/fleet-test-configmap-chart
144
+ * version: the-tag
145
+ */
146
+ get sourceType() {
147
+ if (this.spec.helm?.repo && this.spec.helm?.chart) {
148
+ return SOURCE_TYPE.REPO;
149
+ }
150
+
151
+ if (this.spec.helm?.chart?.startsWith('oci://')) {
152
+ return SOURCE_TYPE.OCI;
153
+ }
154
+
155
+ if (this.spec.helm?.chart) {
156
+ return SOURCE_TYPE.TARBALL;
157
+ }
158
+
159
+ return null;
160
+ }
161
+
162
+ get source() {
163
+ let value = '';
164
+
165
+ switch (this.sourceType) {
166
+ case SOURCE_TYPE.REPO:
167
+ value = this.spec.helm?.repo || '';
168
+ break;
169
+ case SOURCE_TYPE.OCI: {
170
+ const parsed = parse(this.spec.helm?.chart || '');
171
+
172
+ value = parsed?.host ? `oci://${ parsed?.host }` : '';
173
+ break;
174
+ }
175
+ case SOURCE_TYPE.TARBALL:
176
+ value = this.spec.helm?.chart || ''; // TODO ellipsis and tooltip
177
+ }
178
+
179
+ const matchHttps = value.match(FleetUtils.HTTP_REGEX);
180
+ const matchOCI = value.match(FleetUtils.OCI_REGEX);
181
+ const matchSSH = value.match(FleetUtils.GIT_SSH_REGEX);
182
+
183
+ if (matchSSH) {
184
+ const { sshUserAndHost, repoPath } = FleetUtils.parseSSHUrl(matchSSH[0]);
185
+
186
+ value = `https://${ sshUserAndHost.replace('git@', '') }/${ repoPath }`;
187
+ }
188
+
189
+ return {
190
+ value,
191
+ display: this.repoDisplay(value),
192
+ icon: 'icon icon-application',
193
+ showLink: matchHttps || matchSSH || matchOCI
194
+ };
195
+ }
196
+
197
+ get sourceSub() {
198
+ let chart = '';
199
+ const version = this.spec.helm.version || '';
200
+
201
+ switch (this.sourceType) {
202
+ case SOURCE_TYPE.REPO:
203
+ chart = this.spec.helm.chart || '';
204
+ break;
205
+ case SOURCE_TYPE.OCI: {
206
+ const parsed = parse(this.spec.helm.chart || '');
207
+
208
+ chart = parsed?.path ? parsed?.path.substring(1) : '';
209
+ break;
210
+ }
211
+ }
212
+
213
+ const value = chart && version ? chart.concat(':', version) : chart;
214
+
215
+ return {
216
+ value,
217
+ display: value,
218
+ };
219
+ }
220
+
221
+ get bundles() {
222
+ return this.$getters['matching'](FLEET.BUNDLE, { [FLEET_ANNOTATIONS.HELM_NAME]: this.name }, this.namespace);
223
+ }
224
+
225
+ get bundleDeployments() {
226
+ return this.$getters['matching'](FLEET.BUNDLE_DEPLOYMENT, { [FLEET_ANNOTATIONS.HELM_NAME]: this.name });
227
+ }
228
+ }
@@ -16,6 +16,7 @@ export const configType = {
16
16
  github: 'oauth',
17
17
  keycloakoidc: 'oidc',
18
18
  genericoidc: 'oidc',
19
+ cognito: 'oidc',
19
20
  };
20
21
 
21
22
  const imageOverrides = { keycloakoidc: 'keycloak', genericoidc: 'openid' };
@@ -106,10 +106,6 @@ export default class MgmtCluster extends SteveModel {
106
106
  return null;
107
107
  }
108
108
 
109
- get rkeTemplateVersion() {
110
- return this.spec?.clusterTemplateRevisionName;
111
- }
112
-
113
109
  get providerForEmberParam() {
114
110
  // Ember wants one word called provider to tell what component to show, but has much indirect mapping to figure out what it is.
115
111
  let provider;
@@ -136,14 +132,6 @@ export default class MgmtCluster extends SteveModel {
136
132
  }
137
133
 
138
134
  get emberEditPath() {
139
- let clusterTemplateRevision;
140
-
141
- // If the RKE1 cluster is created from an RKE template, we need
142
- // to get the template version to pass into the Ember UI for
143
- // the iFramed edit cluster form
144
- if (this.rkeTemplateVersion) {
145
- clusterTemplateRevision = this.rkeTemplateVersion;
146
- }
147
135
  const provider = this.providerForEmberParam;
148
136
 
149
137
  // Avoid passing falsy values as query parameters
@@ -153,10 +141,6 @@ export default class MgmtCluster extends SteveModel {
153
141
  qp['provider'] = provider;
154
142
  }
155
143
 
156
- if (clusterTemplateRevision) {
157
- qp['clusterTemplateRevision'] = clusterTemplateRevision;
158
- }
159
-
160
144
  // Copied out of https://github.com/rancher/ui/blob/20f56dc54c4fc09b5f911e533cb751c13609adaf/app/models/cluster.js#L844
161
145
  if ( provider === 'import' && isEmpty(this.eksConfig) && isEmpty(this.gkeConfig) ) {
162
146
  qp.importProvider = 'other';
@@ -168,10 +152,6 @@ export default class MgmtCluster extends SteveModel {
168
152
  qp.importProvider = KONTAINER_TO_DRIVER[provider];
169
153
  }
170
154
 
171
- if ( this.clusterTemplateRevisionId ) {
172
- qp.clusterTemplateRevision = this.clusterTemplateRevisionId;
173
- }
174
-
175
155
  const path = addParams(`/c/${ escape(this.id) }/edit`, qp);
176
156
 
177
157
  return path;
@@ -1,6 +1,7 @@
1
1
  import { COUNT, FLEET, NORMAN } from '@shell/config/types';
2
2
  import { filterBy } from '@shell/utils/array';
3
3
  import HybridModel from '@shell/plugins/steve/hybrid-class';
4
+ import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
4
5
 
5
6
  export default class Workspace extends HybridModel {
6
7
  get isLocal() {
@@ -41,6 +42,13 @@ export default class Workspace extends HybridModel {
41
42
  return forWorkspace;
42
43
  }
43
44
 
45
+ get helmOps() {
46
+ const all = this.$getters['all'](FLEET.HELM_OP);
47
+ const forWorkspace = filterBy(all, 'namespace', this.id);
48
+
49
+ return forWorkspace;
50
+ }
51
+
44
52
  get basicNorman() {
45
53
  if (this.id) {
46
54
  return this.$dispatch(`rancher/find`, { id: this.id, type: NORMAN.FLEET_WORKSPACES }, { root: true });
@@ -87,4 +95,8 @@ export default class Workspace extends HybridModel {
87
95
  get confirmRemove() {
88
96
  return true;
89
97
  }
98
+
99
+ get systemAnnotations() {
100
+ return [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_DEFAULT];
101
+ }
90
102
  }
@@ -4,37 +4,22 @@ import {
4
4
  } from '@shell/config/types';
5
5
  import { NAME as EXPLORER } from '@shell/config/product/explorer';
6
6
  import { listNodeRoles } from '@shell/models/cluster/node';
7
- import { insertAt } from '@shell/utils/array';
8
7
  import { downloadUrl } from '@shell/utils/download';
9
8
  import findLast from 'lodash/findLast';
10
9
  import HybridModel from '@shell/plugins/steve/hybrid-class';
11
10
  import { notOnlyOfRole } from '@shell/models/cluster.x-k8s.io.machine';
12
11
 
12
+ const RKE1_ALLOWED_ACTIONS = [
13
+ 'goToViewYaml',
14
+ 'download',
15
+ 'viewInApi'
16
+ ];
17
+
13
18
  export default class MgmtNode extends HybridModel {
14
19
  get _availableActions() {
15
20
  const out = super._availableActions;
16
21
 
17
- const downloadKeys = {
18
- action: 'downloadKeys',
19
- enabled: !!this.norman?.links?.nodeConfig,
20
- icon: 'icon icon-fw icon-download',
21
- label: this.t('node.actions.downloadNodeConfig'),
22
- };
23
-
24
- const scaleDown = {
25
- action: 'scaleDown',
26
- bulkAction: 'scaleDown',
27
- enabled: !!this.canScaleDown,
28
- icon: 'icon icon-minus icon-fw',
29
- label: this.t('node.actions.scaleDown'),
30
- bulkable: true,
31
- };
32
-
33
- insertAt(out, 0, { divider: true });
34
- insertAt(out, 0, downloadKeys);
35
- insertAt(out, 0, scaleDown);
36
-
37
- return out;
22
+ return out.filter((a) => a.divider || RKE1_ALLOWED_ACTIONS.includes(a.action));
38
23
  }
39
24
 
40
25
  get kubeNodeName() {
@@ -3,7 +3,19 @@ import { sortBy } from '@shell/utils/sort';
3
3
  import HybridModel from '@shell/plugins/steve/hybrid-class';
4
4
  import { notOnlyOfRole } from '@shell/models/cluster.x-k8s.io.machine';
5
5
 
6
+ const RKE1_ALLOWED_ACTIONS = [
7
+ 'goToViewYaml',
8
+ 'download',
9
+ 'viewInApi'
10
+ ];
11
+
6
12
  export default class MgmtNodePool extends HybridModel {
13
+ get _availableActions() {
14
+ const out = super._availableActions;
15
+
16
+ return out.filter((a) => a.divider || RKE1_ALLOWED_ACTIONS.includes(a.action));
17
+ }
18
+
7
19
  get nodeTemplateId() {
8
20
  return (this.spec?.nodeTemplateName || '').replace(/:/, '/');
9
21
  }
@@ -11,6 +11,11 @@ import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
11
11
  import { hasPSALabels, getPSATooltipsDescription, getPSALabels } from '@shell/utils/pod-security-admission';
12
12
  import { PSAIconsDisplay, PSALabelsNamespaceVersion } from '@shell/config/pod-security-admission';
13
13
 
14
+ /**
15
+ * obscure namespaces are reserved and have special meaning if they're also classed as `system`
16
+ *
17
+ * (by default hidden from user given by default `show dynamic namespaces` preference is disabled and `user namespaces` filter is on)
18
+ */
14
19
  const OBSCURE_NAMESPACE_PREFIX = [
15
20
  'c-', // cluster namespace
16
21
 
@@ -12,6 +12,14 @@ import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
12
12
  import { CAPI as CAPI_ANNOTATIONS, NODE_ARCHITECTURE } from '@shell/config/labels-annotations';
13
13
  import { KEV1 } from '@shell/models/management.cattle.io.kontainerdriver';
14
14
 
15
+ const RKE1_ALLOWED_ACTIONS = [
16
+ 'openShell',
17
+ 'downloadKubeConfig',
18
+ 'copyKubeConfig',
19
+ 'download',
20
+ 'viewInApi'
21
+ ];
22
+
15
23
  /**
16
24
  * Class representing Cluster resource.
17
25
  * @extends SteveModel
@@ -41,17 +49,6 @@ export default class ProvCluster extends SteveModel {
41
49
  },
42
50
  ].filter((x) => !!x.content);
43
51
 
44
- // RKE Template details
45
- const rkeTemplate = this.rkeTemplate;
46
-
47
- if (rkeTemplate) {
48
- out.push({
49
- label: this.t('cluster.detail.rkeTemplate'),
50
- formatter: 'RKETemplateName',
51
- content: rkeTemplate,
52
- });
53
- }
54
-
55
52
  if (!this.machineProvider) {
56
53
  out.splice(1, 1);
57
54
 
@@ -105,17 +102,6 @@ export default class ProvCluster extends SteveModel {
105
102
 
106
103
  const canSnapshot = ready && ((this.isRke2 && this.canUpdate) || (this.isRke1 && this.mgmt?.hasAction('backupEtcd')));
107
104
 
108
- const clusterTemplatesSchema = this.$getters['schemaFor']('management.cattle.io.clustertemplate');
109
- let canUpdateClusterTemplate = false;
110
-
111
- if (clusterTemplatesSchema && (clusterTemplatesSchema.resourceMethods?.includes('blocked-PUT') || clusterTemplatesSchema.resourceMethods?.includes('PUT'))) {
112
- canUpdateClusterTemplate = true;
113
- }
114
-
115
- const normanClusterSaveTemplateAction = !!this.normanCluster?.actions?.saveAsTemplate;
116
-
117
- const canSaveRKETemplate = this.isRke1 && this.mgmt?.status?.driver === 'rancherKubernetesEngine' && !this.mgmt?.spec?.clusterTemplateName && this.hasLink('update') && canUpdateClusterTemplate && normanClusterSaveTemplateAction;
118
-
119
105
  const actions = [
120
106
  // Note: Actions are not supported in the Steve API, so we check
121
107
  // available actions for RKE1 clusters, but not RKE2 clusters.
@@ -158,12 +144,7 @@ export default class ProvCluster extends SteveModel {
158
144
  action: 'rotateEncryptionKey',
159
145
  label: this.$rootGetters['i18n/t']('nav.rotateEncryptionKeys'),
160
146
  icon: 'icon icon-refresh',
161
- enabled: canEditRKE2cluster || (this.isRke1 && this.mgmt?.hasAction('rotateEncryptionKey') && ready)
162
- }, {
163
- action: 'saveAsRKETemplate',
164
- label: this.$rootGetters['i18n/t']('nav.saveAsRKETemplate'),
165
- icon: 'icon icon-folder',
166
- enabled: canSaveRKETemplate,
147
+ enabled: canEditRKE2cluster
167
148
  }, { divider: true }];
168
149
 
169
150
  // Harvester Cluster 1:1 Harvester Cloud Cred
@@ -190,6 +171,15 @@ export default class ProvCluster extends SteveModel {
190
171
  }
191
172
  }
192
173
 
174
+ // If RKE1, then remove most of the actions
175
+ if (this.isRke1) {
176
+ all.forEach((action) => {
177
+ if (!action.divider && !RKE1_ALLOWED_ACTIONS.includes(action.action)) {
178
+ action.enabled = false;
179
+ }
180
+ });
181
+ }
182
+
193
183
  // If we have a helper that wants to modify the available actions, let it do it
194
184
  if (this.customProvisionerHelper?.availableActions) {
195
185
  // Provider can either modify the provided list or return one of its own
@@ -813,13 +803,6 @@ export default class ProvCluster extends SteveModel {
813
803
  this.$dispatch('promptRestore', [resource]);
814
804
  }
815
805
 
816
- saveAsRKETemplate(cluster = this) {
817
- this.$dispatch('promptModal', {
818
- componentProps: { cluster },
819
- component: 'SaveAsRKETemplateDialog'
820
- });
821
- }
822
-
823
806
  rotateCertificates(cluster = this) {
824
807
  this.$dispatch('promptModal', {
825
808
  componentProps: { cluster },
@@ -861,40 +844,11 @@ export default class ProvCluster extends SteveModel {
861
844
 
862
845
  return {
863
846
  displayName: `${ template.spec?.displayName }/${ revision.spec?.displayName }`,
864
- upgrade: this.rkeTemplateUpgrade,
865
847
  template,
866
848
  revision,
867
849
  };
868
850
  }
869
851
 
870
- get rkeTemplateUpgrade() {
871
- if (!this.isRke1 || !this.mgmt) {
872
- // Not an RKE! cluster or no management cluster available
873
- return false;
874
- }
875
-
876
- if (!this.mgmt.spec?.clusterTemplateRevisionName) {
877
- // Cluster does not use an RKE template
878
- return false;
879
- }
880
-
881
- const clusterTemplateRevisionName = this.mgmt.spec.clusterTemplateRevisionName.replace(':', '/');
882
-
883
- // Get all of the template revisions for this template
884
- const revisions = this.$rootGetters['management/all'](MANAGEMENT.RKE_TEMPLATE_REVISION).filter((t) => t.spec.enabled && t.spec.clusterTemplateName === this.mgmt.spec.clusterTemplateName);
885
-
886
- if (revisions.length <= 1) {
887
- // Only one template revision
888
- return false;
889
- }
890
-
891
- revisions.sort((a, b) => {
892
- return parseInt(a.metadata.resourceVersion, 10) - parseInt(b.metadata.resourceVersion, 10);
893
- }).reverse();
894
-
895
- return revisions[0].id !== clusterTemplateRevisionName ? revisions[0].spec?.displayName : false;
896
- }
897
-
898
852
  get _stateObj() {
899
853
  if (!this.isRke2) {
900
854
  return this.mgmt?.stateObj || this.metadata?.state;
package/models/service.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import find from 'lodash/find';
2
2
  import { POD } from '@shell/config/types';
3
3
  import SteveModel from '@shell/plugins/steve/steve-class';
4
+ import { parse } from '@shell/utils/selector';
4
5
 
5
6
  // i18n-uses servicesPage.serviceTypes.clusterIp.*, servicesPage.serviceTypes.externalName.*, servicesPage.serviceTypes.headless.*
6
7
  // i18n-uses servicesPage.serviceTypes.loadBalancer.*, servicesPage.serviceTypes.nodePort.*
@@ -49,7 +50,7 @@ export const CLUSTERIP = (() => {
49
50
  return clusterIp.id;
50
51
  })();
51
52
 
52
- export default class extends SteveModel {
53
+ export default class Service extends SteveModel {
53
54
  get customValidationRules() {
54
55
  return [
55
56
  {
@@ -137,18 +138,32 @@ export default class extends SteveModel {
137
138
  }
138
139
 
139
140
  async fetchPods() {
140
- if (this.podRelationship) {
141
- // Used in conjunction with `matches/match/label selectors`. Requires https://github.com/rancher/dashboard/issues/10417 to fix
142
- await this.$dispatch('cluster/findMatching', {
143
- type: POD,
144
- selector: this.podRelationship.selector,
145
- namespace: this.namespace
146
- }, { root: true });
141
+ if (!this.podRelationship) {
142
+ // If empty or not present, the service is assumed to have an external process managing its endpoints
143
+ return [];
147
144
  }
145
+
146
+ return await this.$dispatch('findLabelSelector', {
147
+ type: POD,
148
+ matching: {
149
+ namespace: this.metadata.namespace,
150
+ labelSelector: { matchExpressions: parse(this.podRelationship?.selector) },
151
+ }
152
+ });
148
153
  }
149
154
 
155
+ /**
156
+ * This getter expects a superset of workload pods to have been fetched already
157
+ *
158
+ * It assumes fetchPods has been called and should be used instead of the response of fetchPods
159
+ * (findAll --> findLabelSelector world results won't trigger change detection)
160
+ */
150
161
  get pods() {
151
- return this.podRelationship ? this.$getters.matching( POD, this.podRelationship.selector, this.namespace ) : [];
162
+ if (this.podRelationship?.selector) {
163
+ return this.$getters['matchingLabelSelector'](POD, { matchExpressions: parse(this.podRelationship?.selector) }, this.metadata.namespace);
164
+ } else {
165
+ return [];
166
+ }
152
167
  }
153
168
 
154
169
  get serviceType() {