Skip to content

Commit

Permalink
change type
Browse files Browse the repository at this point in the history
change type
  • Loading branch information
jiuker committed May 22, 2024
1 parent bb4e2e1 commit 322950d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions pkg/controller/sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/xml"
"errors"
"fmt"
"net/http"
"os"
"sync"
Expand Down Expand Up @@ -34,8 +35,8 @@ const (

// STS API constants
const (
STSDefaultPort = "4223"
STSEndpoint = "/sts"
STSDefaultPort int = 4223
STSEndpoint = "/sts"
)

const (
Expand Down Expand Up @@ -263,7 +264,7 @@ func configureSTSServer(c *Controller) *http.Server {
router.NotFoundHandler = http.NotFoundHandler()

s := &http.Server{
Addr: ":" + STSDefaultPort,
Addr: fmt.Sprintf(":%d", STSDefaultPort),
Handler: router,
ReadTimeout: time.Minute,
WriteTimeout: time.Minute,
Expand Down
8 changes: 4 additions & 4 deletions pkg/utils/miniojob/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (jobCommand *MinIOIntervalJobCommand) Success() bool {
}

// createJob - create job
func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sClient client.Client, jobCR *v1alpha1.MinIOJob, stsPort string) (objs []client.Object) {
func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sClient client.Client, jobCR *v1alpha1.MinIOJob, stsPort int) (objs []client.Object) {
if jobCommand == nil {
return nil
}
Expand Down Expand Up @@ -178,7 +178,7 @@ func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sCli
},
StringData: map[string]string{
"MC_HOST_myminio": fmt.Sprintf("https://$(ACCESS_KEY):$(SECRET_KEY)@minio.%s.svc.cluster.local", jobCR.Namespace),
"MC_STS_ENDPOINT_myminio": fmt.Sprintf("https://sts.%s.svc.cluster.local:%s/sts/%s", miniov2.GetNSFromFile(), stsPort, jobCR.Namespace),
"MC_STS_ENDPOINT_myminio": fmt.Sprintf("https://sts.%s.svc.cluster.local:%d/sts/%s", miniov2.GetNSFromFile(), stsPort, jobCR.Namespace),
"MC_WEB_IDENTITY_TOKEN_FILE_myminio": "/var/run/secrets/kubernetes.io/serviceaccount/token",
},
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func (jobCommand *MinIOIntervalJobCommand) createJob(ctx context.Context, k8sCli
}

// CreateJob - create job
func (jobCommand *MinIOIntervalJobCommand) CreateJob(ctx context.Context, k8sClient client.Client, jobCR *v1alpha1.MinIOJob, stsPort string) error {
func (jobCommand *MinIOIntervalJobCommand) CreateJob(ctx context.Context, k8sClient client.Client, jobCR *v1alpha1.MinIOJob, stsPort int) error {
for _, obj := range jobCommand.createJob(ctx, k8sClient, jobCR, stsPort) {
if obj == nil {
continue
Expand Down Expand Up @@ -308,7 +308,7 @@ func (intervalJob *MinIOIntervalJob) GetMinioJobStatus(ctx context.Context) v1al
}

// CreateCommandJob - create command job
func (intervalJob *MinIOIntervalJob) CreateCommandJob(ctx context.Context, k8sClient client.Client, stsPort string) error {
func (intervalJob *MinIOIntervalJob) CreateCommandJob(ctx context.Context, k8sClient client.Client, stsPort int) error {
for _, command := range intervalJob.Command {
if len(command.CommandSpec.DependsOn) == 0 {
err := command.CreateJob(ctx, k8sClient, intervalJob.JobCR, stsPort)
Expand Down

0 comments on commit 322950d

Please sign in to comment.