Commit Graph

48 Commits

Author SHA1 Message Date
Evgeniya Vashkevich 89355f404e
[2.12] Added input validation to s3 endpoint field in cluster (#15187) 2025-09-04 17:26:03 -07:00
Richard Cox ffcc08147e Ensure we back-off resyncWatch on socket resource.error
- if resource.error bad revision is recieved we http to get a new one
- in HA world this can still result in a watch with resource.error bad revision (given a stale replica handles watch)
- to avoid a tight loop, back-off the http request
2025-08-14 09:57:16 +01:00
Nancy Butler be4bc0db53 enable diffUpstream spec in gke, aks; improve handling of empty objects/arrays in local cluster spec 2025-07-30 05:20:28 -07:00
Jordon Leach c51eb70e61
Add ability to configure commentFieldsOptions on resource model for createYaml (#10396)
* Add ability to configure commentFieldsOptions on resource model for createYaml

* Add commentFieldsOptions to createYamlWithOptions method

* Fix and extend commentFieldsOptions to cover array and object types

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* Fix typo

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

* Clean up addCommentSubFieldsOptions fn

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>

---------

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
Co-authored-by: Francesco Torchia <francesco.torchia@suse.com>
2025-07-11 09:19:49 -07:00
Evgeniya Vashkevich c72a94e51c
Added GCE support (#14694) 2025-07-09 16:34:29 -07:00
Giuseppe Leo e10f19e54d
Implement CRD logic for SCC registration online (#14615)
* Create registration composable

* Add logic to create registration CRD schema and fetch resource with WS

* Convert Registration list to single element

* Updating logic with real case data

* Update UX to display also invalid registrations; Add Types; Update displayed values for the registration

* Update registration values given new specifications: expiration, product name

* Map condition errors from registration to banner

* Code cleanup, removed duplications

* Abstract date and time formatting as it's app standard; convert file to TS

* Add unit test for time

* Prevent logic to register without code; Reset values with null

* Corrent async button bug which has default error

* Move tests to isolate composable and ensure quality

* Abstract initialization

* Add tests and correct found issues

* Add loading status

* Separate data fetching and mapping; Pool registration till hash is changed

* Correct async button callback

* Add missing registration value assignment after refactoring

* Fix asyncbutton wordings and colors not matching standards

* Fix tests: import and fake times

* Fix issue with timezone testing in CI

* Catch namespace creation issue
2025-07-03 17:13:21 +02:00
Francesco Torchia 8180c38d65
Merge pull request #14471 from torchiaf/13188-repo-paths
Fleet GitRepo Bundles and Paths refactoring
2025-06-20 17:51:06 +02:00
Francesco Torchia 3c089c1f94
Fleet add gitrepo paths unit tests
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2025-06-19 11:54:51 +02:00
Francesco Torchia 1f9f8c542d
Fleet fix targets - harvester rule handling; add unit tests
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2025-06-18 15:46:45 +02:00
Phillip Rak 22633ef3eb
Overwrite default chart values with user supplied values (#14200)
* Overwrite default chart values with user supplied values

Changes to merge behavior so that user supplied values overwrite default values when merging. The lodash merge operation merges object properties recursively, meaning that any keys in the left-most object will remain present. The customizer function works to overwrite any duplicate properties present in the user values.

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>

* Add ability to handle objects to `mergeWithReplaceArrays`

This renames `mergeWithReplaceArrays` to `mergeWithReplace` and adds functionality for working with objects. I'm opting to extend the existing util after I found that objects are not the only concern In reviewing prior work #14165 that dealt with arrays. Defaulting `replaceObjectProps` to `false` keeps the existing behavior in  place for other usages of `mergeWithReplace`, limiting the chance for regressions in rke2 yaml.

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>

* Unit test object merging behavior

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>

---------

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2025-04-29 10:15:40 -07:00
Francesco Torchia f3ce68a2f4
Restore resourceNames util for extensions compatibility (#13874)
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2025-03-27 11:17:51 +00:00
Giuseppe Leo b3babd5cf8
Generic OIDC group scope is not sent in the request formed by the UI (#13514)
* Add basic store auth tests for redirect

* Define mixin tests

* Correct tests to cover all the cases correctly and ensure that this function works as expected

* Add scopes to the redirectTo request when testing the model

* Add unit tests for action test

* Add comment to save auth config method

* Correct unit tests

* Correct test to avoid the same term to be used for different parts

* Correct key value from scope to scopes to match existing implementation

* Update tests to use scopesJoinChar

* Add further tests for merging default scopes and UI scopes

* Add joinStringList function

* Correct scopes merging issues
2025-02-26 10:49:48 +01:00
Francesco Torchia ef040e0d04
[unit-tests] Add resourceNames tests
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2025-02-25 11:20:01 +01:00
Mo Mesgin c4510f6cce use mergeWithReplaceArrays to merge array values on add-on yaml editor 2024-11-27 14:36:49 -08:00
Jordon Leach 75f26c4d7c
Replace cloneDeep with deepToRaw method - add nested reactive object case 2024-10-31 13:04:23 -04:00
Jordon Leach 627e385c43
Add check for function and symbol - add unit tests 2024-10-31 11:24:28 -04:00
Nancy 2e345eab4d
EKS: edit imported clusters, and clusters with exclusively self-managed nodes (#11294)
* sync upstream eks spec on edit

* allow for nil nodeGroups

fix networking subnet mode display

* split up syncUpstreamConfig test

* update subnets display for imported clusters and clusters that had been configured to create a vpc and subnet automatically

* fix ts in eks save function

* add syncUpstreamConfig to gke provisioning
2024-07-03 06:53:26 -07:00
Richard Cox e1bcb6ba64 Fix unit test 2024-06-07 14:43:19 +01:00
Richard Cox 542ebd4f40
Wire in pagination to LabeledSelect and use for pods, secrets and configmaps (#10786)
* Changes for new design
- New visuals
- Pagination controls --> load more
- finished testing of label select with pagination off

# Conflicts:
#	shell/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts

* Changes following review

* Update Node list to support server-side pagination
- Setup pagination headers for the node type
- Define a pattern for fetching custom list secondary resources
- Major improvements to the way pagination settings are defined and created
- Lots of docs improvements
- Handle calling fetch again once fetch is in progress (nuxt caches running request)
- Validate filter fields (not all are supported by the vai cache
- General pagination fixes

* Lint / test / fixes

* Improvements to configmap e2e test & Improve pagination disabled

* Beef up validation

* Fix missing name column in non-server-side paginated node list

* Fix PR automation actions
- fix syntax
- catch scenario where a pr has no fixed issue

> There's duplication between files, see https://github.com/rancher/dashboard/pull/10534

* CI bump

* Fixes post merge

* Wire in 2.9.0 settings for server-side pagination
- Everything is gated on `on-disk-steve-cache` feature flag
  - There's a backend in progress item to resolve a `revision` issue, until then disable watching a resource given it
- Global Settings - Performance
  - Added new setting to enable server side pagination
  - this is incompatible with two other performance settings

* Integrate pagination with configmaps in cis clusterscanbenchmark edit form
Also
- improved labeled select pagination
- gate label select pagination functinality on steve cache being enabled

* TODOs and TEST

* Paginate Secret selection for logging providers
- Allow `None` option in Paginationed LabelSelect
- Optionally classify pagination response

* WIP

* fixes arfter merge

* Don't suggest container names, not practical
- previously all pods were fetched... and we scrapped all container names from them
- this is a scaling nightmare, user now must just enter the name/s to match

* Avoid findAll secrets in SimpleSecretSelector

* tidying up

* Move LabeledSelect/index.vue back to LabeledSelect.vue to not break extensions

* changes after self review... 1

* changes after self review... 2

* changes after self review... 3

* Link new paginated label select with pagination setting

* Work around failing kubewarden unit tests in check-plugins gate

* Fix backup.spec e2e test

* Create a convienence wrapper called ResourceLabelSelector that hides most of the complexity

* fix unit test
2024-05-30 10:49:29 +01:00
Nancy 557d0280fb
EKS Provisioning (#10581)
* eks initial

* k8s options

* eks node group component

* add config and networking components

* fix default region on initial load

* use .sync modifier in network tab

* launch templates

* node group styling

* spot instances/launch template instance type

* fix selectcredential footer when not showing the rest of the form

* cluster name description and options

* iam listRoles

* subnets

* k8s version dropdown custom

* logging tab

* agent deployment customization, labels and annotations

* working default values

* fix edit eks/aks

* instance types dropdown improvements and spot instance type filtering

* validation;

localization

* todos

* tests

* move diffUpstreamSpec

* clean up

* improve launch template loading appearance

* fix kms key fetch

* fix custom role radio

* fix failing nodegroup test

* fix lint

* fix typescript errors in crueks

* nodegroup ts

* cache ec2 instance types

* cache instance types in vuex

* nodegroup ts

* ts errors in eks networking

* eks config ts errors

* tweak nodegroup input sizing

* reset nodegroup default values if the launch template is cleared

* add tooltips and userdata file upload button to node groups

* add networking tooltips; make credential dropdown half width when not showing credential form controls

* fix rancher managed launch template detection

* fix networking tooltip

* show when a node group has a rancher-managed launch template

* fix error filtering for ec2 iam roles

* add system labels and annotations for norman clusters

* lint

* lint

* fix labels and annotations getters in norman cluster model

* added tests for norman cluster system labels and annotations

* fix some eks typescript and hide cluster name when no credential

* fix userdata sublabel link

* fix networking info banner translation typo

* node group size labels and tags should be editable
2024-04-26 09:06:48 -07:00
Giuseppe Leo 793f7c6023
Initial migration of Vue3 for compatible fixes (#10858)
* Correct file naming and small TS issues

Correct TS related issues

* Manual replacement of :is on standard HTML tags

* Add missing required in the code dependencies

* Correct SCSS import

* Correct test file naming

* Correct typo in markup

* Use alias for types import
2024-04-23 20:16:46 +02:00
Phillip Rak 6c96a5bdce Default to unlimited line width when dumping yaml blocks
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-04-09 09:49:08 -07:00
Francesco Torchia 6525a5b069
Fix type errors in create-yaml.test.ts
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2024-04-09 12:20:18 +02:00
scures 27889b0dbf
feat: cluster abbreviation to 3 chars, shows customisation on cluster creation 2024-03-11 14:43:28 +01:00
Richard Cox b464d15ee0
Integrate new schemaDefinitions endpoint (#10141)
* resource edit AS yaml

* fix cruresource (yaml from form)
- lazy load the schemaDefinitions when needed, avoids sync all to createYaml before we have an async chance to fetch schemaDefinitions

* Fix questions
- there are only four places we use questions, none of which use schema, this is just to be safe

* cluster scan, plugins/fieldsForDriver, defaultFor, validationErrors

* pathExistsInSchema
- used to optionally show conditions tab/list in resource detail view
- logs of things in ingress list/edit

* createPopulated / defaultFor
defaultFor requires resourceFields, it's only used by createPopulated in one place to support machine configs without components

* wip

* WIP MONITORING.SPOOFED
- these aren't spoofed types, but secondary schemas
- testing fix blocked, primary schema's have resourceFields

* Move steve specific (resourceField) code to steve models
- create models for steve schemas and apply to cluster and management stores
- move resoureField based validationto steve model
- move pathExistsInSchema to steve store getter
- don't fetch schemaDefinitions on start up when saving prefs (not needed and blocking)

* comments / improvements

* (untested) refactoring

* Fix alertmanager definitions, add retry definition fetch

* Fix pathExistsInSchema for path length > 2

* Fix questions that accept schemas
- tested by adding Questions to random page and the node schema

* Fix to saving configmap part 1
- the save works but doesn't show data. the yaml is the same as before. debug info added

* Validation by resourceFields is a norman specific thing, so make it such

* small refactor

* Tidying up

* Remove rebase junk

* fix linting and unit tests

* fix unit tests

* fix linting from fix for test....

* Tidying up, fix alertmanagerconfig

* Remove unit test todos

* add unit tests for resource fields

* sdssdf

* Add unit tests for pathExistsInSchema

* JS --> TS

* Store schemas in local singleton cache to avoid hitting store

* fix minor changes from review

* cruresource changes following review
- improvement - remove spurious canDiff
- createResourceYaml - pass in resource to use instead of calc in code

* WIP changes to parseType

* Fix generic cloud credential and node driver forms

* handle missing reactivity given schema definitions not in store

* fix and add unit tests for `parseType`

* Fix create-yaml test

* Changes following review
- improved comments
- SchemaDefinitionCache is now per store (and is reset as such)
- typeRef now uses parseType

* Fix dep loop by moving route based helps in auth out to utils file

* fix unit tests

* Changes following review
2024-02-28 17:08:35 +00:00
Mo Mesgin e934c8bd55 check string type before creating blocks in dumpBlock 2024-02-07 10:59:28 -08:00
Phillip Rak a9d7d4bf4d Prevent mutating yaml when a header isn't found
This prevents `dumpBlock()` from mutating parsed yaml when a header can't be located. More investigation might be warranted to discover why the regex used by `getBlockHeader()` isn't matching the keys when parsing the example yaml:

```
 apiVersion: v1
data:
  a: "a\nb\tc"
  b: "a\nb\tc"
kind: ConfigMap
metadata:
  name: yaml-tab-test
```

but the crux of the issue still comes down to the fact that `dumpBlock()` will indiscriminately mutate yaml output when a key can't be located; it's important that this behavior is corrected.  

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2023-12-15 11:38:17 -07:00
Phillip Rak 2b482f8293 Add new unit test for `create-yaml` `dumpBlock()`
This unit test asserts that `dumpBlock()` can properly accept dump options for `jsyaml` and will output the expected string when long lines (over 80 characters) are present in a block.

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2023-12-12 10:58:42 -07:00
Richard Cox 48d0807181 Revert "App upgrade notification shown for incorrect app (#9806)"
This reverts commit eec4a46fdb.
2023-10-20 15:13:52 +01:00
Giuseppe Leo eec4a46fdb
App upgrade notification shown for incorrect app (#9806)
* Heavy code cleanup: move function to utils, config and types to their own file

* Add fallback and tests for version comparison not retrieving values

* Fix refactoring

* Add partial case of array filterBy

* Replace multiple functions handling the same case with single getter; add covering tests

* Add no parameter case to be correctly handled

* Add case with different chart values, e.g. Epinio issue case

* Prevent issues if retrieved version is undefined; Add unit tests for upgrade cases

* Filter out charts if lack parameters
2023-10-10 11:14:24 +02:00
momesgin 4892bb7c95
updated support link (#9870)
* updated support link

* revert mistakenly removed test

---------

Co-authored-by: Mo Mesgin <mmesgin@Mos-M2-MacBook-Pro.local>
2023-10-06 13:40:35 -07:00
Sean-McQ 86a448b0e5
now properly escaping key names prior to diffing objects (#9865) 2023-10-06 12:48:57 -06:00
Giuseppe Leo d2d6139496
Add test for version dev detection (#9848) 2023-10-04 19:42:53 +02:00
Richard Cox a70fe1b431
Merge pull request #9598 from richard-cox/fix-modified-resource
Fix resource modified handler
2023-09-27 17:36:49 +01:00
Sorin 67e6691934
fix: some scenarios with the smallIdentifier() (#9706)
* fix: some scenarios with the smallIdentifier()
* Minor refactor, add unit test
- Move bulk of smallIdentifier out to custom abbreviateClusterName
- Made `case 1` easier to read
- Added a bunch of unit tests
  - need to discuss some results

---------

Co-authored-by: Richard Cox <richard.cox@suse.com>
2023-09-15 11:06:44 +02:00
Richard Cox abaa2d0adc Add unit tests for sortBy 2023-09-06 15:41:56 +01:00
Evgeniya Vashkevich 97ec5827cd
Filtered out non-opaque secrets in backup/restore (#9449) 2023-08-31 12:24:31 -07:00
Richard Cox f9aa1f38bb Fix resource modified handler
- fixes issue in handleConflict that meant
  - conflicts were not detected
  - non-conflicting changes were not applied to users resource
- see #9597 issue description for more detail
2023-08-25 18:41:04 +01:00
momesgin d3302399f2
8657 - added unit tests for generateSupportLink (#9180)
* added unit tests for generateSupportLink

* added one more test case for generateSupportLink

* use it.each method to combine separate tests that are related

---------

Co-authored-by: Mo Mesgin <mmesgin@Mos-M2-MacBook-Pro.local>
2023-06-23 09:35:25 -07:00
Nancy a9276ea340
fix grafana url utility (#9019)
fix grafana url on monitoring index

recompute grafana dashboard iframe url if monitoring version changes
2023-06-01 11:07:47 -07:00
Francesco Torchia 12f2f1d290
[create-yaml] add unit tests
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-05-11 17:12:08 +02:00
Richard Cox cdc96df61d
Merge pull request #8347 from bashofmann/fix-grafana-url
Fix Grafana URLs in local cluster for new monitoring version
2023-04-18 10:44:01 +01:00
Giuseppe Leo da037a946e
Modify PSP deprecation warning message when upgrading a K3s custom cluster to v1.25 (#8464)
* Add decode utils for escaped HTML

* Allow to inject HTML in the markup as for i18n

* Correct wording and markup for PSP modal confirmation
2023-03-21 11:47:20 +01:00
Bastian Hofmann c7dfbe5c5d
Make grafana urls version dependent, so that they work correctly in the local cluster with old and new monitoring versions
Signed-off-by: Bastian Hofmann <mail@bastianhofmann.de>
2023-03-10 12:15:17 +01:00
Giuseppe Leo 8497f587d7
Add PSA custom resource in Cluster Manager (#7678)
* Add PSA resource model, edit, list, types, config, utils and navigation

* Remove controls sorting from config file in PSA form due unnecessary added logic

* Add missing type to exemptions

* Remove component specific grid alignment styling

* Add meaningful values on PSA form tests

* Add prefix for the namespace PSA form

* Correct PSA form test

* Revert RKE cluster erroneous changes

* Rename all the PSA form values to match specification and avoid issues

* Create function to convert array to dictionary

* Add types and replace function with utility in PSA form

* Trim exemptions values for PSA form

* Correct util test and function

* Enable YAML editor for PSA resource
2023-01-20 16:26:43 +01:00
Giuseppe Leo 3e31e9f138
Add support for Pod Security Admission in the Namespace resource (#7619)
* Create models, config and utils for PSA

* Create PSA tab form view

* Create custom labels for Namespace

* Add icon option for Namespace detail view

* Add icon for Namespace list

* Add PSA tab for Namespace edit view

* Add i18n for all the PSA parts

* Separate PSA labels between mode and versions

* Filter DetailTop Namespace labels from PSA versions

* Correct unit test

* Correct Namespace tooltips for details, to be created after fetching the resources

* Remove unnecessary model

* Add todo for PSA implementation

* Add TODO for tests with checkbox and select

* Correct namespace list link with model method

* Add TODO

* Move i18n key for PSA

* Align Namespace detail view chips icon to the top

* Restore labels and annotation to the Namespace view

* Merge LabelsPSA features to existing Labels component

* Move all the PSA logic from the view to the model

* Tweaks following review

DetailTop
- Remove PSA specific code from generic component

ResourceDetail
- Remove PSA specific code from generic component
- Remove plumbing for descriptions and icons from parent component to DetailTop

Labels&Annotations component
- Default `show system labels` to off
- Ensure size of `Labels` and `Annotations` titles are the same
- Improve padding
- Remove PSA specific code from generic component
- Removed un-needed margin-bottom

Project/Namespace List
- Improve padlock icon alignment
- Improve spacing around PSA list in tooltip (this will pop up often)

PodSecurtyAdmission settings component
- Improved alignment on PSA checkbox

General Improvements
- Always show Labels&Annotations on Namespace config (view) page

* Changes following testing
- Fix display of show/hide system labels when there are no system labels
- Ensure PSA order shown in project/namespaces list PSA tooltip matches PSA controls in Namespace edit/config page
- Remove two usages of lodash
  - pickBy --> new common pickBy
  - values --> Object.values

* Fix unit tests

Co-authored-by: Richard Cox <richard.cox@suse.com>
2023-01-06 16:01:40 +01:00
Giuseppe Leo d709dcc9db
Allow to generate new yarn.lock by reviewing version (#7009)
* Pin all the dependencies versions to current use and generate new yarn.lock

* Update mismatching package versions with lock

* Update and pin libraries for dependencies

* Correct test linting complains
2022-09-28 18:54:57 +02:00
Richard Cox 25acc1f8eb Plugins: Rejig files to new shell locations (#5623)
* Doc

* v0.7.0

* v0.7.1

* v0.7.2

* Add creators

* v0.1.14

* v0.1.17

* Add Yarn link

* Tidy ups and typos

* Allow models to be loaded from plugins

* v0.1.15

* v0.1.18

* v0.6.6

* Improve readme, fix cyperss log msg

* v0.1.17

* v0.1.19

* v0.6.7

* v0.6.8

* Fix logo ref when in shell

* Fix lint issues

* Fix error in example

* Fix script to work on linux

* Add ability to revert moves without losing changes

* Fix bug with custom models in a plugin

* Fix build of UI packages

* Add dist-pkg to .eslintignore

* Pull out util from extend-router to prevent router being pulled in UI packages

* Update PLUGINS.md

* Remove duplicate dependency

* Reduce size of built UI packages

* Share codemirror. Other tidy ups

* Further improvements

* Tidy ups to support i18n in plugins

* Clen up add comments

* More clean-ups and comments added

* Rename from extension to plugin

* Missed file in rename

* v0.6.9

* TIdy ups following rename

* v0.1.20

* v0.1.21

* More refactor and tidy up

* v0.1.22

* v0.1.18

* v0.1.19

* v0.1.23

* v0.6.10

* Version Packages. Improve naming. Unload.

* v0.6.11

* v0.1.20

* v0.1.21

* v0.1.24

* v0.6.12

* v0.1.25

* v0.1.22

* v0.6.13

* Fix issues when plugin is builtin

* Add missing files

* Fix lint issues and watcher ignores

* Fixes following review

* v0.1.28

* v0.1.31

* v0.6.20

* Fix coer.js version

* Fix bug where plugins included via npm don't work

* Changes post merge

* Move plugins doc to dev guide, add note at top of README

* Update cypress version

* Add note about the reset --hard in rejig -d

* Fixes post merge

* Rename @ranch to @rancher and ad plugins

* Improve routes support, add package assets support

* Add uninstall hooks and pass interal opts

* Fix rejig script

* Minor fixes

* Routing tweaks
- attempted to improve `addRoutes` typing, failed a lot
- improved typings in plugins.ts
- added "@pkg/*" entry and vue-shim (for importing components) to the pkg creator
- fixed some linting
- safely fail when Verdaccio isn't running
- fixed some typos

* Remove frontmatter-markdown-loader reference from nuxt-config

* Revert "Remove frontmatter-markdown-loader reference from nuxt-config"

This reverts commit 29ef6f2f7b.

* Exclude creators from dashboard build

* Revert "Exclude creators from dashboard build"

This reverts commit 8ede93ee7c.

* Ingore creators via tsconfig
- We're still susceptible with vue shims in multiple packages
- Need to determine why packages can't use shim from route
- Probably need to move `./vue-shim.d.ts` in to `./shell`. Needs testing with a pkg that imports a component

* After rejig

Co-authored-by: Neil MacDougall <nmacdougall@suse.com>
Co-authored-by: Neil MacDougall <nwmac@users.noreply.github.com>
2022-05-10 10:04:02 +01:00