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

generate kube -s: targetPort: 0 is not valid #11930

Closed
dilyanpalauzov opened this issue Oct 12, 2021 · 3 comments · Fixed by #11982
Closed

generate kube -s: targetPort: 0 is not valid #11930

dilyanpalauzov opened this issue Oct 12, 2021 · 3 comments · Fixed by #11982
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@dilyanpalauzov
Copy link
Contributor

I run a container as described at https://mail.aegee.org/cgit/aegee-ldap/tree/readme.md#n13, then call podman generate kube -s busy_mclaren. The Service without the bind-annotation is:

apiVersion: v1
kind: Service
metadata:
  annotations:
    bind-mount-options:/home/d/data: Z
  creationTimestamp: "2021-10-12T06:04:20Z"
  labels:
    app: busymclaren
  name: busymclaren
spec:
  ports:
  - name: "3890"
    nodePort: 30831
    port: 3890
    protocol: TCP
    targetPort: 0
  selector:
    app: busymclaren
  type: NodePort
status:
  loadBalancer: {}

It says targetPort:0 , but according to https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/ the targetPort number must be between 1 and 65535.

I insert the file and kubernetes and then get it with `kubeclt describe it with

$ kubectl describe svc busymclaren 
Name:                     busymclaren
Namespace:                default
Labels:                   app=busymclaren
Annotations:              <none>
Selector:                 app=busymclaren
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.106.200.22
IPs:                      10.106.200.22
Port:                     3890  3890/TCP
TargetPort:               3890/TCP
NodePort:                 3890  30572/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

As can be seen, targetPort:0 from the input is ignored.

@rhatdan
Copy link
Member

rhatdan commented Oct 12, 2021

@baude looks like your new annotation does not work with Kubernetes. We should standardize this and see if CRI-O would accept it as well, and do the relabeling.

@baude
Copy link
Member

baude commented Oct 12, 2021

i suspect it is the space. @umohnani8 can you confirm?

@umohnani8
Copy link
Member

@baude, yes the annotations spacing is wrong in the generated kube yaml, it should look like:

apiVersion: v1
kind: Service
metadata:
  annotations:
    bind-mount-options: "/home/d/data:Z"
  creationTimestamp: "2021-10-12T06:04:20Z"
...

With that, I see the annotation being applied to the service correctly:

✗ oc describe svc busymclaren
Name:                     busymclaren
Namespace:                umohnani
Labels:                   app=busymclaren
Annotations:              bind-mount-options: /home/d/data:Z
Selector:                 app=busymclaren
Type:                     NodePort
IP:                       172.30.101.142
Port:                     3890  3890/TCP
TargetPort:               3890/TCP
NodePort:                 3890  30831/TCP

Although, this issue is talking about targetPort, will take a look at that.

@TomSweeneyRedHat TomSweeneyRedHat changed the title genetare kube -s: targetPort: 0 is not valid generate kube -s: targetPort: 0 is not valid Oct 12, 2021
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants