java
java copied to clipboard
Apply failed: Unexpected unknown resource type: class io.kubernetes.client.openapi.models.V1beta1PodSecurityPolicy
Hi, I commented this on another issue but thought I would create a new issue in case it is a part of a larger issue.
I am attempting to apply the calico-operator yaml using the 'kubernetes java client' and it is resulting in a similar exception being thrown.
"io.kubernetes.client.extended.kubectl.exception.KubectlException: Unexpected unknown resource type: class io.kubernetes.client.openapi.models.V1beta1PodSecurityPolicy"
I have done some testing and have narrowed the exception down to coming from line 4862 in the calico-operator.yaml for that PodSecurityPolicy.
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: tigera-operator
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*'
spec:
privileged: false
allowPrivilegeEscalation: false
requiredDropCapabilities:
- ALL
volumes:
- 'hostPath'
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
# Assume that persistentVolumes set up by the cluster admin are safe to use.
- 'persistentVolumeClaim'
hostNetwork: true
hostPorts:
- min: 0
max: 65535
hostIPC: false
hostPID: false
runAsUser:
rule: 'MustRunAsNonRoot'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
When I apply it through the command line with "kubectl apply -f <file.yaml>" it has no problem applying and throws no exception, but when applying it with the Kubernetes Java client I get that exception. Unfortunately, I cannot rely on using scripts to apply it through the command line and therefore need the java client working.
Are there any thoughts as to why this is happening, and what can be done to fix it?
I have attached the yaml I am trying to apply. You can also find it here:
https://raw.githubusercontent.com/aws/amazon-vpc-cni-k8s/master/config/master/calico-operator.yaml
Kubernetes Java Client Version 14.0.1
Kubernetes Java Client Extended Version 15.0.1
Kubernetes Version 1.2.1
AWS Java SDK 2.17.46
Java Version Java 8
Quick note: You say your Kubernetes version is 1.2.1 which is ancient I'm going to assume it's actually 1.21.x, but if it really is 1.2.1 that is way too old for this client to work correctly.
Assuming it is 1.21.x: For some reason that type isn't getting loaded in the static initializer. There's an extended discussion of some possible causes here: ~https://github.com/kubernetes-client/java/issues/2251~ #2241
You can manually initialize discovery via the call here: https://github.com/kubernetes-client/java/issues/2241#issuecomment-1119454112
Thanks @brendandburns, you are correct it is 1.21, I mistyped.
The first link you added is the issue number for this, I am assuming it was meant to go to another issue?
@Smith334 oops, that was meant to be #2241 apologies!
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied- After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied- After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closedYou can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.