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

Add field-level warnings for deprecated / known bad values #94626

Open
15 of 20 tasks
liggitt opened this issue Sep 8, 2020 · 27 comments
Open
15 of 20 tasks

Add field-level warnings for deprecated / known bad values #94626

liggitt opened this issue Sep 8, 2020 · 27 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@liggitt
Copy link
Member

liggitt commented Sep 8, 2020

See:

/assign
/sig api-machinery
/milestone v1.20
See:

/assign
/sig api-machinery
/milestone v1.20
See:

/assign
/sig api-machinery
/milestone v1.20

@liggitt liggitt added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 8, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Sep 8, 2020
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Sep 8, 2020
@liggitt liggitt added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Sep 8, 2020
@caesarxuchao
Copy link
Member

cc @deads2k

Do we have a KEP discussing how to emit the warnings?

@liggitt
Copy link
Member Author

liggitt commented Sep 8, 2020

@deads2k
Copy link
Contributor

deads2k commented Sep 9, 2020

The mechanism was put in place in 1.19. See https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1693-warnings

I'm thinking more about finding a way to make it easy to discover these. Are you thinking about placing the checks in validating admission or storage or somewhere else? Validating admissions seems like a reasonable place that could be mirrored for out of tree providers as well.

@deads2k
Copy link
Contributor

deads2k commented Sep 9, 2020

I think that deprecated fields could/should be labeled by tag in the API itself, similar to how we handle it for the structs themselves.

@liggitt
Copy link
Member Author

liggitt commented Sep 10, 2020

I think that deprecated fields could/should be labeled by tag in the API itself, similar to how we handle it for the structs themselves.

I'd be fine with that, though the immediate ones I want to warn about are specific selector label values and alpha seccomp annotations, so there's not really a place to attach declarative deprecations for those

@jsturtevant
Copy link
Contributor

Another area for warnings related to "pods setting both linux and windows options" is #93220

@liggitt
Copy link
Member Author

liggitt commented Sep 15, 2020

Another area for warnings related to "pods setting both linux and windows options" is #93220

is that always invalid? are multi-os images possible?

@jsturtevant
Copy link
Contributor

AppArmor is a linux only security module so it is not valid on windows.

I might have misunderstood the item. What is a multi-os image? It is possible to have multi-arch image manifests.

@liggitt
Copy link
Member Author

liggitt commented Sep 15, 2020

What is a multi-os image?

e.g. https://www.docker.com/blog/docker-official-images-now-multi-platform/

@jsturtevant
Copy link
Contributor

Thanks for confirming. Since it is possible to have multi-os image (multi-arch) I don't think that we would be able to effectively warn for pods that set both linux and windows options. In azure we use a mutli-os/multi arch image for the pause container: mcr.microsoft.com/oss/kubernetes/pause:1.4.0 which has a manifest for linux and windows:

docker manifest inspect --verbose mcr.microsoft.com/oss/kubernetes/pause:1.4.0 | jq '.[] .Descriptor.platform'   
{
  "architecture": "amd64",
  "os": "windows",
  "os.version": "10.0.17763.1282"
}
{
  "architecture": "amd64",
  "os": "windows",
  "os.version": "10.0.18362.900"
}
{
  "architecture": "amd64",
  "os": "windows",
  "os.version": "10.0.18363.900"
}
{
  "architecture": "amd64",
  "os": "windows",
  "os.version": "10.0.19041.329"
}
{
  "architecture": "amd64",
  "os": "linux"
}

@erismaster
Copy link

@saschagrunert should this issue be milestoned to v1.23? Basing this off of kubernetes/enhancements#135

@liggitt liggitt modified the milestones: v1.20, v1.21 Nov 18, 2020
@liggitt
Copy link
Member Author

liggitt commented Nov 18, 2020

next set of tasks expected to be done in 1.21

looks like 1.22

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 16, 2021
@desponda
Copy link

desponda commented Mar 4, 2021

Hello! 👋 This issue has not been updated for a long time, so I'd like to check what's the status. The code freeze is starting March 9th, 2021 (about 1 week from now). As the Issue is tagged for 1.21, is it still planned for this release?

@liggitt liggitt modified the milestones: v1.21, v1.22 Mar 4, 2021
@voigt
Copy link

voigt commented Jul 12, 2021

Hey there (@pacoxu, @liggitt), Bug-Triage here 👋 ,
As we already approached code freeze for 1.22 and this issue is frozen. I'd like to suggest moving this issue to 1.23 release. wdyt?

@pacoxu
Copy link
Member

pacoxu commented Jul 12, 2021

Agree.

@voigt
Copy link

voigt commented Oct 6, 2021

Hey there (@pacoxu, @liggitt), Bug-Triage here 👋 ,
There hasn't been any activity on this issue for a couple of months now. Just want to make sure this issue is still on track for the 1.23?

@jyotimahapatra
Copy link
Contributor

Since we're in 1.23 code freeze, I'm moving this to milestone 1.24. @liggitt Let me know if this is an error.

/milestone v1.24

@k8s-ci-robot k8s-ci-robot modified the milestones: v1.23, v1.24 Nov 17, 2021
@DiptoChakrabarty
Copy link
Member

Hi @pacoxu @liggitt Bug Triage for v1.24 here . I wanted to know if this issue is still targeting the 1.24 release. If yes could you update its priority field.

@dims
Copy link
Member

dims commented Mar 26, 2022

kick the can down the road

/milestone v1.25

@k8s-ci-robot k8s-ci-robot modified the milestones: v1.24, v1.25 Mar 26, 2022
@liggitt liggitt modified the milestones: v1.25, v1.26 Aug 15, 2022
@liggitt
Copy link
Member Author

liggitt commented Aug 15, 2022

updated description with work completed in 1.25

@pacoxu
Copy link
Member

pacoxu commented Oct 21, 2022

// imagePullSecrets with empty name (#99454#issuecomment-787838112)
for i, item := range podSpec.ImagePullSecrets {
if len(item.Name) == 0 {
warnings = append(warnings, fmt.Sprintf("%s: invalid empty name %q", fieldPath.Child("spec", "imagePullSecrets").Index(i).Child("name"), item.Name))
}
}

[root@paco ~]# cat po-secret.yaml
apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mypod
    image: redis
    volumeMounts:
    - name: foo
      mountPath: "/etc/foo"
      readOnly: true
  volumes:
  - name: foo
    secret:
      secretName: ""
      optional: false # default setting; "mysecret" must exist
[root@paco ~]# kubectl create -f po-secret.yaml
The Pod "mypod" is invalid:
* spec.volumes[0].secret.secretName: Required value
* spec.containers[0].volumeMounts[0].name: Not found: "foo"

As the Pod spec.volumes[0].secret.secretName is required value. This is also not a problem

  • volume source entries with empty secret or configmap name

@pacoxu
Copy link
Member

pacoxu commented Oct 21, 2022

I opened 2 PR to add bad values warnings.

@pacoxu
Copy link
Member

pacoxu commented Jun 8, 2023

#118547 will add a warn for env dup.

@pacoxu
Copy link
Member

pacoxu commented Jun 16, 2023

#72593 (comment) is another case that we may warn user or refuse it during creation.

A proposal would be adding a warning for pod creation with sysctl that would most likely be rejected by kubelet.

@LucasViniciusp
Copy link

LucasViniciusp commented Jul 18, 2023

Another important case that should be addressed is when attempting to set a nodeName on the deployment spec.template.spec for NoExecute or NoSchedule tainted nodes.

#75913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
Status: Pending inclusion
Development

No branches or pull requests

16 participants