manifests.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. Copyright 2017 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package proxy
  14. const (
  15. // KubeProxyConfigMap19 is the proxy ConfigMap manifest for Kubernetes 1.9 and above
  16. KubeProxyConfigMap19 = `
  17. kind: ConfigMap
  18. apiVersion: v1
  19. metadata:
  20. name: {{ .ProxyConfigMap }}
  21. namespace: kube-system
  22. labels:
  23. app: kube-proxy
  24. data:
  25. kubeconfig.conf: |-
  26. apiVersion: v1
  27. kind: Config
  28. clusters:
  29. - cluster:
  30. certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  31. server: {{ .ControlPlaneEndpoint }}
  32. name: default
  33. contexts:
  34. - context:
  35. cluster: default
  36. namespace: default
  37. user: default
  38. name: default
  39. current-context: default
  40. users:
  41. - name: default
  42. user:
  43. tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
  44. {{ .ProxyConfigMapKey }}: |-
  45. {{ .ProxyConfig}}
  46. `
  47. // KubeProxyDaemonSet19 is the proxy DaemonSet manifest for Kubernetes 1.9 and above
  48. KubeProxyDaemonSet19 = `
  49. apiVersion: apps/v1
  50. kind: DaemonSet
  51. metadata:
  52. labels:
  53. k8s-app: kube-proxy
  54. name: kube-proxy
  55. namespace: kube-system
  56. spec:
  57. selector:
  58. matchLabels:
  59. k8s-app: kube-proxy
  60. updateStrategy:
  61. type: RollingUpdate
  62. template:
  63. metadata:
  64. labels:
  65. k8s-app: kube-proxy
  66. spec:
  67. priorityClassName: system-node-critical
  68. containers:
  69. - name: kube-proxy
  70. image: {{ .Image }}
  71. imagePullPolicy: IfNotPresent
  72. command:
  73. - /usr/local/bin/kube-proxy
  74. - --config=/var/lib/kube-proxy/{{ .ProxyConfigMapKey }}
  75. - --hostname-override=$(NODE_NAME)
  76. securityContext:
  77. privileged: true
  78. volumeMounts:
  79. - mountPath: /var/lib/kube-proxy
  80. name: kube-proxy
  81. - mountPath: /run/xtables.lock
  82. name: xtables-lock
  83. readOnly: false
  84. - mountPath: /lib/modules
  85. name: lib-modules
  86. readOnly: true
  87. env:
  88. - name: NODE_NAME
  89. valueFrom:
  90. fieldRef:
  91. fieldPath: spec.nodeName
  92. hostNetwork: true
  93. serviceAccountName: kube-proxy
  94. volumes:
  95. - name: kube-proxy
  96. configMap:
  97. name: {{ .ProxyConfigMap }}
  98. - name: xtables-lock
  99. hostPath:
  100. path: /run/xtables.lock
  101. type: FileOrCreate
  102. - name: lib-modules
  103. hostPath:
  104. path: /lib/modules
  105. tolerations:
  106. - key: CriticalAddonsOnly
  107. operator: Exists
  108. - operator: Exists
  109. nodeSelector:
  110. kubernetes.io/os: linux
  111. `
  112. )