Skip to content

Commit

Permalink
Merge pull request #102 from Abirdcfly/fixfedactive
Browse files Browse the repository at this point in the history
fix: federation status cant sync from proposal
  • Loading branch information
bjwswang authored Feb 10, 2023
2 parents 262fc09 + e06b0d8 commit 9b31b3b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/example-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,28 @@ jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Check whether the image of the same commit has been built.
id: cache
uses: actions/cache/restore@v3
with:
key: operator.image-${{ github.sha }}
path: /tmp/operator.image.tar
- uses: actions/checkout@v3
# It would be foolish to add the same judgment over and over again, but github action currently does not have
# the syntax to skip all the next steps unless we let the pre step fail, and failure is not what we want.
# see https://github.com/actions/runner/issues/662
if: steps.cache.outputs.cache-hit != 'true'
- name: Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
scripts/install-tools.sh
make image
- name: save image to /tmp
if: steps.cache.outputs.cache-hit != 'true'
run: |
docker save hyperledgerk8s/fabric-operator:latest > /tmp/operator.image.tar
- name: Upload operator image
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
key: operator.image-${{ github.sha }}
Expand Down
9 changes: 0 additions & 9 deletions config/samples/example-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,6 @@ function waitFed() {
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [ $ELAPSED_TIME -gt $TimeoutSeconds ]; then

#todo remove patch after
if [[ $check == "Activated" ]]; then
kubectl patch fed $fedName --subresource=status --type='json' \
-p='[{"op": "replace", "path": "/status/type", "value": "FederationActivated"}]'
START_TIME=CURRENT_TIME
continue
fi

error "Timeout reached"
exit 1
fi
Expand Down
8 changes: 7 additions & 1 deletion controllers/federation/predict.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,13 @@ func (r *ReconcileFederation) ProposalUpdateFunc(e event.UpdateEvent) bool {
// Update if member changes
if len(newMember) != 0 {
fed.Spec.Members = newMember
if err := r.client.Update(context.TODO(), fed); err != nil {
if err := r.client.Patch(context.TODO(), fed, nil, k8sclient.PatchOption{
Resilient: &k8sclient.ResilientPatch{
Retry: 3,
Into: &current.Federation{},
Strategy: client.MergeFrom,
},
}); err != nil {
log.Error(err, fmt.Sprintf("cant update federation %s", newProposal.Spec.Federation))
return false
}
Expand Down

0 comments on commit 9b31b3b

Please sign in to comment.