Skip to content

Commit

Permalink
Add --root-ca-key code to Mesos' controller-manager fork
Browse files Browse the repository at this point in the history
  • Loading branch information
sttts committed Jul 7, 2015
1 parent 8a4a098 commit 39b3af0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion contrib/mesos/pkg/controllermanager/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package controllermanager

import (
"fmt"
"io/ioutil"
"net"
"net/http"
"strconv"
Expand Down Expand Up @@ -150,6 +152,20 @@ func (s *CMServer) Run(_ []string) error {
}
pvRecycler.Run()

var rootCA []byte

if s.RootCAFile != "" {
rootCA, err = ioutil.ReadFile(s.RootCAFile)
if err != nil {
return fmt.Errorf("error reading root-ca-file at %s: %v", s.RootCAFile, err)
}
if _, err := util.CertsFromPEM(rootCA); err != nil {
return fmt.Errorf("error parsing root-ca-file at %s: %v", s.RootCAFile, err)
}
} else {
rootCA = kubeconfig.CAData
}

if len(s.ServiceAccountKeyFile) > 0 {
privateKey, err := serviceaccount.ReadPrivateKey(s.ServiceAccountKeyFile)
if err != nil {
Expand All @@ -159,7 +175,7 @@ func (s *CMServer) Run(_ []string) error {
kubeClient,
serviceaccount.TokensControllerOptions{
TokenGenerator: serviceaccount.JWTTokenGenerator(privateKey),
RootCA: kubeconfig.CAData,
RootCA: rootCA,
},
).Run()
}
Expand Down

0 comments on commit 39b3af0

Please sign in to comment.