Skip to content

Commit

Permalink
manually inject scorecard proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelvillard committed Sep 20, 2019
1 parent 467a9cf commit 032bb74
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 38 deletions.
3 changes: 0 additions & 3 deletions .osdk-scorecard.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions deploy/crds/ibmcloud_v1alpha1_invocation_cr.yaml
Expand Up @@ -7,9 +7,4 @@ spec:
parameters:
- name: message
value: Hello World
finalizer:
function: "/whisk.system/utils/echo"
parameters:
- name: message
value: Bye World

2 changes: 1 addition & 1 deletion deploy/crds/ibmcloud_v1alpha1_rule_cr.yaml
Expand Up @@ -4,4 +4,4 @@ metadata:
name: my-rule
spec:
trigger: image-uploaded
action: hello-world
function: hello-world
Expand Up @@ -3,12 +3,12 @@ kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: |-
[{"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Function", "metadata": {"name": "myfunction"}, "spec": {"codeURI": "https://raw.githubusercontent.com/apache/incubator-openwhisk-catalog/master/packages/utils/echo.js", "runtime": "nodejs:6", "parameters": [{"name": "message", "value": "Hello World"}]}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Package", "metadata": {"name": "mh-publish"}, "spec": {"bind": "/whisk.system/messaging", "service": "message-hub"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Trigger", "metadata": {"name": "image-uploaded"}, "spec": {"feed": "openwhisk-cloudant/changes"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Trigger", "metadata": {"name": "image-uploaded"}, "spec": {"feed": "openwhisk-cloudant/changes"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Invocation", "metadata": {"name": "echo-invocation"}, "spec": {"function": "/whisk.system/utils/echo", "parameters": [{"name": "message", "value": "Hello World"}], "finalizer": {"function": "/whisk.system/utils/echo", "parameters": [{"name": "message", "value": "Bye World"}]}}}]
[{"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Function", "metadata": {"name": "myfunction"}, "spec": {"codeURI": "https://raw.githubusercontent.com/apache/incubator-openwhisk-catalog/master/packages/utils/echo.js", "runtime": "nodejs:6"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Package", "metadata": {"name": "mh-publish"}, "spec": {"bind": "/whisk.system/messaging", "service": "message-hub"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Trigger", "metadata": {"name": "image-uploaded"}, "spec": {"feed": "openwhisk-cloudant/changes"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Rule", "metadata": {"name": "my-rule"}, "spec": {"trigger": "image-uploaded", "function": "hello-world"}}, {"apiVersion": "ibmcloud.ibm.com/v1alpha1", "kind": "Invocation", "metadata": {"name": "echo-invocation"}, "spec": {"function": "/whisk.system/utils/echo", "parameters": [{"name": "message", "value": "Hello World"}]}}]
capabilities: Basic Install
categories: Cloud Provider
certified: 'false'
containerImage: cloudoperators/cloud-functions-operator:0.8.2
createdAt: '2019-09-13T13:58:05Z'
createdAt: '2019-09-19T16:53:57Z'
description: Manage IBM Cloud Functions actions and more
repository: https://github.com/IBM/cloud-functions-operator/
support: IBM
Expand Down
3 changes: 1 addition & 2 deletions deploy/olm-catalog/v0.8.2/function.crd.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -128,7 +127,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
5 changes: 2 additions & 3 deletions deploy/olm-catalog/v0.8.2/invocation.crd.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -60,7 +59,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value
is not empty.
Expand Down Expand Up @@ -98,7 +97,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
3 changes: 1 addition & 2 deletions deploy/olm-catalog/v0.8.2/package.crd.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -44,7 +43,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
1 change: 0 additions & 1 deletion deploy/olm-catalog/v0.8.2/rule.crd.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down
3 changes: 1 addition & 2 deletions deploy/olm-catalog/v0.8.2/trigger.crd.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -86,7 +85,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
50 changes: 46 additions & 4 deletions hack/prerelease.sh
Expand Up @@ -141,16 +141,58 @@ spec:
sourceNamespace: marketplace
EOF

echo "Wait for CSV to be healthy"
echo "Waiting for CSV to be healthy"

for i in {0..20}; do
if [ "$(kubectl get clusterserviceversion -n marketplace cloud-functions-operator.v${TAG} -o=jsonpath='{.status.phase}')" == "Succeeded" ]; then
if [[ $(kubectl get clusterserviceversion -n marketplace cloud-functions-operator.v${TAG} -o=jsonpath='{.status.phase}') == "Succeeded" ]]; then
break
fi
sleep 3
done

echo "Inserting the proxy scorecard into the deployment"
kubectl patch -n marketplace deployments.app cloud-functions-operator -p '
{
"spec": {
"template": {
"spec": {
"containers": [
{
"name": "scorecard-proxy",
"image": "quay.io/operator-framework/scorecard-proxy",
"command": [
"scorecard-proxy"
],
"env": [
{
"name": "WATCH_NAMESPACE",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
}
],
"imagePullPolicy": "Always",
"ports": [
{
"name": "proxy",
"containerPort": 8889
}
]
}
]
}
}
}
}'

sleep 5 # wait a bit

echo "Running scorecard"
operator-sdk scorecard --namespace marketplace --olm-deployed --crds-dir ${OPERATOR_DIR} --csv-path "${OPERATOR_DIR}cloud-functions-operator.v${TAG}.clusterserviceversion.yaml"
for cr_file in $(find "deploy/crds" -name "*_cr.yaml" -print); do
operator-sdk scorecard --namespace marketplace --olm-deployed --cr-manifest $cr_file --csv-path "${OPERATOR_DIR}cloud-functions-operator.v${TAG}.clusterserviceversion.yaml"
done

cleanup 0
# cleanup 0
3 changes: 2 additions & 1 deletion pkg/controller/pkg/package_controller.go
Expand Up @@ -334,7 +334,8 @@ func (r *ReconcilePackage) finalize(context context.Context, obj *openwhiskv1bet

wskclient, err := ow.NewWskClient(context, obj.Spec.ContextFrom)
if err != nil {
return reconcile.Result{}, fmt.Errorf("Error creating Cloud Function client %v. (Retrying)", err)
// TODO: maybe retry a certain number of times and then give up?
return reconcile.Result{}, resv1.RemoveFinalizerAndPut(context, obj, ow.Finalizer)
}

if _, err := wskclient.Packages.Delete(name); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/rule/rule_controller.go
Expand Up @@ -221,7 +221,8 @@ func (r *ReconcileRule) finalize(context context.Context, obj *openwhiskv1beta1.

wskclient, err := ow.NewWskClient(context, obj.Spec.ContextFrom)
if err != nil {
return reconcile.Result{}, fmt.Errorf("Error creating Cloud Function client %v. (retrying)", err)
// TODO: maybe retry a certain number of times and then give up?
return reconcile.Result{}, resv1.RemoveFinalizerAndPut(context, obj, ow.Finalizer)
}

if _, err := wskclient.Rules.Delete(name); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/trigger/trigger_controller.go
Expand Up @@ -289,7 +289,8 @@ func (r *ReconcileTrigger) finalize(context context.Context, obj *openwhiskv1bet

wskclient, err := ow.NewWskClient(context, obj.Spec.ContextFrom)
if err != nil {
return reconcile.Result{}, fmt.Errorf("[%s] error creating Cloud Function client %v. (Retrying)", obj.Name, err)
// TODO: maybe retry a certain number of times and then give up?
return reconcile.Result{}, resv1.RemoveFinalizerAndPut(context, obj, ow.Finalizer)
}

if trigger.Feed == "" {
Expand Down
3 changes: 1 addition & 2 deletions releases/v0.8.2/ibmcloud_v1alpha1_function.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -128,7 +127,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
5 changes: 2 additions & 3 deletions releases/v0.8.2/ibmcloud_v1alpha1_invocation.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -60,7 +59,7 @@ spec:
type: string
value:
description: Defaults to null.
type: object

valueFrom:
description: Source for the value. Cannot be used if value
is not empty.
Expand Down Expand Up @@ -98,7 +97,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
3 changes: 1 addition & 2 deletions releases/v0.8.2/ibmcloud_v1alpha1_package.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -44,7 +43,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down
1 change: 0 additions & 1 deletion releases/v0.8.2/ibmcloud_v1alpha1_rule.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down
3 changes: 1 addition & 2 deletions releases/v0.8.2/ibmcloud_v1alpha1_trigger.yaml
Expand Up @@ -15,7 +15,6 @@ spec:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -86,7 +85,7 @@ spec:
type: string
value:
description: Defaults to null.

valueFrom:
description: Source for the value. Cannot be used if value is
not empty.
Expand Down

0 comments on commit 032bb74

Please sign in to comment.