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

workload Select() function updates the selector, but not the toPodSelectorConfig function #2238

Open
sthomson-wyn opened this issue Nov 7, 2024 · 0 comments
Labels
bug Something isn't working needs-triage Priority and effort undetermined yet

Comments

@sthomson-wyn
Copy link

Description of the bug:

When updating the matchlabels for a workload (say, a deployment), updating the pod selector does not update the output of the toPodSelectorConfig function

Reproduction Steps:

Create a deployment, and update the selector labels:

deployment := cdk8splus31.NewDeployment(chart, &deploymentName, &cdk8splus31.DeploymentProps{
		Select:                       boolPtr(false),
...
})
deployment.Select(cdk8splus31.LabelSelector_Of(&cdk8splus31.LabelSelectorOptions{
		Labels: &selectorLabels,
	}))

Results in the correct matchLabels in my deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  selector:
    matchLabels:
      my-selectors: hello-world

However, when trying to use said deployment for a Service (or any other thing that uses an IPodSelector)

svc := cdk8splus31.NewService(chart, strPtr(*config.ServiceName+"-svc"), &cdk8splus31.ServiceProps{
  Selector: deployment,
})

Results in

apiVersion: v1
kind: Service
metadata:
  name: my-svc
spec:
  ports:
    - name: http
      port: 80
      protocol: TCP
  selector:
    cdk8s.io/metadata.addr: my-deployment-c8aaf3f2
  type: ClusterIP

Environment:

  • Framework Version: 2.198.254
  • OS: Ubuntu

Other:


This is 🐛 Bug Report

@sthomson-wyn sthomson-wyn added bug Something isn't working needs-triage Priority and effort undetermined yet labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Priority and effort undetermined yet
Projects
None yet
Development

No branches or pull requests

1 participant