guestbook-ui.jsonnet 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. function (
  2. containerPort=80,
  3. image="gcr.io/heptio-images/ks-guestbook-demo:0.2",
  4. name="jsonnet-guestbook-ui",
  5. replicas=1,
  6. servicePort=80,
  7. type="LoadBalancer"
  8. )
  9. [
  10. {
  11. "apiVersion": "v1",
  12. "kind": "Service",
  13. "metadata": {
  14. "name": name
  15. },
  16. "spec": {
  17. "ports": [
  18. {
  19. "port": servicePort,
  20. "targetPort": containerPort
  21. }
  22. ],
  23. "selector": {
  24. "app": name
  25. },
  26. "type": type
  27. }
  28. },
  29. {
  30. "apiVersion": "apps/v1",
  31. "kind": "Deployment",
  32. "metadata": {
  33. "name": name
  34. },
  35. "spec": {
  36. "replicas": replicas,
  37. "revisionHistoryLimit": 3,
  38. "selector": {
  39. "matchLabels": {
  40. "app": name
  41. },
  42. },
  43. "template": {
  44. "metadata": {
  45. "labels": {
  46. "app": name
  47. }
  48. },
  49. "spec": {
  50. "containers": [
  51. {
  52. "image": image,
  53. "name": name,
  54. "ports": [
  55. {
  56. "containerPort": containerPort
  57. }
  58. ]
  59. }
  60. ]
  61. }
  62. }
  63. }
  64. }
  65. ]