mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
This commit is contained in:
@@ -28,17 +28,17 @@ import (
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// PodConfigNotificationMode describes how changes are sent to the update channel
|
||||
// PodConfigNotificationMode describes how changes are sent to the update channel.
|
||||
type PodConfigNotificationMode int
|
||||
|
||||
const (
|
||||
// PodConfigNotificationSnapshot delivers the full configuration as a SET whenever
|
||||
// any change occurs
|
||||
// any change occurs.
|
||||
PodConfigNotificationSnapshot = iota
|
||||
// PodConfigNotificationSetsAndUpdates delivers an UPDATE message whenever pods are
|
||||
// PodConfigNotificationSnapshotAndUpdates delivers an UPDATE message whenever pods are
|
||||
// changed, and a SET message if there are any additions or removals.
|
||||
PodConfigNotificationSnapshotAndUpdates
|
||||
// PodConfigNotificationIncremental delivers ADD, UPDATE, and REMOVE to the update channel
|
||||
// PodConfigNotificationIncremental delivers ADD, UPDATE, and REMOVE to the update channel.
|
||||
PodConfigNotificationIncremental
|
||||
)
|
||||
|
||||
@@ -267,7 +267,7 @@ func filterInvalidPods(pods []kubelet.Pod, source string) (filtered []*kubelet.P
|
||||
return
|
||||
}
|
||||
|
||||
// Sync sends a copy of the current state through the update channel
|
||||
// Sync sends a copy of the current state through the update channel.
|
||||
func (s *podStorage) Sync() {
|
||||
s.updateLock.Lock()
|
||||
defer s.updateLock.Unlock()
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Reads the pod configuration from etcd using the Kubernetes etcd schema
|
||||
// Reads the pod configuration from etcd using the Kubernetes etcd schema.
|
||||
package config
|
||||
|
||||
import (
|
||||
@@ -46,7 +46,7 @@ type SourceEtcd struct {
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
// NewSourceEtcd creates a config source that watches and pulls from a key in etcd
|
||||
// NewSourceEtcd creates a config source that watches and pulls from a key in etcd.
|
||||
func NewSourceEtcd(key string, client tools.EtcdClient, updates chan<- interface{}) *SourceEtcd {
|
||||
config := &SourceEtcd{
|
||||
key: key,
|
||||
@@ -60,7 +60,7 @@ func NewSourceEtcd(key string, client tools.EtcdClient, updates chan<- interface
|
||||
return config
|
||||
}
|
||||
|
||||
// run loops forever looking for changes to a key in etcd
|
||||
// run loops forever looking for changes to a key in etcd.
|
||||
func (s *SourceEtcd) run() {
|
||||
index := uint64(0)
|
||||
for {
|
||||
@@ -76,7 +76,7 @@ func (s *SourceEtcd) run() {
|
||||
}
|
||||
|
||||
// fetchNextState fetches the key (or waits for a change to a key) and then returns
|
||||
// the nextIndex to read. It will watch no longer than s.waitDuration and then return
|
||||
// the nextIndex to read. It will watch no longer than s.waitDuration and then return.
|
||||
func (s *SourceEtcd) fetchNextState(fromIndex uint64) (nextIndex uint64, err error) {
|
||||
var response *etcd.Response
|
||||
|
||||
@@ -142,5 +142,4 @@ func stopChannel(until time.Duration) chan bool {
|
||||
close(stop)
|
||||
}()
|
||||
return stop
|
||||
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Reads the pod configuration from file or a directory of files
|
||||
// Reads the pod configuration from file or a directory of files.
|
||||
package config
|
||||
|
||||
import (
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Reads the pod configuration from an HTTP GET response
|
||||
// Reads the pod configuration from an HTTP GET response.
|
||||
package config
|
||||
|
||||
import (
|
||||
|
@@ -45,7 +45,7 @@ type Server struct {
|
||||
mux *http.ServeMux
|
||||
}
|
||||
|
||||
// ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet
|
||||
// ListenAndServeKubeletServer initializes a server to respond to HTTP network requests on the Kubelet.
|
||||
func ListenAndServeKubeletServer(host HostInterface, updates chan<- interface{}, address string, port uint) {
|
||||
glog.Infof("Starting to listen on %s:%d", address, port)
|
||||
handler := NewServer(host, updates)
|
||||
@@ -70,7 +70,7 @@ type HostInterface interface {
|
||||
ServeLogs(w http.ResponseWriter, req *http.Request)
|
||||
}
|
||||
|
||||
// NewServer initializes and configures a kubelet.Server object to handle HTTP requests
|
||||
// NewServer initializes and configures a kubelet.Server object to handle HTTP requests.
|
||||
func NewServer(host HostInterface, updates chan<- interface{}) Server {
|
||||
server := Server{
|
||||
host: host,
|
||||
@@ -81,7 +81,7 @@ func NewServer(host HostInterface, updates chan<- interface{}) Server {
|
||||
return server
|
||||
}
|
||||
|
||||
// InstallDefaultHandlers registers the set of supported HTTP request patterns with the mux
|
||||
// InstallDefaultHandlers registers the set of supported HTTP request patterns with the mux.
|
||||
func (s *Server) InstallDefaultHandlers() {
|
||||
healthz.InstallHandler(s.mux)
|
||||
s.mux.HandleFunc("/container", s.handleContainer)
|
||||
@@ -93,12 +93,12 @@ func (s *Server) InstallDefaultHandlers() {
|
||||
s.mux.HandleFunc("/run/", s.handleRun)
|
||||
}
|
||||
|
||||
// error serializes an error object into an HTTP response
|
||||
// error serializes an error object into an HTTP response.
|
||||
func (s *Server) error(w http.ResponseWriter, err error) {
|
||||
http.Error(w, fmt.Sprintf("Internal Error: %v", err), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// handleContainer handles container requests against the Kubelet
|
||||
// handleContainer handles container requests against the Kubelet.
|
||||
func (s *Server) handleContainer(w http.ResponseWriter, req *http.Request) {
|
||||
defer req.Body.Close()
|
||||
data, err := ioutil.ReadAll(req.Body)
|
||||
@@ -119,7 +119,7 @@ func (s *Server) handleContainer(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
// handleContainers handles containers requests against the Kubelet
|
||||
// handleContainers handles containers requests against the Kubelet.
|
||||
func (s *Server) handleContainers(w http.ResponseWriter, req *http.Request) {
|
||||
defer req.Body.Close()
|
||||
data, err := ioutil.ReadAll(req.Body)
|
||||
@@ -142,7 +142,7 @@ func (s *Server) handleContainers(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
// handlePodInfo handles podInfo requests against the Kubelet
|
||||
// handlePodInfo handles podInfo requests against the Kubelet.
|
||||
func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
|
||||
u, err := url.ParseRequestURI(req.RequestURI)
|
||||
if err != nil {
|
||||
@@ -176,17 +176,17 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
// handleStats handles stats requests against the Kubelet
|
||||
// handleStats handles stats requests against the Kubelet.
|
||||
func (s *Server) handleStats(w http.ResponseWriter, req *http.Request) {
|
||||
s.serveStats(w, req)
|
||||
}
|
||||
|
||||
// handleLogs handles logs requests against the Kubelet
|
||||
// handleLogs handles logs requests against the Kubelet.
|
||||
func (s *Server) handleLogs(w http.ResponseWriter, req *http.Request) {
|
||||
s.host.ServeLogs(w, req)
|
||||
}
|
||||
|
||||
// handleSpec handles spec requests against the Kubelet
|
||||
// handleSpec handles spec requests against the Kubelet.
|
||||
func (s *Server) handleSpec(w http.ResponseWriter, req *http.Request) {
|
||||
info, err := s.host.GetMachineInfo()
|
||||
if err != nil {
|
||||
@@ -203,7 +203,7 @@ func (s *Server) handleSpec(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
// handleRun handles requests to run a command inside a container
|
||||
// handleRun handles requests to run a command inside a container.
|
||||
func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
|
||||
u, err := url.ParseRequestURI(req.RequestURI)
|
||||
if err != nil {
|
||||
@@ -228,7 +228,7 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
// ServeHTTP responds to HTTP requests on the Kubelet
|
||||
// ServeHTTP responds to HTTP requests on the Kubelet.
|
||||
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
defer httplog.NewLogged(req, &w).StacktraceWhen(
|
||||
httplog.StatusIsNot(
|
||||
@@ -239,7 +239,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
s.mux.ServeHTTP(w, req)
|
||||
}
|
||||
|
||||
// serveStats implements stats logic
|
||||
// serveStats implements stats logic.
|
||||
func (s *Server) serveStats(w http.ResponseWriter, req *http.Request) {
|
||||
// /stats/<podfullname>/<containerName>
|
||||
components := strings.Split(strings.TrimPrefix(path.Clean(req.URL.Path), "/"), "/")
|
||||
|
@@ -54,7 +54,7 @@ type PodUpdate struct {
|
||||
Op PodOperation
|
||||
}
|
||||
|
||||
//GetPodFullName returns a name that full identifies a pod across all config sources.
|
||||
// GetPodFullName returns a name that full identifies a pod across all config sources.
|
||||
func GetPodFullName(pod *Pod) string {
|
||||
return fmt.Sprintf("%s.%s", pod.Name, pod.Namespace)
|
||||
}
|
||||
|
Reference in New Issue
Block a user