Skip to content

Commit

Permalink
Update the function to include a default value for the selector field
Browse files Browse the repository at this point in the history
  • Loading branch information
djivey committed Jan 9, 2025
1 parent 7ea238d commit ea13fa5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/saltext/kubernetes/modules/kubernetesmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,10 @@ def __dict_to_deployment_spec(spec):
"""
Converts a dictionary into kubernetes V1DeploymentSpec instance.
"""
spec_obj = V1DeploymentSpec(template=spec.get("template", ""))
spec_obj = V1DeploymentSpec(
template=spec.get("template", ""),
selector=spec.get("selector", {"matchLabels": {"app": "default"}}),
)
for key, value in spec.items():
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)
Expand Down

0 comments on commit ea13fa5

Please sign in to comment.