util.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. # Copyright 2016 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # This script contains the helper functions that each provider hosting
  16. # Kubernetes must implement to use cluster/kube-*.sh scripts.
  17. # Must ensure that the following ENV vars are set
  18. function detect-master {
  19. echo "KUBE_MASTER_IP: $KUBE_MASTER_IP" 1>&2
  20. echo "KUBE_MASTER: $KUBE_MASTER" 1>&2
  21. }
  22. # Get node names if they are not static.
  23. function detect-node-names {
  24. echo "NODE_NAMES: [${NODE_NAMES[*]}]" 1>&2
  25. }
  26. # Get node IP addresses and store in KUBE_NODE_IP_ADDRESSES[]
  27. function detect-nodes {
  28. echo "KUBE_NODE_IP_ADDRESSES: [${KUBE_NODE_IP_ADDRESSES[*]}]" 1>&2
  29. }
  30. # Verify prereqs on host machine
  31. function verify-prereqs {
  32. echo "Skeleton Provider: verify-prereqs not implemented" 1>&2
  33. }
  34. # Validate a kubernetes cluster
  35. function validate-cluster {
  36. # by default call the generic validate-cluster.sh script, customizable by
  37. # any cluster provider if this does not fit.
  38. "${KUBE_ROOT}/cluster/validate-cluster.sh"
  39. }
  40. # Instantiate a kubernetes cluster
  41. function kube-up {
  42. echo "Skeleton Provider: kube-up not implemented" 1>&2
  43. }
  44. # Delete a kubernetes cluster
  45. function kube-down {
  46. echo "Skeleton Provider: kube-down not implemented" 1>&2
  47. }
  48. # Update a kubernetes cluster
  49. function kube-push {
  50. echo "Skeleton Provider: kube-push not implemented" 1>&2
  51. }
  52. # Prepare update a kubernetes component
  53. function prepare-push {
  54. echo "Skeleton Provider: prepare-push not implemented" 1>&2
  55. }
  56. # Update a kubernetes master
  57. function push-master {
  58. echo "Skeleton Provider: push-master not implemented" 1>&2
  59. }
  60. # Update a kubernetes node
  61. function push-node {
  62. echo "Skeleton Provider: push-node not implemented" 1>&2
  63. }
  64. # Execute prior to running tests to build a release if required for env
  65. function test-build-release {
  66. echo "Skeleton Provider: test-build-release not implemented" 1>&2
  67. }
  68. # Execute prior to running tests to initialize required structure
  69. function test-setup {
  70. echo "Skeleton Provider: test-setup not implemented" 1>&2
  71. }
  72. # Execute after running tests to perform any required clean-up
  73. function test-teardown {
  74. echo "Skeleton Provider: test-teardown not implemented" 1>&2
  75. }
  76. function prepare-e2e {
  77. echo "Skeleton Provider: prepare-e2e not implemented" 1>&2
  78. }