Skip to content

Commit

Permalink
Merge branch 'main' into sample-network-docs-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
asararatnakar authored Oct 17, 2023
2 parents 5ff6654 + 4082bb8 commit b09ebba
Show file tree
Hide file tree
Showing 377 changed files with 8,376 additions and 825 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/endtoend-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ jobs:
- uses: actions/checkout@v3

- name: Sample Network E2E Test
run: sample-network/scripts/run-e2e-test.sh || cat sample-network/network-debug.log
run: sample-network/scripts/run-e2e-test.sh

- name: Show Debug Log
if: ${{ always() }}
run: cat sample-network/network-debug.log
20 changes: 0 additions & 20 deletions .github/workflows/image-build.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ env:
KUBECONFIG_PATH: /tmp/kubeconfig.yaml
OPERATOR_NAMESPACE: inttest
DOCKERCONFIGJSON: ${{ secrets.DOCKERCONFIGJSON }}
GO_VER: 1.18

jobs:
suite:
Expand Down Expand Up @@ -56,12 +57,11 @@ jobs:
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: "1.17.9"
go-version: ${{ env.GO_VER }}

- name: Set up ginkgo
run: |
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...
go install github.com/onsi/ginkgo/ginkgo
- name: Set up KIND k8s cluster
run: |
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release Operator

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

env:
GO_VER: 1.18.4
GO_TAGS: ""
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
SEMREV_LABEL: ${{ github.ref_name }}

permissions:
contents: read

jobs:
build-and-push-image:
runs-on: ubuntu-20.04

permissions:
contents: read
packages: write

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Checkout
uses: actions/checkout@v3

- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push
id: push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GO_VER=${{ env.GO_VER }}
GO_TAGS=${{ env.GO_TAGS }}
BUILD_ID=${{ env.SEMREV_LABEL }}
BUILD_DATE=${{ env.BUILD_DATE }}
create-release:
name: Create GitHub Release
needs: [ build-and-push-image ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release Operator Version
uses: ncipollo/release-action@v1
with:
allowUpdates: "true"
bodyFile: release_notes/${{ env.SEMREV_LABEL }}.md
tag: ${{ env.SEMREV_LABEL }}
token: ${{ secrets.GITHUB_TOKEN }}
15 changes: 8 additions & 7 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
name: unit-tests

on:
# TODO: uncomment this when moved to hyperledger-labs repo
# push:
# branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

env:
GO_VER: 1.18

jobs:
make-checks:
runs-on: ubuntu-latest
Expand All @@ -33,11 +35,10 @@ jobs:
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: "1.17.9"
go-version: ${{ env.GO_VER }}
- name: license header checks
run: scripts/check-license.sh
# TODO: run in hyperledger-labs
# - name: gosec
# run: scripts/go-sec.sh
- name: gosec
run: make go-sec
- name: run tests
run: make test
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARG ARCH
ARG REGISTRY
ARG GO_VER

########## Build operator binary ##########
FROM registry.access.redhat.com/ubi8/go-toolset:$GO_VER as builder
COPY . /go/src/github.com/IBM-Blockchain/fabric-operator
WORKDIR /go/src/github.com/IBM-Blockchain/fabric-operator
RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build -mod=vendor -tags "pkcs11" -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -o /tmp/build/_output/bin/ibp-operator

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

########## Final Image ##########
FROM registry.access.redhat.com/ubi8/ubi-minimal
Expand All @@ -19,6 +24,7 @@ COPY definitions /definitions
COPY config/crd/bases /deploy/crds
COPY defaultconfig /defaultconfig
COPY docker-entrypoint.sh .

RUN microdnf update \
&& microdnf install -y \
shadow-utils \
Expand Down
9 changes: 9 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Maintainers

### Active Maintainers

| Name | Github | Discord |
|-------------------|-----------|----------------|
| Josh Kneubuhl | [@jkneubuh](https://github.com/jkneubuh) | jkneubuhl#5919 |
| Ratnakar Asara | [@asararatnakar](https://github.com/asararatnakar) | ratnakar#3494 |
| Shoaeb Jindani | [@shoaebjindani](https://github.com/shoaebjindani) | shoaebmjindani#9890 |
53 changes: 18 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,50 +16,37 @@
# limitations under the License.
#

IMAGE ?= ghcr.io/hyperledger-labs/fabric-operator
TAG ?= $(shell git rev-parse --short HEAD)
IMAGE ?= hyperledger-labs/fabric-operator
ARCH ?= $(shell go env GOARCH)
OSS_GO_VER ?= 1.17.7
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")
GO_VER ?= 1.18.4

DOCKER_IMAGE_REPO ?= ghcr.io
# For compatibility with legacy install-fabric.sh conventions, strip the
# leading semrev 'v' character when preparing dist and release artifacts.
VERSION=$(shell echo $(SEMREV_LABEL) | sed -e 's/^v\(.*\)/\1/')

BUILD_ARGS=--build-arg ARCH=$(ARCH)
BUILD_ARGS+=--build-arg BUILD_ID=$(TAG)
BUILD_ARGS+=--build-arg BUILD_DATE=$(BUILD_DATE)
BUILD_ARGS+=--build-arg GO_VER=$(OSS_GO_VER)

ifneq ($(origin TRAVIS_PULL_REQUEST),undefined)
ifneq ($(TRAVIS_PULL_REQUEST), false)
TAG=pr-$(TRAVIS_PULL_REQUEST)
endif
endif
DOCKER_BUILD ?= docker build

NAMESPACE ?= n$(shell echo $(TAG) | tr -d "-")
BUILD_ARGS+=--build-arg BUILD_ID=$(VERSION)
BUILD_ARGS+=--build-arg BUILD_DATE=$(BUILD_DATE)
BUILD_ARGS+=--build-arg GO_VER=$(GO_VER)

.PHONY: build

build: ## Builds the starter pack
build:
mkdir -p bin && go build -o bin/operator

image: setup
docker build --rm . -f Dockerfile $(BUILD_ARGS) -t $(IMAGE):$(TAG)-$(ARCH)
docker tag $(IMAGE):$(TAG)-$(ARCH) $(IMAGE):latest-$(ARCH)
$(DOCKER_BUILD) -f Dockerfile $(BUILD_ARGS) -t $(IMAGE) .

govendor:
@go mod vendor

setup: govendor manifests bundle generate

image-push:
docker push $(IMAGE):$(TAG)-$(ARCH)

image-push-latest:
docker push $(IMAGE):latest-$(ARCH)

login:
docker login --username $(DOCKER_USERNAME) --password $(DOCKER_PASSWORD) $(DOCKER_IMAGE_REPO)

#######################################
#### part of autogenerate makefile ####
Expand Down Expand Up @@ -152,18 +139,14 @@ fmt:
vet:
@scripts/checks.sh

# Run go sec against code
go-sec:
@scripts/go-sec.sh

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="boilerplate/boilerplate.go.txt" paths="./..."

# Build the docker image
docker-build: test
docker build . -t ${IMG}

# Push the docker image
docker-push:
docker push ${IMG}

# find or download controller-gen
# download controller-gen if necessary
controller-gen:
Expand All @@ -188,7 +171,7 @@ ifeq (, $(shell which kustomize))
KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$KUSTOMIZE_GEN_TMP_DIR ;\
go mod init tmp ;\
go install sigs.k8s.io/kustomize/kustomize/v3@v3.5.4 ;\
go install sigs.k8s.io/kustomize/kustomize/v4@v4.5.7 ;\
rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\
}
KUSTOMIZE=$(GOBIN)/kustomize
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _Fabric, Ahoy!_
- [x] It configures Fabric networks with native Fabric CLI binaries
- [x] It configures Fabric networks with CI/CD and git-ops best-practices
- [x] It deploys _Chaincode Now!!!_ (integrated `ccaas` and `k8s` external builders)
- [x] It detects expiring and expired x509 certificates
- [x] It detects and automatically re-enrolls TLS certificates
- [x] It will provide migration and future LTS revision support
- [x] It manages hybrid cloud, multi-org, and multi-cluster Fabric networks
- [x] It runs on pure containerd _and_ mobyd (no dependencies on Docker/DIND)
Expand All @@ -45,10 +45,9 @@ _Fabric, Ahoy!_

- [ ] Declarative Fabric resources : `Channel`, `Chaincode`, `Organization`, `Consortium` / MSP, ... CRDs
- [ ] Service Mesh Overlay (Linkerd, Istio, ...) with mTLS
- [ ] Metrics and observability with Prometheus and Grafana
- [x] Metrics and observability with [Prometheus and Grafana](./docs/prometheus.md)
- [ ] Operational management: Log aggregation, monitoring, alerting
- [ ] Modular CAs (Fabric CA, cert-manager.io, Vault, letsencrypt, ...)
- [ ] Automatic x509 certificate renewal
- [ ] Backup / Recovery / Upgrade
- [ ] Idemixer, Token SDK, BFT Orderer
- [ ] Layer II blockchain integration (Cactus, Weaver, Token SDK, ...)
Expand All @@ -57,6 +56,7 @@ _Fabric, Ahoy!_

## Build a Fabric Network

- Build a [multi-org](sample-network-multi-org) network on a local KIND development cluster.
- Build a [sample-network](sample-network) with Kube APIs.
- [Build a Network](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ibp-console-build-network) with the [Fabric Operations Console](https://github.com/hyperledger-labs/fabric-operations-console).
- Automate your network with [Ansible Playbooks](https://cloud.ibm.com/docs/blockchain?topic=blockchain-ansible) and the Console REST APIs.
Expand Down
3 changes: 0 additions & 3 deletions api/v1beta1/common_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
corev1 "k8s.io/api/core/v1"
)

var BoolTrue = true
var BoolFalse = false

// Service is the overrides to be used for Service of the component
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
type Service struct {
Expand Down
20 changes: 2 additions & 18 deletions api/v1beta1/ibporderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,11 @@ func (s *IBPOrdererSpec) DomainSet() bool {
}

func (s *IBPOrdererSpec) IsPrecreateOrderer() bool {
if s.IsPrecreate == nil {
return false
}

if *s.IsPrecreate == BoolTrue {
return true
}

return false
return s.IsPrecreate != nil && *s.IsPrecreate
}

func (s *IBPOrdererSpec) IsUsingChannelLess() bool {
if s.UseChannelLess == nil {
return false
}

if *s.UseChannelLess == BoolTrue {
return true
}

return false
return s.UseChannelLess != nil && *s.UseChannelLess
}

func (s *IBPOrdererSpec) GetNumSecondsWarningPeriod() int64 {
Expand Down
Loading

0 comments on commit b09ebba

Please sign in to comment.