Skip to content

Commit

Permalink
Feat/small feats (#211)
Browse files Browse the repository at this point in the history
* NetworkConfig: filter the peers to be added per organization

* Filter peers by org, global peers and global CAs

* Add `FabricChaincodeTemplate` CRD

* update

* Add support for FabricChaincodeTemplateRef in FabricChaincodeSpec

Signed-off-by: David VIEJO <[email protected]>

* update

* Update helm chart in pipelien

Signed-off-by: David VIEJO <[email protected]>

* Update

Signed-off-by: David VIEJO <[email protected]>

* update

Signed-off-by: David VIEJO <[email protected]>

* Update

Signed-off-by: David VIEJO <[email protected]>

* update

* fabric-config 0.1.0 -> 0.2.1

Add ports 443 for the peer

* Upgrade to go 1.21

* Add adminURL in the network config if available

* Update pipelines to 1.21

* Add command to get the next sequence and version for a chaincode based on chaincode definition

Signed-off-by: David VIEJO <[email protected]>

* update

Signed-off-by: David VIEJO <[email protected]>

* update

Signed-off-by: David VIEJO <[email protected]>

* update

Signed-off-by: David VIEJO <[email protected]>

* Update peer controller

Signed-off-by: David VIEJO <[email protected]>

* Update go dependencies

Signed-off-by: David VIEJO <[email protected]>

* Parametrize responseWaitTime, aliveTimeInterval, aliveExpirationTimeout and reconnectInterval

* Fix ci/cd

* fix ci/cd

* fix error in suite_test

* fix ci/cd

---------

Signed-off-by: David VIEJO <[email protected]>
Signed-off-by: David Viejo <[email protected]>
  • Loading branch information
dviejokfs authored Feb 13, 2024
1 parent b34e3ec commit 7e3e065
Show file tree
Hide file tree
Showing 32 changed files with 7,187 additions and 5,413 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-kubectl-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install operator CRDs
run: |
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
make generate manifests install
- name: Install Istio
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Install operator
run: |
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
make generate manifests install
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true,crdVersions=v1"
CRD_OPTIONS ?= "crd:crdVersions=v1"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
14 changes: 13 additions & 1 deletion api/hlf.kungfusoftware.es/v1alpha1/hlf_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"github.com/kfsoftware/hlf-operator/pkg/status"
"k8s.io/api/networking/v1beta1"
kubeclock "k8s.io/apimachinery/pkg/util/clock"
kubeclock "k8s.io/utils/clock"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -375,6 +375,18 @@ type FabricPeerSpecGossip struct {
Endpoint string `json:"endpoint"`
UseLeaderElection bool `json:"useLeaderElection"`
OrgLeader bool `json:"orgLeader"`
// +kubebuilder:validation:Default=25s
// +optional
ReconnectInterval string `json:"reconnectInterval"`
// +kubebuilder:validation:Default=25s
// +optional
AliveExpirationTimeout string `json:"aliveExpirationTimeout"`
// +kubebuilder:validation:Default=5s
// +optional
AliveTimeInterval string `json:"aliveTimeInterval"`
// +kubebuilder:validation:Default=2s
// +optional
ResponseWaitTime string `json:"responseWaitTime"`
}
type Catls struct {
Cacert string `json:"cacert"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions charts/hlf-peer/templates/configmap--peer--core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ data:
# Should be slightly bigger than digestWaitTime
requestWaitTime: 1500ms
# Time to wait before pull engine ends pull (unit: second)
responseWaitTime: 2s
responseWaitTime: {{.Values.peer.gossip.responseWaitTime | default "2s" }}
# Alive check interval(unit: second)
aliveTimeInterval: 5s
aliveTimeInterval: {{.Values.peer.gossip.aliveTimeInterval | default "5s" }}
# Alive expiration timeout(unit: second)
aliveExpirationTimeout: 25s
aliveExpirationTimeout: {{.Values.peer.gossip.aliveExpirationTimeout | default "25s"}}
# Reconnect interval(unit: second)
reconnectInterval: 25s
reconnectInterval: {{.Values.peer.gossip.reconnectInterval | default "25s"}}
# Max number of attempts to connect to a peer
maxConnectionAttempts: 120
# Message expiration factor for alive messages
Expand Down
5 changes: 5 additions & 0 deletions charts/hlf-peer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ peer:
orgLeader: "false"
useLeaderElection: "true"

reconnectInterval: "25s"
aliveExpirationTimeout: "25s"
aliveTimeInterval: "5s"
responseWaitTime: "2s"

tls:
server:
enabled: "true"
Expand Down
1,117 changes: 615 additions & 502 deletions config/crd/bases/hlf.kungfusoftware.es_fabriccas.yaml

Large diffs are not rendered by default.

1,063 changes: 589 additions & 474 deletions config/crd/bases/hlf.kungfusoftware.es_fabricchaincodes.yaml

Large diffs are not rendered by default.

1,063 changes: 589 additions & 474 deletions config/crd/bases/hlf.kungfusoftware.es_fabricchaincodetemplates.yaml

Large diffs are not rendered by default.

112 changes: 71 additions & 41 deletions config/crd/bases/hlf.kungfusoftware.es_fabricexplorers.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: fabricexplorers.hlf.kungfusoftware.es
spec:
group: hlf.kungfusoftware.es
Expand All @@ -31,14 +29,19 @@ spec:
description: FabricExplorer is the Schema for the hlfs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -48,15 +51,43 @@ spec:
resources:
description: ResourceRequirements describes the compute resource requirements.
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.
This is an alpha field and requires enabling the
DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
description: |-
Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
Expand All @@ -65,10 +96,11 @@ spec:
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
description: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
required:
Expand All @@ -80,37 +112,41 @@ spec:
conditions:
description: Conditions is a set of Condition instances.
items:
description: "Condition represents an observation of an object's
state. Conditions are an extension mechanism intended to be used
when the details of an observation are not a priori known or would
not apply to all instances of a given Kind. \n Conditions should
be added to explicitly convey properties that users and components
care about rather than requiring those properties to be inferred
from other observations. Once defined, the meaning of a Condition
can not be changed arbitrarily - it becomes part of the API, and
has the same backwards- and forwards-compatibility concerns of
any other part of the API."
description: |-
Condition represents an observation of an object's state. Conditions are an
extension mechanism intended to be used when the details of an observation
are not a priori known or would not apply to all instances of a given Kind.
Conditions should be added to explicitly convey properties that users and
components care about rather than requiring those properties to be inferred
from other observations. Once defined, the meaning of a Condition can not be
changed arbitrarily - it becomes part of the API, and has the same
backwards- and forwards-compatibility concerns of any other part of the API.
properties:
lastTransitionTime:
format: date-time
type: string
message:
type: string
reason:
description: ConditionReason is intended to be a one-word, CamelCase
representation of the category of cause of the current status.
It is intended to be used in concise output, such as one-line
kubectl get output, and in summarizing occurrences of causes.
description: |-
ConditionReason is intended to be a one-word, CamelCase representation of
the category of cause of the current status. It is intended to be used in
concise output, such as one-line kubectl get output, and in summarizing
occurrences of causes.
type: string
status:
type: string
type:
description: "ConditionType is the type of the condition and
is typically a CamelCased word or short phrase. \n Condition
types should indicate state in the \"abnormal-true\" polarity.
For example, if the condition indicates when a policy is invalid,
the \"is valid\" case is probably the norm, so the condition
should be called \"Invalid\"."
description: |-
ConditionType is the type of the condition and is typically a CamelCased
word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For
example, if the condition indicates when a policy is invalid, the "is valid"
case is probably the norm, so the condition should be called "Invalid".
type: string
required:
- status
Expand All @@ -132,9 +168,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
71 changes: 36 additions & 35 deletions config/crd/bases/hlf.kungfusoftware.es_fabricfollowerchannels.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: fabricfollowerchannels.hlf.kungfusoftware.es
spec:
group: hlf.kungfusoftware.es
Expand All @@ -31,14 +29,19 @@ spec:
description: FabricFollowerChannel is the Schema for the hlfs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down Expand Up @@ -148,37 +151,41 @@ spec:
conditions:
description: Conditions is a set of Condition instances.
items:
description: "Condition represents an observation of an object's
state. Conditions are an extension mechanism intended to be used
when the details of an observation are not a priori known or would
not apply to all instances of a given Kind. \n Conditions should
be added to explicitly convey properties that users and components
care about rather than requiring those properties to be inferred
from other observations. Once defined, the meaning of a Condition
can not be changed arbitrarily - it becomes part of the API, and
has the same backwards- and forwards-compatibility concerns of
any other part of the API."
description: |-
Condition represents an observation of an object's state. Conditions are an
extension mechanism intended to be used when the details of an observation
are not a priori known or would not apply to all instances of a given Kind.
Conditions should be added to explicitly convey properties that users and
components care about rather than requiring those properties to be inferred
from other observations. Once defined, the meaning of a Condition can not be
changed arbitrarily - it becomes part of the API, and has the same
backwards- and forwards-compatibility concerns of any other part of the API.
properties:
lastTransitionTime:
format: date-time
type: string
message:
type: string
reason:
description: ConditionReason is intended to be a one-word, CamelCase
representation of the category of cause of the current status.
It is intended to be used in concise output, such as one-line
kubectl get output, and in summarizing occurrences of causes.
description: |-
ConditionReason is intended to be a one-word, CamelCase representation of
the category of cause of the current status. It is intended to be used in
concise output, such as one-line kubectl get output, and in summarizing
occurrences of causes.
type: string
status:
type: string
type:
description: "ConditionType is the type of the condition and
is typically a CamelCased word or short phrase. \n Condition
types should indicate state in the \"abnormal-true\" polarity.
For example, if the condition indicates when a policy is invalid,
the \"is valid\" case is probably the norm, so the condition
should be called \"Invalid\"."
description: |-
ConditionType is the type of the condition and is typically a CamelCased
word or short phrase.
Condition types should indicate state in the "abnormal-true" polarity. For
example, if the condition indicates when a policy is invalid, the "is valid"
case is probably the norm, so the condition should be called "Invalid".
type: string
required:
- status
Expand All @@ -200,9 +207,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit 7e3e065

Please sign in to comment.