Skip to content

Commit

Permalink
Fix stuff and add LivenessProbe to CarbonProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobValdemar committed Jun 5, 2024
1 parent 7ec0aa0 commit c594d4c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 90 deletions.
12 changes: 10 additions & 2 deletions pkg/providers/carbon/carbon.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package carbon
import (
"context"
"fmt"
"net/http"
"strings"
"sync"
"time"
Expand All @@ -28,7 +29,7 @@ import (
"github.com/aws/aws-sdk-go/service/pricing/pricingiface"
"github.com/samber/lo"

"github.com/aws/karpenter-core/pkg/utils/pretty"
"sigs.k8s.io/karpenter/pkg/utils/pretty"
)

// CarbonProvider provides actual pricing data to the AWS cloud provider to allow it to make more informed decisions
Expand Down Expand Up @@ -61,7 +62,6 @@ type zonal struct {

type Err struct {
error
lastUpdateTime time.Time
}

func newZonalPricing(defaultPrice float64) zonal {
Expand Down Expand Up @@ -146,6 +146,14 @@ func (p *CarbonProvider) UpdateSpotPricing(ctx context.Context) error {
return nil
}

func (p *CarbonProvider) LivenessProbe(_ *http.Request) error {
// ensure we don't deadlock and nolint for the empty critical section
p.mu.Lock()
//nolint: staticcheck
p.mu.Unlock()
return nil
}

func populateInitialSpotPricing(pricing map[string]float64) map[string]zonal {
m := map[string]zonal{}
for it, price := range pricing {
Expand Down
88 changes: 0 additions & 88 deletions pkg/providers/carbon/suite_test.go

This file was deleted.

14 changes: 14 additions & 0 deletions pkg/providers/carbon/zz_generated.carbon_aws.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
//go:build !ignore_autogenerated

/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package carbon

import "time"
Expand Down

0 comments on commit c594d4c

Please sign in to comment.