-
Notifications
You must be signed in to change notification settings - Fork 115
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
Deploying a Crossplane provider-sql PostgreSQL Role fails with "the server could not find the requested resource" #2865
Comments
One the problem here is that the The specific problem is, I think, that const pgSqlRole = new kube.yaml.ConfigGroup("keycloak-postgresql-role", {
yaml: `
apiVersion: postgresql.sql.crossplane.io/v1alpha1
kind: Role
metadata:
name: testrole
spec:
providerConfigRef:
name: in-cluster-postgresql
forProvider:
privileges:
createDb: false
login: true
writeConnectionSecretToRef:
name: test-secret
namespace: postgresql
`
}, {provider: kubeProvider}) Update: I was able to repro this issue by using the xplane Meanwhile, a possible workaround is to wrap the manifest into a local Helm chart and use the |
@EronWright your comment makes sense, I might try that later as well. Thanks for having a look! I forgot to write it in here, but I did what you suggested already: I've moved the entire application from pulumi to helm so that I could create this resouce. It's a bit of mixed feelings for me because I'm not super fan of helm, but it gets the job done for now at least until I can go back fully to Pulumi. |
I looked into this briefly, but it seems like we have a bug with how we're creating our dynamic client. The roles resource here is cluster scoped, however the k8s native Looking at the code where we generate our clients: pulumi-kubernetes/provider/pkg/clients/clients.go Lines 96 to 103 in 9595b1a
We determine whether we need to create a namespaced client or not. The logic we have to determine if a resource is namespaced or not is fairly simple, as we just do a check against a list of known kinds and not taking into account the GVK:
pulumi-kubernetes/provider/pkg/kinds/kinds.go Lines 191 to 197 in 9595b1a
This means that any custom resources with the same kind as any of the ones in that hard-coded list (eg. |
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md) for Pulumi's contribution guidelines. Help us merge your changes more quickly by adding more details such as labels, milestones, and reviewers.--> ### Proposed changes <!--Give us a brief description of what you've done and what it solves. --> This PR fixes a couple of related problems with "ambiguous kinds": 1. For kinds with clashing names (e.g. `Role`), be sure to check the apiversion before using built-in information or dynamic discovery. 2. For kinds with casing problems, don't mask the problem; show the API server error. Note that kubectl has the following behavior w.r.t (2): ```yaml apiVersion: awx.ansible.com/v1beta1 kind: awx metadata: name: my-awx namespace: awx ``` ``` ❯ kubectl apply -f manifest.yaml --server-side=false The awx "my-awx" is invalid: kind: Invalid value: "awx": must be AWX ❯ kubectl apply -f manifest.yaml --server-side=true Error from server (BadRequest): invalid object type: awx.ansible.com/v1beta1, Kind=awx ``` An explanation of the technical approach: the `kinds.Kind` type is used in the codebase to represent a well-known kind, i.e. known at code generation time. To prepare this PR, I audited the locations where `Kind` is used, and ensured that it wasn't being used for arbitrary kinds. Where necessary, the use of `Kind` was conditioned on the `apiVersion` being one of the well-known values. ### Related issues (optional) <!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes #1234'. Or link to full URLs to issues or pull requests in other GitHub repositories. --> Closes #2865 Closes #2143
What happened?
Trying to deploy a PostgreSQL Role with
ConfigGroup
fails with:The same problem happens with
ConfigFile
as well.Whereas deploying a
Database
from the same Crossplane provider works just fine.Example
Output of
pulumi about
Additional context
Trying to use
ConfigGroup
because I can't generate the typescript definitions due to pulumi/crd2pulumi#126.Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: