Skip to content

Commit

Permalink
add default values for minReplicas and replicas (#582)
Browse files Browse the repository at this point in the history
* add default value to minReplicas and replicas

Signed-off-by: laminar <[email protected]>

* change docker command to get image digest

Signed-off-by: laminar <[email protected]>

---------

Signed-off-by: laminar <[email protected]>
  • Loading branch information
tpiperatgod authored Feb 24, 2023
1 parent b77882b commit 9361108
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ endef
.PHONY: redhat-certificated-bundle
redhat-certificated-bundle: yq kustomize manifests
operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(shell docker images --digests --format "{{.Repository}}@{{.Digest}}" $(OPERATOR_IMG))
cd config/manager && $(KUSTOMIZE) edit set image controller=$(shell docker inspect --format='{{json .RepoDigests}}' $(OPERATOR_IMG) | jq --arg IMAGE_TAG_BASE "$(IMAGE_TAG_BASE)" -c '.[] | select(index($$IMAGE_TAG_BASE))' -r)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(YQ) eval -i ".metadata.annotations.\"olm.skipRange\" = \"<$(VERSION)\"" bundle/manifests/function-mesh.clusterserviceversion.yaml
$(YQ) eval -i ".metadata.annotations.\"olm.properties\" = ([{\"type\": \"olm.maxOpenShiftVersion\", \"value\": \"4.11\"}] | @json)" bundle/manifests/function-mesh.clusterserviceversion.yaml
$(YQ) eval -i ".metadata.annotations.createdAt = \"$(BUILD_DATETIME)\"" bundle/manifests/function-mesh.clusterserviceversion.yaml
$(YQ) eval -i ".metadata.annotations.containerImage = \"$(shell docker images --digests --format "{{.Repository}}@{{.Digest}}" $(OPERATOR_IMG))\"" bundle/manifests/function-mesh.clusterserviceversion.yaml
$(YQ) eval -i ".metadata.annotations.containerImage = \"$(shell docker inspect --format='{{json .RepoDigests}}' $(OPERATOR_IMG) | jq --arg IMAGE_TAG_BASE "$(IMAGE_TAG_BASE)" -c '.[] | select(index($$IMAGE_TAG_BASE))' -r)\"" bundle/manifests/function-mesh.clusterserviceversion.yaml
$(YQ) eval -i '.annotations += {"operators.operatorframework.io.bundle.channel.default.v1":"alpha"}' bundle/metadata/annotations.yaml
IMG_DIGIEST=$(shell docker images --digests --format "{{.Repository}}@{{.Digest}}" $(OPERATOR_IMG)) hack/postprocess-bundle.sh
IMG_DIGIEST=$(shell docker inspect --format='{{json .RepoDigests}}' $(OPERATOR_IMG) | jq --arg IMAGE_TAG_BASE "$(IMAGE_TAG_BASE)" -c '.[] | select(index($$IMAGE_TAG_BASE))' -r) hack/postprocess-bundle.sh
operator-sdk bundle validate ./bundle --select-optional name=operatorhub
operator-sdk bundle validate ./bundle --select-optional suite=operatorframework

Expand Down
2 changes: 2 additions & 0 deletions api/compute/v1alpha1/function_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ type FunctionSpec struct {
Namespace string `json:"namespace,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
Replicas *int32 `json:"replicas,omitempty"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
MinReplicas *int32 `json:"minReplicas,omitempty"`

DownloaderImage string `json:"downloaderImage,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions api/compute/v1alpha1/sink_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ type SinkSpec struct {
Namespace string `json:"namespace,omitempty"`
SinkType string `json:"sinkType,omitempty"` // refer to `--sink-type` as builtin connector
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
Replicas *int32 `json:"replicas,omitempty"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
MinReplicas *int32 `json:"minReplicas,omitempty"`

DownloaderImage string `json:"downloaderImage,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions api/compute/v1alpha1/source_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ type SourceSpec struct {
ClusterName string `json:"clusterName,omitempty"`
SourceType string `json:"sourceType,omitempty"` // refer to `--source-type` as builtin connector
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
Replicas *int32 `json:"replicas,omitempty"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
MinReplicas *int32 `json:"minReplicas,omitempty"`

DownloaderImage string `json:"downloaderImage,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3190,6 +3191,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3499,6 +3501,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -6407,6 +6410,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -6621,6 +6625,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -9585,6 +9590,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3209,6 +3210,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3143,6 +3144,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3130,6 +3131,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/compute.functionmesh.io_functionmeshes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3191,6 +3192,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3500,6 +3502,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -6408,6 +6411,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -6622,6 +6626,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -9586,6 +9591,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/compute.functionmesh.io_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3188,6 +3189,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/compute.functionmesh.io_sinks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3122,6 +3123,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/compute.functionmesh.io_sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ spec:
format: int32
type: integer
minReplicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -3109,6 +3110,7 @@ spec:
- py
type: object
replicas:
default: 1
format: int32
minimum: 1
type: integer
Expand Down

0 comments on commit 9361108

Please sign in to comment.