Skip to content

fix: Add get permission, required by create actions.#55

Closed
JoseSzycho wants to merge 1 commit intomainfrom
fix/searcher-role
Closed

fix: Add get permission, required by create actions.#55
JoseSzycho wants to merge 1 commit intomainfrom
fix/searcher-role

Conversation

@JoseSzycho
Copy link
Copy Markdown
Contributor

This PR solves an authorization issues, in which users cannot perform ResourceSearchQueries, as the k8s apiserver requires the user to also have get permission for the resource.

@scotwells
Copy link
Copy Markdown
Contributor

@JoseSzycho this is kinda surprising, do you have more information? I would expect only create be needed since this is done as a creation request.

@JoseSzycho
Copy link
Copy Markdown
Contributor Author

This is the command I'm using.

✗ kubectl --kubeconfig staffuser apply -f search_v1alpha1_searchquery.yaml --validate=fa
lse
Error from server (Forbidden): error when retrieving current configuration of:
Resource: "search.miloapis.com/v1alpha1, Resource=resourcesearchqueries", GroupVersionKind: "search.miloapis.com/v1alpha1, Kind=ResourceSearchQuery"
Name: "configmap-search-sample", Namespace: ""
from server for: "search_v1alpha1_searchquery.yaml": resourcesearchqueries.search.miloapis.com "configmap-search-sample" is forbidden: User "jszychowski+staf@datum.net" cannot get resource "resourcesearchqueries" in API group "search.miloapis.com" at the cluster scope

Seems that the APIServer is performing a get operation before the creation one.

As I've read, seems that kubectl performs that get operation in order to know if it should perform a POST or a PATCH operation.

@scotwells
Copy link
Copy Markdown
Contributor

scotwells commented Mar 4, 2026

@JoseSzycho the apply command will do a get and then update. You'll want to use the create command since it's a create-only resource.

Something we should track in the backlog is exporting a CLI like we have in the activity repo so the user can do datumctl search and access the search service.

@JoseSzycho
Copy link
Copy Markdown
Contributor Author

Nice, it works.

✗ kubectl --kubeconfig staffuser create -f search_v1alpha1_searchquery.yaml -o yaml --validate=false
apiVersion: search.miloapis.com/v1alpha1
kind: ResourceSearchQuery
metadata:
  name: configmap-search-sample
spec:
  limit: 20
  query: jose
  targetResources:
  - group: iam.miloapis.com
    kind: User
    version: v1alpha1
status:
  results:
  - relevanceScore: 0.8924
    resource:
      apiVersion: iam.miloapis.com/v1alpha1
      kind: User
      metadata:
        name: "362318285452092787"
      spec:
        email: joseszychowski@gmail.com
      uid: 14ae07bd-7652-4e25-a306-37c0cd4c2cab

Thanks!

@JoseSzycho JoseSzycho closed this Mar 4, 2026
auto-merge was automatically disabled March 4, 2026 21:06

Pull request was closed

@github-project-automation github-project-automation bot moved this from Backlog to Done in Searching Resources in Milo Mar 4, 2026
@JoseSzycho JoseSzycho deleted the fix/searcher-role branch March 5, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants