@@ -3,7 +3,6 @@ package daemon
33import (
44 "bufio"
55 "context"
6- "crypto/tls"
76 "encoding/json"
87 "errors"
98 "fmt"
@@ -33,7 +32,6 @@ import (
3332 corev1 "k8s.io/api/core/v1"
3433 apierrors "k8s.io/apimachinery/pkg/api/errors"
3534 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
36- "k8s.io/apimachinery/pkg/labels"
3735 utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3836 "k8s.io/apimachinery/pkg/util/wait"
3937 coreinformersv1 "k8s.io/client-go/informers/core/v1"
@@ -157,8 +155,6 @@ type Daemon struct {
157155 // Used for Hypershift
158156 hypershiftConfigMap string
159157
160- initializeHealthServer bool
161-
162158 deferKubeletRestart bool
163159
164160 irreconcilableReporter IrreconcilableReporter
@@ -343,7 +339,6 @@ func New(
343339 return & Daemon {
344340 mock : mock ,
345341 booting : true ,
346- initializeHealthServer : true ,
347342 rebootQueued : false ,
348343 os : hostos ,
349344 NodeUpdaterClient : nodeUpdaterClient ,
@@ -911,52 +906,6 @@ func (dn *Daemon) syncNode(key string) error {
911906 }
912907 }
913908 klog .V (4 ).Infof ("Node %s is already synced" , node .Name )
914- if ! dn .booting && dn .initializeHealthServer {
915- // we want to wait until we are done booting AND we only want to do this once
916- // we also want to give ourselves a little extra buffer. The corner case here is sometimes we get thru the first sync, and then the errors
917- // begin ~1 minute later. So, list some api items until then. if we get to here, then we must be safe.
918- if err := wait .PollUntilContextTimeout (context .TODO (), 10 * time .Second , 1 * time .Minute , false , func (_ context.Context ) (bool , error ) {
919- _ , err := dn .ccLister .List (labels .Everything ())
920- if err != nil {
921- return false , err
922- }
923- return false , nil
924- }); err != nil {
925- if ! wait .Interrupted (err ) {
926- return fmt .Errorf ("could not list API items: %v" , err )
927- }
928- }
929- go func () {
930- klog .Infof ("Starting health listener on 127.0.0.1:8798" )
931- mux := http .NewServeMux ()
932- mux .Handle ("/health" , & healthHandler {})
933- s := http.Server {
934- TLSConfig : & tls.Config {
935- MinVersion : tls .VersionTLS12 ,
936- NextProtos : []string {"http/1.1" },
937- CipherSuites : cipherOrder (),
938- },
939- TLSNextProto : make (map [string ]func (* http.Server , * tls.Conn , http.Handler )),
940- Addr : "127.0.0.1:8798" ,
941- Handler : mux }
942-
943- go func () {
944- if err := s .ListenAndServe (); err != nil && err != http .ErrServerClosed {
945- klog .Errorf ("health listener exited with error: %v" , err )
946- }
947- }()
948- <- dn .stopCh
949- if err := s .Shutdown (context .Background ()); err != nil {
950- if err != http .ErrServerClosed {
951- klog .Errorf ("error stopping health listener: %v" , err )
952- }
953- } else {
954- klog .Infof ("health listener successfully stopped" )
955- }
956-
957- }()
958- dn .initializeHealthServer = false
959- }
960909 return nil
961910}
962911
@@ -2914,61 +2863,6 @@ func forceFileExists() bool {
29142863 return err == nil
29152864}
29162865
2917- type healthHandler struct {}
2918-
2919- func (h * healthHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
2920- w .Header ().Set ("Content-Length" , "0" )
2921- if r .Method == http .MethodGet || r .Method == http .MethodHead {
2922- w .WriteHeader (http .StatusOK )
2923- return
2924- }
2925-
2926- w .WriteHeader (http .StatusMethodNotAllowed )
2927- }
2928-
2929- // Disable insecure cipher suites for CVE-2016-2183
2930- // cipherOrder returns an ordered list of Ciphers that are considered secure
2931- // Deprecated ciphers are not returned.
2932- func cipherOrder () []uint16 {
2933- var first []uint16
2934- var second []uint16
2935-
2936- allowable := func (c * tls.CipherSuite ) bool {
2937- // Disallow block ciphers using straight SHA1
2938- // See: https://tools.ietf.org/html/rfc7540#appendix-A
2939- if strings .HasSuffix (c .Name , "CBC_SHA" ) {
2940- return false
2941- }
2942- // 3DES is considered insecure
2943- if strings .Contains (c .Name , "3DES" ) {
2944- return false
2945- }
2946- return true
2947- }
2948-
2949- for _ , c := range tls .CipherSuites () {
2950- for _ , v := range c .SupportedVersions {
2951- if v == tls .VersionTLS13 {
2952- first = append (first , c .ID )
2953- }
2954- if v == tls .VersionTLS12 && allowable (c ) {
2955- inFirst := false
2956- for _ , id := range first {
2957- if c .ID == id {
2958- inFirst = true
2959- break
2960- }
2961- }
2962- if ! inFirst {
2963- second = append (second , c .ID )
2964- }
2965- }
2966- }
2967- }
2968-
2969- return append (first , second ... )
2970- }
2971-
29722866type Deployment struct {
29732867 Booted bool `json:"booted"`
29742868 RequestedPackages []string `json:"requested-packages"`
0 commit comments