guestbook-ui.jsonnet 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. local params = import 'params.libsonnet';
  2. [
  3. {
  4. "apiVersion": "v1",
  5. "kind": "Service",
  6. "metadata": {
  7. "name": params.name
  8. },
  9. "spec": {
  10. "ports": [
  11. {
  12. "port": params.servicePort,
  13. "targetPort": params.containerPort
  14. }
  15. ],
  16. "selector": {
  17. "app": params.name
  18. },
  19. "type": params.type
  20. }
  21. },
  22. {
  23. "apiVersion": "apps/v1",
  24. "kind": "Deployment",
  25. "metadata": {
  26. "name": params.name
  27. },
  28. "spec": {
  29. "replicas": params.replicas,
  30. "revisionHistoryLimit": 3,
  31. "selector": {
  32. "matchLabels": {
  33. "app": params.name
  34. },
  35. },
  36. "template": {
  37. "metadata": {
  38. "labels": {
  39. "app": params.name
  40. }
  41. },
  42. "spec": {
  43. "containers": [
  44. {
  45. "image": params.image,
  46. "name": params.name,
  47. "ports": [
  48. {
  49. "containerPort": params.containerPort
  50. }
  51. ]
  52. }
  53. ]
  54. }
  55. }
  56. }
  57. }
  58. ]