Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced selector settings for GitRepo get lost when editing #4788

Closed
gaktive opened this issue Dec 17, 2021 · 2 comments
Closed

Advanced selector settings for GitRepo get lost when editing #4788

gaktive opened this issue Dec 17, 2021 · 2 comments

Comments

@gaktive
Copy link
Member

gaktive commented Dec 17, 2021

Internal reference: SURE-3455

Issue description:
When editing an exiting advanced selector GitRepo on UI form and just save it without changes, it removes advanced settings and just set as clusterGroup.

Business impact:
No business impact.

Troubleshooting steps:
Reproducing the environment and performing tests with advanced selector GitRepo options.

Repro steps:

  • created an GitRepo with kubectl+yaml and/or through UI.
apiVersion: fleet.cattle.io/v1alpha1
{{ kind: GitRepo}}
{{ metadata:}}
  name: test5
  namespace: fleet-default
{{ spec:}}
  branch: labopensuse
  insecureSkipTLSVerify: false
  paths:/lab/fleet
  repo:https://github.com/path/to/k8s.git
  targets:

  - clusterGroup: sandbox
    clusterSelector:
      matchLabels:
        fleet-managed: "true"
{{        name: sandbox }}
  • edited as UI form, did change anything, just save it. It removes the clusterSelector and left clusterGroup only. When go to edit UI form, its loads the dropbox target selected as clusterGroup and not the advanced settings done previously.
  • outcome after saved it
targets:

  - clusterGroup: sandbox

Workaround:
Is workaround available and implemented? no
What is the workaround:

Actual behavior:
GitRepo edit form UI loads and filled target selector as clusterGroup.

Expected behavior:
GitRepo edit form UI loads the advanced selector settings accordingly as previously created.

@gaktive gaktive added this to the v2.6.4 milestone Dec 17, 2021
@richard-cox richard-cox self-assigned this Jan 6, 2022
richard-cox added a commit to richard-cox/dashboard that referenced this issue Jan 6, 2022
- `fleet.cattle.io.GitRepo` `spec.targets` can contain multiple selectors per target
  - https://fleet.rancher.io/gitrepo-targets/#target-matching
- UI handles this use case by an 'advanced' mode where user can enter free text (otherwise `target` can only contain a single selector type)
- When attempting to edit a GitRepo that has a multi-selector target now we now correctly identify it and start in 'advanced' mode
- Addresses rancher#4788
@davidnuzik davidnuzik self-assigned this Jan 26, 2022
@Jono-SUSE-Rancher Jono-SUSE-Rancher added the team/area3 Helm Yes! label Jan 28, 2022
@davidnuzik
Copy link

The issue doesn't mention what version the issue is reproduced with. I will try v2.6.3.

@davidnuzik
Copy link

My checks PASSED

Reproduction Environment:

Rancher version: v2.6.3
Rancher cluster type: single-node docker install
Docker version: 20.10

Downstream cluster type: n/a
Downstream K8s version: n/a

Reproduction steps:

  1. Navigate to Continous Delivery on the left nav pane. Create a GitRepo and do not fill any fields in, rather, click on the "Edit as YAML" button on the bottom of the page.
  2. Remove all content. Add this content:
apiVersion: fleet.cattle.io/v1alpha1
kind: GitRepo
metadata:
  name: test
  namespace: fleet-default
spec:
  branch: labopensuse
  insecureSkipTLSVerify: false
  paths: [/lab/fleet]
  repo: https://github.com/path/to/k8s.git
  targets:
  - clusterGroup: sandbox
    clusterSelector:
      matchLabels:
        fleet-managed: "true"
        name: sandbox
  1. Stay in the YAML editor and click the Create button. This will create the repo (it won't deploy but this is not relevant)

  2. Now, in the UI on the Git Repos page, click on the vertical "..." on the right and click "Edit YAML"
    image

  3. Notice - the content is the same and is correct. Our clusterSelector is still listed just as it was prior. Go back.

  4. Now, do the same but just chose "Edit Config" (so we get the UI form). On the bottom of the page click the "Edit as YAML" button so we get back in the YAML editor.

Result:
I reproduced. Upon step 6 of the steps above, I see the clusterSelector is missing now:
image


Validation Environment:

Rancher version: v2.6-head 7efbeab 1/31/2022
Rancher cluster type: single-node docker install
Docker version: 20.10

Downstream cluster type: n/a
Downstream K8s version: n/a

Validation steps:

  1. Execute the exact same steps as outlined above in the Reproduction section.

Result:
I now no longer reproduce and the issue appears to be fixed. Upon the last step (step 6 above) when I get to the YAML editor the clusterSelector is still listed and the YAML content is unchanged (except for the expected additional commented-out lines the UI adds -- this doesn't hurt anything). Below is a screenshot showing the fix:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants