Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provider stability improvements #266

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KINDEST_VERSION=v1.24.7
KINDEST_VERSION=v1.32.0
GO111MODULE=on
REDIS_VERSION=7
ROOT_DIR=${AP_ROOT}
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,32 +138,6 @@ jobs:
with:
files: .cache/tests/coverage.txt

codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
- name: Setup direnv
uses: HatsuneMiku3939/direnv-action@v1
with:
masks: ''
- name: Run codegen
run: make codegen
- name: Ensure no files changed/added/removed
run: |
if [[ -z "$(git status --short)" ]]; then
git status
exit 1
fi

yamlcheck:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -203,7 +177,6 @@ jobs:
- lint
- release-dry-run
- coverage
- codegen
- yamlcheck
- shellcheck
- integration-tests
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dist
.idea/
*.iml
.vscode
*.code-workspace

coverage.txt

go.work
Expand Down
4 changes: 3 additions & 1 deletion _run/common-kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# KinD, it's fine to use other names locally, however in GH container name
# is configured by engineerd/setup-kind. `kind-control-plane` is the docker
# image's name in GH Actions.
export KIND_NAME ?= $(shell basename $$PWD)
KIND_NAME ?= $(shell basename $$PWD)

export KIND_NAME

ifeq (, $(KINDEST_VERSION))
$(error "KINDEST_VERSION is not set")
Expand Down
162 changes: 81 additions & 81 deletions _run/metallb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,87 @@ metadata:
labels:
app: metallb

---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
labels:
app: metallb
name: controller
namespace: metallb-system
spec:
allowPrivilegeEscalation: false
allowedCapabilities: []
allowedHostPaths: []
defaultAddCapabilities: []
defaultAllowPrivilegeEscalation: false
fsGroup:
ranges:
- max: 65535
min: 1
rule: MustRunAs
hostIPC: false
hostNetwork: false
hostPID: false
privileged: false
readOnlyRootFilesystem: true
requiredDropCapabilities:
- ALL
runAsUser:
ranges:
- max: 65535
min: 1
rule: MustRunAs
seLinux:
rule: RunAsAny
supplementalGroups:
ranges:
- max: 65535
min: 1
rule: MustRunAs
volumes:
- configMap
- secret
- emptyDir
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
labels:
app: metallb
name: speaker
namespace: metallb-system
spec:
allowPrivilegeEscalation: false
allowedCapabilities:
- NET_RAW
allowedHostPaths: []
defaultAddCapabilities: []
defaultAllowPrivilegeEscalation: false
fsGroup:
rule: RunAsAny
hostIPC: false
hostNetwork: true
hostPID: false
hostPorts:
- max: 7472
min: 7472
- max: 7946
min: 7946
privileged: true
readOnlyRootFilesystem: true
requiredDropCapabilities:
- ALL
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
volumes:
- configMap
- secret
- emptyDir
#---
#apiVersion: policy/v1beta1
#kind: PodSecurityPolicy
#metadata:
# labels:
# app: metallb
# name: controller
# namespace: metallb-system
#spec:
# allowPrivilegeEscalation: false
# allowedCapabilities: []
# allowedHostPaths: []
# defaultAddCapabilities: []
# defaultAllowPrivilegeEscalation: false
# fsGroup:
# ranges:
# - max: 65535
# min: 1
# rule: MustRunAs
# hostIPC: false
# hostNetwork: false
# hostPID: false
# privileged: false
# readOnlyRootFilesystem: true
# requiredDropCapabilities:
# - ALL
# runAsUser:
# ranges:
# - max: 65535
# min: 1
# rule: MustRunAs
# seLinux:
# rule: RunAsAny
# supplementalGroups:
# ranges:
# - max: 65535
# min: 1
# rule: MustRunAs
# volumes:
# - configMap
# - secret
# - emptyDir
#---
#apiVersion: policy/v1beta1
#kind: PodSecurityPolicy
#metadata:
# labels:
# app: metallb
# name: speaker
# namespace: metallb-system
#spec:
# allowPrivilegeEscalation: false
# allowedCapabilities:
# - NET_RAW
# allowedHostPaths: []
# defaultAddCapabilities: []
# defaultAllowPrivilegeEscalation: false
# fsGroup:
# rule: RunAsAny
# hostIPC: false
# hostNetwork: true
# hostPID: false
# hostPorts:
# - max: 7472
# min: 7472
# - max: 7946
# min: 7946
# privileged: true
# readOnlyRootFilesystem: true
# requiredDropCapabilities:
# - ALL
# runAsUser:
# rule: RunAsAny
# seLinux:
# rule: RunAsAny
# supplementalGroups:
# rule: RunAsAny
# volumes:
# - configMap
# - secret
# - emptyDir
---
apiVersion: v1
kind: ServiceAccount
Expand Down
10 changes: 4 additions & 6 deletions balance_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/boz/go-lifecycle"
sdk "github.com/cosmos/cosmos-sdk/types"
btypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/tendermint/tendermint/libs/log"
tmrpc "github.com/tendermint/tendermint/rpc/core/types"

Expand Down Expand Up @@ -53,7 +52,6 @@ type balanceChecker struct {
lc lifecycle.Lifecycle
bus pubsub.Bus
ownAddr sdk.AccAddress
bqc btypes.QueryClient
aqc aclient.QueryClient
leases map[mtypes.LeaseID]*leaseState
cfg BalanceCheckerConfig
Expand All @@ -66,13 +64,14 @@ type leaseCheckResponse struct {
err error
}

func newBalanceChecker(ctx context.Context,
bqc btypes.QueryClient,
func newBalanceChecker(
ctx context.Context,
aqc aclient.QueryClient,
accAddr sdk.AccAddress,
clientSession session.Session,
bus pubsub.Bus,
cfg BalanceCheckerConfig) (*balanceChecker, error) {
cfg BalanceCheckerConfig,
) (*balanceChecker, error) {

bc := &balanceChecker{
ctx: ctx,
Expand All @@ -81,7 +80,6 @@ func newBalanceChecker(ctx context.Context,
bus: bus,
lc: lifecycle.New(),
ownAddr: accAddr,
bqc: bqc,
aqc: aqc,
leases: make(map[mtypes.LeaseID]*leaseState),
cfg: cfg,
Expand Down
11 changes: 8 additions & 3 deletions cluster/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ loop:
case inv := <-invupch:
currinv = inv.Dup()
state.inventory = inv

updateIPs()

metrics := state.inventory.Metrics()
Expand All @@ -655,13 +656,13 @@ loop:
// readjust inventory accordingly with pending leases
for _, r := range state.reservations {
if !r.allocated {
// FIXME check is call for Adjust actually needed to be here
if err := state.inventory.Adjust(r); err != nil {
is.log.Error("adjust inventory for pending reservation", "error", err.Error())
}
}
}
// updateInventory(inv)

trySignal()
case run := <-runch:
runch = nil
t.Reset(5 * time.Second)
Expand All @@ -687,7 +688,11 @@ loop:

trySignal()
case <-signalch:
bus.Pub(state.inventory.Snapshot(), []string{ptypes.PubSubTopicInventoryStatus}, tpubsub.WithRetain())
inv, err := is.getStatusV1(state)
if err != nil {
continue
}
bus.Pub(inv, []string{ptypes.PubSubTopicInventoryStatus}, tpubsub.WithRetain())
}

updateReservationMetrics(state.reservations)
Expand Down
Loading
Loading