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

Porting changes from V1.0.6 to master #142

Merged
merged 28 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c81c582
Orderer: adding auto-cert renewal functionality and port changes from…
asararatnakar May 9, 2023
b35d840
Add peer/orderer config updates and handle upgrades (#112)
asararatnakar Jun 2, 2023
40194af
Donot update tls cert for 2.4.x -> 2.5.x osn upgrades (#117)
shoaebjindani Jun 29, 2023
ca92101
Include legacy dns in the tlscerts to fix post migration issues (#119)
asararatnakar Jul 8, 2023
559e81f
Donot append the image tags when requested image is passed (#120)
asararatnakar Jul 24, 2023
e90c8a7
Update dependencies to remove the vulnerabilities (#123)
asararatnakar Jul 27, 2023
b461dcc
Let console handle auth_scheme (#125)
asararatnakar Aug 3, 2023
cedae40
reduce keepalive interval to avoid connection issues on VPC (#127)
asararatnakar Aug 10, 2023
9c82390
Mark the item as deleted and remove from the Queue if deleted (#129)
asararatnakar Sep 20, 2023
6ea7b3a
Fix builds for non main branches (#130)
asararatnakar Oct 11, 2023
a7b618a
Fix the vulnerabilities by updating deps (#133)
asararatnakar Oct 23, 2023
5315bd0
Fix release build (#135)
asararatnakar Oct 23, 2023
078632b
Upgrade Docker to v20.10.18. (#138)
benjsmi Oct 24, 2023
775ec8e
Optimize the Restarts Queue (#134)
shoaebjindani Oct 25, 2023
fcae637
Revert the github workflow changes for main
asararatnakar Oct 25, 2023
9ac1665
Build multi-arch arm64 and amd64 docker images
jkneubuh Dec 6, 2022
ca01bb5
chore: remove same code in orderer integration test
Abirdcfly Nov 10, 2022
a895f28
chore: remove duplicate err check in pkg/offering
Abirdcfly Nov 11, 2022
c83d9ba
chore: typo ngress -> ingress
Abirdcfly Nov 9, 2022
7e280e6
fix: selector and labels do not match
0xff-dev Dec 21, 2022
82acf89
fix: occasional gosec failure to get version (#88)
Abirdcfly Jan 2, 2023
ae0d3b1
Update CA integration test to use localho.st DNS domain
jkneubuh Jan 2, 2023
c77acfa
Add support for CA Idemix config override stanza (#92)
jkneubuh Jan 6, 2023
e28b762
Fixing gosec issues (#98)
asararatnakar Feb 14, 2023
673abbc
Updating maintainers list to add and remove mainatiners
asararatnakar Feb 14, 2023
93db272
Move hyperledgendary sample to fabric-operator
jkneubuh Feb 10, 2023
c19d638
Removed IBM Confidencial License (#110)
shoaebjindani May 18, 2023
0fdd1b7
Merge branch 'main' into v1.0.6
asararatnakar Oct 25, 2023
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 .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

- name: Set up ginkgo
run: |
go install github.com/onsi/ginkgo/ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4

- name: Set up KIND k8s cluster
run: |
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Release Operator

on:
pull_request:
branches: [ release-1.0 ]
branches: [v1.*]
push:
tags: [ v1.* ]
tags: [v1.*]

env:
GO_VER: 1.18.4
GO_VER: 1.18
GO_TAGS: ""
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand Down Expand Up @@ -39,6 +39,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: setup
run: |
scripts/install-tools.sh
make setup

- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ ARG GO_VER
########## Build operator binary ##########
FROM registry.access.redhat.com/ubi8/go-toolset:$GO_VER as builder

COPY . /go/src/github.com/hyperledger-labs/fabric-operator
WORKDIR /go/src/github.com/hyperledger-labs/fabric-operator

# RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build
RUN go build \
-tags "pkcs11" \
-gcflags all=-trimpath=${GOPATH} \
-asmflags all=-trimpath=${GOPATH} \
-o /tmp/build/_output/bin/ibp-operator
COPY . /go/src/github.com/IBM-Blockchain/fabric-operator
WORKDIR /go/src/github.com/IBM-Blockchain/fabric-operator
RUN GOOS=linux GOARCH=${ARCH} CGO_ENABLED=1 go build -mod=vendor -tags "pkcs11" -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -o /tmp/build/_output/bin/ibp-operator

########## Final Image ##########
FROM registry.access.redhat.com/ubi8/ubi-minimal
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

IMAGE ?= hyperledger-labs/fabric-operator
ARCH ?= $(shell go env GOARCH)
OSS_GO_VER ?= 1.18
BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
OS = $(shell go env GOOS)
SEMREV_LABEL ?= v1.0.0-$(shell git rev-parse --short HEAD)
BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
Expand Down
13 changes: 12 additions & 1 deletion api/v1beta1/ibporderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/orderer/config/v1"
v2config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/orderer/config/v2"
v24config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/orderer/config/v24"
v25config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/orderer/config/v25"
"github.com/IBM-Blockchain/fabric-operator/pkg/util/image"
"github.com/IBM-Blockchain/fabric-operator/version"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -88,7 +89,17 @@ func (o *IBPOrderer) GetConfigOverride() (interface{}, error) {
switch version.GetMajorReleaseVersion(o.Spec.FabricVersion) {
case version.V2:
currentVer := version.String(o.Spec.FabricVersion)
if currentVer.EqualWithoutTag(version.V2_4_1) || currentVer.GreaterThan(version.V2_4_1) {
if currentVer.EqualWithoutTag(version.V2_5_1) || currentVer.GreaterThan(version.V2_5_1) {
if o.Spec.ConfigOverride == nil {
return &v25config.Orderer{}, nil
}

configOverride, err := v25config.ReadFrom(&o.Spec.ConfigOverride.Raw)
if err != nil {
return nil, err
}
return configOverride, nil
} else if currentVer.EqualWithoutTag(version.V2_4_1) || currentVer.GreaterThan(version.V2_4_1) {
if o.Spec.ConfigOverride == nil {
return &v24config.Orderer{}, nil
}
Expand Down
23 changes: 21 additions & 2 deletions api/v1beta1/ibppeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/peer/config/v1"
v2config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/peer/config/v2"
v25config "github.com/IBM-Blockchain/fabric-operator/pkg/initializer/peer/config/v25"
"github.com/IBM-Blockchain/fabric-operator/pkg/util/image"
"github.com/IBM-Blockchain/fabric-operator/version"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -99,15 +100,33 @@ func (p *IBPPeer) UsingCCLauncherImage() bool {
func (p *IBPPeer) EnrollerImage() string {
return image.Format(p.Spec.Images.EnrollerImage, p.Spec.Images.EnrollerTag)
}
func IsV25Peer(fabricVersion string) bool {
currentVer := version.String(fabricVersion)
if currentVer.EqualWithoutTag(version.V2_5_1) || currentVer.GreaterThan(version.V2_5_1) {
return true
}
return false
}

func (s *IBPPeer) GetConfigOverride() (interface{}, error) {
switch version.GetMajorReleaseVersion(s.Spec.FabricVersion) {
case version.V2:
isv25Peer := IsV25Peer(s.Spec.FabricVersion)
if s.Spec.ConfigOverride == nil {
return &v2config.Core{}, nil
if isv25Peer {
return &v25config.Core{}, nil
} else {
return &v2config.Core{}, nil
}
}

configOverride, err := v2config.ReadFrom(&s.Spec.ConfigOverride.Raw)
var configOverride interface{}
var err error
if isv25Peer {
configOverride, err = v25config.ReadFrom(&s.Spec.ConfigOverride.Raw)
} else {
configOverride, err = v2config.ReadFrom(&s.Spec.ConfigOverride.Raw)
}
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion config/ingress/kind/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ resources:
- https://github.com/kubernetes/ingress-nginx.git/deploy/static/provider/kind?ref=controller-v1.1.2

patchesStrategicMerge:
- ingress-nginx-controller.yaml
- ingress-nginx-controller.yaml
6 changes: 3 additions & 3 deletions controllers/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ type Client interface {
List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
}

// 1. Only one existing instance (of the same type as 'instance') should have
// the name 'instance.GetName()'; if more than one is present, return error
// 2. If any instance of a different type share the same name, return error
// 1. Only one existing instance (of the same type as 'instance') should have
// the name 'instance.GetName()'; if more than one is present, return error
// 2. If any instance of a different type share the same name, return error
func ValidateCRName(k8sclient Client, name, namespace, kind string) error {
listOptions := &client.ListOptions{
Namespace: namespace,
Expand Down
34 changes: 26 additions & 8 deletions controllers/ibporderer/ibporderer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,25 +746,43 @@ func (r *ReconcileIBPOrderer) UpdateFunc(e event.UpdateEvent) bool {
oldVer := version.String(oldOrderer.Spec.FabricVersion)
newVer := version.String(newOrderer.Spec.FabricVersion)

// check if this V1 -> V2.2.x/V2.4.x orderer migration
// check if this V1 -> V2.2.x/V2.4.x/v2.5.x orderer migration
if (oldOrderer.Spec.FabricVersion == "" ||
version.GetMajorReleaseVersion(oldOrderer.Spec.FabricVersion) == version.V1) &&
version.GetMajorReleaseVersion(newOrderer.Spec.FabricVersion) == version.V2 {
update.migrateToV2 = true
if newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1) {
if newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1) {
update.migrateToV25 = true
// Re-enrolling tls cert to include admin hostname in SAN (for orderers >=2.5.1)
update.tlscertReenrollNeeded = true
} else if newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1) {
update.migrateToV24 = true
// Re-enrolling tls cert to include admin hostname in SAN (for orderers >=2.4.1)
update.tlscertReenrollNeeded = true
}
}

// check if this V2.2.x -> V2.4.x/2.5.x orderer migration
if (version.GetMajorReleaseVersion(oldOrderer.Spec.FabricVersion) == version.V2) &&
oldVer.LessThan(version.V2_4_1) {
if newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1) {
update.migrateToV25 = true
// Re-enrolling tls cert to include admin hostname in SAN (for orderers >=2.4.1)
update.tlscertReenrollNeeded = true
} else if newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1) {
update.migrateToV24 = true
// Re-enrolling tls cert to include admin hostname in SAN (for orderers >=2.4.1)
update.tlscertReenrollNeeded = true
}
}

// check if this V2.2.x -> V2.4.x orderer migration
// check if this V2.4.x -> V2.5.x orderer migration
if (version.GetMajorReleaseVersion(oldOrderer.Spec.FabricVersion) == version.V2) &&
oldVer.LessThan(version.V2_4_1) &&
(newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1)) {
update.migrateToV24 = true
// Re-enrolling tls cert to include admin hostname in SAN (for orderers >=2.4.1)
update.tlscertReenrollNeeded = true
oldVer.LessThan(version.V2_5_1) &&
(newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1)) {
update.migrateToV25 = true
//Orderers >=2.4.1 alredy has the tls-cert renewed, we do not do this in this upgrade
//update.tlscertReenrollNeeded = true
}

if oldOrderer.Spec.NodeOUDisabled() != newOrderer.Spec.NodeOUDisabled() {
Expand Down
9 changes: 9 additions & 0 deletions controllers/ibporderer/predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Update struct {
ecertCreated bool
migrateToV2 bool
migrateToV24 bool
migrateToV25 bool
nodeOUUpdated bool
imagesUpdated bool
fabricVersionUpdated bool
Expand All @@ -69,6 +70,7 @@ func (u *Update) Detected() bool {
u.ecertEnroll ||
u.migrateToV2 ||
u.migrateToV24 ||
u.migrateToV25 ||
u.nodeOUUpdated ||
u.imagesUpdated ||
u.fabricVersionUpdated
Expand Down Expand Up @@ -186,6 +188,10 @@ func (u *Update) MigrateToV24() bool {
return u.migrateToV24
}

func (u *Update) MigrateToV25() bool {
return u.migrateToV25
}

func (u *Update) NodeOUUpdated() bool {
return u.nodeOUUpdated
}
Expand Down Expand Up @@ -251,6 +257,9 @@ func (u *Update) GetUpdateStackWithTrues() string {
if u.migrateToV24 {
stack += "migrateToV24 "
}
if u.migrateToV25 {
stack += "migrateToV25 "
}
if u.nodeOUUpdated {
stack += "nodeOUUpdated "
}
Expand Down
24 changes: 18 additions & 6 deletions controllers/ibppeer/ibppeer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -671,16 +670,29 @@ func (r *ReconcileIBPPeer) UpdateFunc(e event.UpdateEvent) bool {
version.GetMajorReleaseVersion(oldPeer.Spec.FabricVersion) == version.V1) &&
version.GetMajorReleaseVersion(newPeer.Spec.FabricVersion) == version.V2 {
update.migrateToV2 = true
if newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1) {
if newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1) {
update.migrateToV24 = true
update.migrateToV25 = true
} else if newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1) {
update.migrateToV24 = true
}
}

// check if this V2.2.x -> V2.4.x peer migration
// check if this V2.2.x -> V2.4.x/V2.5.x peer migration
if (version.GetMajorReleaseVersion(oldPeer.Spec.FabricVersion) == version.V2) &&
oldVer.LessThan(version.V2_4_1) &&
(newVer.EqualWithoutTag(version.V2_4_1) || newVer.GreaterThan(version.V2_4_1)) {
oldVer.LessThan(version.V2_4_1) {
update.migrateToV24 = true
if newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1) {
update.migrateToV25 = true
}
}

// check if this V2.4.x -> V2.5.x peer migration
if (version.GetMajorReleaseVersion(oldPeer.Spec.FabricVersion) == version.V2) &&
oldVer.LessThan(version.V2_5_1) {
if newVer.EqualWithoutTag(version.V2_5_1) || newVer.GreaterThan(version.V2_5_1) {
update.migrateToV25 = true
}
}

if newPeer.Spec.Action.UpgradeDBs == true {
Expand Down Expand Up @@ -775,7 +787,7 @@ func (r *ReconcileIBPPeer) DeleteFunc(e event.DeleteEvent) bool {
// without proper controller references set and was not cleaned up on peer resource deletion.
log.Info(fmt.Sprintf("Deleting %s-init-config config map, if found", peer.GetName()))
if err := r.client.Delete(context.TODO(), &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
ObjectMeta: v1.ObjectMeta{
Name: fmt.Sprintf("%s-init-config", peer.GetName()),
Namespace: peer.GetNamespace(),
},
Expand Down
9 changes: 9 additions & 0 deletions controllers/ibppeer/predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Update struct {
tlscertNewKeyReenroll bool
migrateToV2 bool
migrateToV24 bool
migrateToV25 bool
mspUpdated bool
ecertEnroll bool
tlscertEnroll bool
Expand Down Expand Up @@ -116,6 +117,10 @@ func (u *Update) MigrateToV24() bool {
return u.migrateToV24
}

func (u *Update) MigrateToV25() bool {
return u.migrateToV25
}

func (u *Update) UpgradeDBs() bool {
return u.upgradedbs
}
Expand Down Expand Up @@ -195,6 +200,7 @@ func (u *Update) Needed() bool {
u.tlscertNewKeyReenroll ||
u.migrateToV2 ||
u.migrateToV24 ||
u.migrateToV25 ||
u.mspUpdated ||
u.ecertEnroll ||
u.upgradedbs ||
Expand Down Expand Up @@ -239,6 +245,9 @@ func (u *Update) GetUpdateStackWithTrues() string {
if u.migrateToV24 {
stack += "migrateToV24 "
}
if u.migrateToV25 {
stack += "migrateToV25 "
}
if u.mspUpdated {
stack += "mspUpdated "
}
Expand Down
3 changes: 2 additions & 1 deletion defaultconfig/orderer/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ General:
# ServerMinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the server will
# disconnect them.
ServerMinInterval: 60s
## Changing defaults to 25s to fix connection issues with VPC clusters
ServerMinInterval: 25s
# ServerInterval is the time between pings to clients.
ServerInterval: 7200s
# ServerTimeout is the duration the server waits for a response from
Expand Down
3 changes: 2 additions & 1 deletion defaultconfig/orderer/v2/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ General:
# ServerMinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the server will
# disconnect them.
ServerMinInterval: 60s
## Changing defaults to 25s to fix connection issues with VPC clusters
ServerMinInterval: 25s
# ServerInterval is the time between pings to clients.
ServerInterval: 7200s
# ServerTimeout is the duration the server waits for a response from
Expand Down
11 changes: 10 additions & 1 deletion defaultconfig/orderer/v24/orderer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,21 @@ General:
# ServerMinInterval is the minimum permitted time between client pings.
# If clients send pings more frequently, the server will
# disconnect them.
ServerMinInterval: 60s
## Changing defaults to 25s to fix connection issues with VPC clusters
ServerMinInterval: 25s
# ServerInterval is the time between pings to clients.
ServerInterval: 7200s
# ServerTimeout is the duration the server waits for a response from
# a client before closing the connection.
ServerTimeout: 20s

# Since all nodes should be consistent it is recommended to keep
# the default value of 100MB for MaxRecvMsgSize & MaxSendMsgSize
# Max message size in bytes the GRPC server and client can receive
MaxRecvMsgSize: 104857600
# Max message size in bytes the GRPC server and client can send
MaxSendMsgSize: 104857600

# Cluster settings for ordering service nodes that communicate with other ordering service nodes
# such as Raft based ordering service.
Cluster:
Expand Down
Loading
Loading