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

kubectl apply on a apps/v1beta2 Deployment renders as extensions/v1beta1 #59362

Closed
bacongobbler opened this issue Feb 5, 2018 · 3 comments
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@bacongobbler
Copy link

/kind bug

Running kubectl apply on a apps/v1beta2 deployment creates a deployment with apiVersion set to extensions/v1beta1, but the version in kubectl.kubernetes.io/last-applied-configuration is v1beta2. I'm not sure if the transformation is a bug or a feature. I expected the deployed resource to be of type apps/v1beta2, as requested.

Reproducing the error can be done on both v1.8 and v1.9 clusters, with the respective kubectl client version matching the cluster version.

$ cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: apps-bug
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: apps-bug
        image: nginx
EOF

deployment "apps-bug" created

$ kubectl get deployment apps-bug -o jsonpath="{.apiVersion}"
extensions/v1beta1

$ kubectl apply view-last-applied deployment apps-bug
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  annotations: {}
  name: apps-bug
  namespace: default
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: apps-bug

Environment:

  • Kubernetes version (use kubectl version): 1.8/1.9
  • Cloud provider or hardware configuration: minikube for local testing, but can be seen on other cloud providers
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. kind/bug Categorizes issue or PR as related to a bug. labels Feb 5, 2018
@bacongobbler
Copy link
Author

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 5, 2018
@nikhita
Copy link
Member

nikhita commented Feb 5, 2018

Dupe of #58895.

Copying @liggitt's reply from #58895:

kubectl get deployment without qualification gets the first version of deployments the server indicates it is capable of returning.

The deployment you created can be retrieved in any of the supported versions. To get a specific group or version, fully qualify your get request:

kubectl get deployment.apps …
kubectl get deployment.v1beta2.apps … 

@bacongobbler
Copy link
Author

thanks for pointing out the dupe! Couldn't find it when searching. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

3 participants