Skip to content

Commit

Permalink
Merge pull request #3165 from Lily922/dev
Browse files Browse the repository at this point in the history
update volcano.sh/apis version
  • Loading branch information
volcano-sh-bot authored Oct 30, 2023
2 parents 487a7f3 + bc58f9b commit c034a31
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 8 deletions.
8 changes: 8 additions & 0 deletions cmd/controller-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ type ServerOption struct {
KubeClientOptions kube.ClientOptions
CertFile string
KeyFile string
CaCertFile string
CertData []byte
KeyData []byte
CaCertData []byte
EnableLeaderElection bool
LockObjectNamespace string
PrintVersion bool
Expand Down Expand Up @@ -76,6 +78,7 @@ func NewServerOption() *ServerOption {
func (s *ServerOption) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.KubeClientOptions.Master, "master", s.KubeClientOptions.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
fs.StringVar(&s.KubeClientOptions.KubeConfig, "kubeconfig", s.KubeClientOptions.KubeConfig, "Path to kubeconfig file with authorization and master location information.")
fs.StringVar(&s.CaCertFile, "ca-cert-file", s.CaCertFile, "File containing the x509 Certificate for HTTPS.")
fs.StringVar(&s.CertFile, "tls-cert-file", s.CertFile, ""+
"File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated "+
"after server cert).")
Expand Down Expand Up @@ -108,6 +111,11 @@ func (s *ServerOption) CheckOptionOrDie() error {
func (s *ServerOption) readCAFiles() error {
var err error

s.CaCertData, err = os.ReadFile(s.CaCertFile)
if err != nil {
return fmt.Errorf("failed to read cacert file (%s): %v", s.CaCertFile, err)
}

s.CertData, err = os.ReadFile(s.CertFile)
if err != nil {
return fmt.Errorf("failed to read cert file (%s): %v", s.CertFile, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/controller-manager/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Run(opt *options.ServerOption) error {
}

if opt.EnableHealthz {
if err := helpers.StartHealthz(opt.HealthzBindAddress, "volcano-controller", opt.CertData, opt.KeyData); err != nil {
if err := helpers.StartHealthz(opt.HealthzBindAddress, "volcano-controller", opt.CaCertData, opt.CertData, opt.KeyData); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func main() {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
if s.CertFile != "" && s.KeyFile != "" {
if s.CaCertFile != "" && s.CertFile != "" && s.KeyFile != "" {
if err := s.ParseCAFiles(nil); err != nil {
fmt.Fprintf(os.Stderr, "Failed to parse CA file: %v\n", err)
os.Exit(1)
Expand Down
8 changes: 8 additions & 0 deletions cmd/scheduler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ type ServerOption struct {
KubeClientOptions kube.ClientOptions
CertFile string
KeyFile string
CaCertFile string
CertData []byte
KeyData []byte
CaCertData []byte
SchedulerNames []string
SchedulerConf string
SchedulePeriod time.Duration
Expand Down Expand Up @@ -91,6 +93,7 @@ func NewServerOption() *ServerOption {
func (s *ServerOption) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.KubeClientOptions.Master, "master", s.KubeClientOptions.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
fs.StringVar(&s.KubeClientOptions.KubeConfig, "kubeconfig", s.KubeClientOptions.KubeConfig, "Path to kubeconfig file with authorization and master location information")
fs.StringVar(&s.CaCertFile, "ca-cert-file", s.CaCertFile, "File containing the x509 Certificate for HTTPS.")
fs.StringVar(&s.CertFile, "tls-cert-file", s.CertFile, ""+
"File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated "+
"after server cert).")
Expand Down Expand Up @@ -148,6 +151,11 @@ func (s *ServerOption) RegisterOptions() {
func (s *ServerOption) readCAFiles() error {
var err error

s.CaCertData, err = os.ReadFile(s.CaCertFile)
if err != nil {
return fmt.Errorf("failed to read cacert file (%s): %v", s.CaCertFile, err)
}

s.CertData, err = os.ReadFile(s.CertFile)
if err != nil {
return fmt.Errorf("failed to read cert file (%s): %v", s.CertFile, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/scheduler/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func Run(opt *options.ServerOption) error {
}

if opt.EnableHealthz {
if err := helpers.StartHealthz(opt.HealthzBindAddress, "volcano-scheduler", opt.CertData, opt.KeyData); err != nil {
if err := helpers.StartHealthz(opt.HealthzBindAddress, "volcano-scheduler", opt.CaCertData, opt.CertData, opt.KeyData); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func main() {
os.Exit(1)
}

if s.CertFile != "" && s.KeyFile != "" {
if s.CaCertFile != "" && s.CertFile != "" && s.KeyFile != "" {
if err := s.ParseCAFiles(nil); err != nil {
klog.Fatalf("Failed to parse CA file: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook-manager/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Run(config *options.Config) error {
}

if config.EnableHealthz {
if err := helpers.StartHealthz(config.HealthzBindAddress, "volcano-admission", config.CertData, config.KeyData); err != nil {
if err := helpers.StartHealthz(config.HealthzBindAddress, "volcano-admission", config.CaCertData, config.CertData, config.KeyData); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
sigs.k8s.io/controller-runtime v0.13.0
sigs.k8s.io/yaml v1.3.0
stathat.com/c/consistent v1.0.0
volcano.sh/apis v1.8.0
volcano.sh/apis v1.8.0-alpha.0.0.20231028020234-1a5aa81107d7
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1868,5 +1868,5 @@ sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
stathat.com/c/consistent v1.0.0 h1:ezyc51EGcRPJUxfHGSgJjWzJdj3NiMU9pNfLNGiXV0c=
stathat.com/c/consistent v1.0.0/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0=
volcano.sh/apis v1.8.0 h1:TO9mxoqLMToBAEB195OPuiC3pnupqsUqfXVJroT7KEI=
volcano.sh/apis v1.8.0/go.mod h1:h+xbUpkjfRaHjktAi8h+7JNnNahjwhRSgpN9FUUwNXQ=
volcano.sh/apis v1.8.0-alpha.0.0.20231028020234-1a5aa81107d7 h1:Meq/5hsE1nK9XFZrU5tLM29RjC2SfXpsfLWaKcRyGbE=
volcano.sh/apis v1.8.0-alpha.0.0.20231028020234-1a5aa81107d7/go.mod h1:h+xbUpkjfRaHjktAi8h+7JNnNahjwhRSgpN9FUUwNXQ=

0 comments on commit c034a31

Please sign in to comment.