Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 0 additions & 21 deletions config/core/100-namespace.yaml

This file was deleted.

25 changes: 25 additions & 0 deletions config/core/200-roles/config-map-view-downstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Extra role for downstream, so that users can get the autoscaling CM to fetch defaults.
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: knative-serving
name: openshift-serverless-view-serving-configmaps
rules:
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["config-autoscaler"]
verbs: ["get", "list", "watch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openshift-serverless-view-serving-configmaps
namespace: knative-serving
subjects:
- kind: Group
name: system:authenticated
apiGroup: rbac.authorization.k8s.io
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: openshift-serverless-view-serving-configmaps
2 changes: 1 addition & 1 deletion config/core/deployments/activator-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ metadata:
app.kubernetes.io/name: knative-serving
app.kubernetes.io/version: devel
spec:
minAvailable: 80%
minAvailable: 1
selector:
matchLabels:
app: activator
2 changes: 1 addition & 1 deletion config/core/deployments/webhook-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ metadata:
app.kubernetes.io/name: knative-serving
app.kubernetes.io/version: devel
spec:
minAvailable: 80%
minAvailable: 1
selector:
matchLabels:
app: webhook
142 changes: 16 additions & 126 deletions openshift/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,138 +100,37 @@ function timeout() {
return 0
}

function update_csv(){
local SERVING_DIR=$1

source ./hack/lib/metadata.bash
local SERVING_VERSION=$(metadata.get dependencies.serving)
local EVENTING_VERSION=$(metadata.get dependencies.eventing)
local KOURIER_VERSION=$(metadata.get dependencies.kourier)
local KOURIER_MINOR_VERSION=${KOURIER_VERSION%.*} # e.g. "0.21.0" => "0.21"

export KNATIVE_KOURIER_CONTROL="registry.ci.openshift.org/openshift/knative-v${KOURIER_VERSION}:kourier"
export KNATIVE_KOURIER_GATEWAY=$(grep -w "docker.io/maistra/proxyv2-ubi8" $SERVING_DIR/third_party/kourier-latest/kourier.yaml | awk '{print $NF}')
local CSV="olm-catalog/serverless-operator/manifests/serverless-operator.clusterserviceversion.yaml"

# release-next branch keeps updating the latest manifest in knative-serving-ci.yaml for serving resources.
# see: https://github.com/openshift/knative-serving/blob/release-next/openshift/release/knative-serving-ci.yaml
# So mount the manifest and use it by KO_DATA_PATH env value.

cat << EOF | yq write --inplace --script - $CSV || return $?
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.containers.(name==knative-operator).env[+]
value:
name: "KO_DATA_PATH"
value: "/tmp/knative/"
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.containers.(name==knative-operator).volumeMounts[+]
value:
name: "serving-manifest"
mountPath: "/tmp/knative/knative-serving/${SERVING_VERSION}"
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.volumes[+]
value:
name: "serving-manifest"
configMap:
name: "ko-data-serving"
items:
- key: "knative-serving-ci.yaml"
path: "knative-serving-ci.yaml"
# eventing
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.containers.(name==knative-operator).volumeMounts[+]
value:
name: "eventing-manifest"
mountPath: "/tmp/knative/knative-eventing/${EVENTING_VERSION}"
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.volumes[+]
value:
name: "eventing-manifest"
configMap:
name: "ko-data-eventing"
items:
- key: "knative-eventing-ci.yaml"
path: "knative-eventing-ci.yaml"
# kourier
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.containers.(name==knative-operator).volumeMounts[+]
value:
name: "kourier-manifest"
mountPath: "/tmp/knative/ingress/${KOURIER_MINOR_VERSION}"
- command: update
path: spec.install.spec.deployments.(name==knative-operator-webhook).spec.template.spec.volumes[+]
value:
name: "kourier-manifest"
configMap:
name: "kourier-cm"
items:
- key: "kourier.yaml"
path: "kourier.yaml"
EOF
cat ./openshift-knative-operator/cmd/operator/kodata/ingress/${KOURIER_MINOR_VERSION}/0-kourier.yaml \
./openshift-knative-operator/cmd/operator/kodata/ingress/${KOURIER_MINOR_VERSION}/1-config-network.yaml > /tmp/kourier.yaml

oc create configmap kourier-cm -n $OPERATORS_NAMESPACE --from-file="/tmp/kourier.yaml" || return $?
}

function install_catalogsource(){
function install_serverless(){
header "Installing Serverless Operator"

# And checkout the setup script based on that commit.
local SERVERLESS_DIR=$(mktemp -d)
local CURRENT_DIR=$(pwd)

# Use the absolute path for KNATIVE_SERVING_MANIFESTS_DIR. It is used in `make generated-files`.
export KNATIVE_SERVING_MANIFESTS_DIR="$(pwd)/openshift/release/artifacts"

git clone --depth 1 https://github.com/openshift-knative/serverless-operator.git ${SERVERLESS_DIR}
pushd ${SERVERLESS_DIR}

source ./test/lib.bash
create_namespaces "${SYSTEM_NAMESPACES[@]}"
export GOPATH=/tmp/go
OPENSHIFT_CI="true" make generated-files || return $?
update_csv $CURRENT_DIR || return $?
# Make OPENSHIFT_CI non-empty to build the serverless index and use S-O nightly build images.
OPENSHIFT_CI="true" ensure_catalogsource_installed || return $?
export ON_CLUSTER_BUILDS=true
export DOCKER_REPO_OVERRIDE=image-registry.openshift-image-registry.svc:5000/openshift-marketplace
OPENSHIFT_CI="true" make generated-files images install-serving || return $?

# Create a secret for https test.
trust_router_ca || return $?
popd
}

function install_knative(){
header "Installing Knative"
export KNATIVE_SERVING_TEST_MANIFESTS_DIR="${root}/release"
install_catalogsource || return $?
create_configmaps || return $?
deploy_serverless_operator "$CURRENT_CSV" || return $?

# Wait for the CRD to appear
timeout 900 '[[ $(oc get crd | grep -c knativeservings) -eq 0 ]]' || return 1

# Install Knative Serving with initial values in test/config/config-observability.yaml.
cat <<-EOF | oc apply -f - || return $?
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
name: knative-serving
namespace: ${SERVING_NAMESPACE}
spec:
ingress:
kourier:
service-type: "LoadBalancer" # To enable gRPC and HTTP2 tests without OCP Route.
config:
deployment:
progressDeadline: "120s"
observability:
logging.request-log-template: '{"httpRequest": {"requestMethod": "{{.Request.Method}}",
"requestUrl": "{{js .Request.RequestURI}}", "requestSize": "{{.Request.ContentLength}}",
"status": {{.Response.Code}}, "responseSize": "{{.Response.Size}}", "userAgent":
"{{js .Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp":
"{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency": "{{.Response.Latency}}s",
"protocol": "{{.Request.Proto}}"}, "traceId": "{{index .Request.Header "X-B3-Traceid"}}"}'
logging.enable-probe-request-log: "true"
logging.enable-request-log: "true"
EOF

# Wait for 4 pods to appear first
timeout 600 '[[ $(oc get pods -n $SERVING_NAMESPACE --no-headers | wc -l) -lt 4 ]]' || return 1
wait_until_pods_running $SERVING_NAMESPACE || return 1
install_serverless || return $?

# To enable gRPC and HTTP2 tests without OCP Route.
oc patch knativeserving knative-serving \
-n "${SERVING_NAMESPACE}" \
--type merge --patch '{"spec": {"ingress": {"kourier": {"service-type": "LoadBalancer"}}}}'

wait_until_service_has_external_ip $SERVING_INGRESS_NAMESPACE kourier || fail_test "Ingress has no external IP"
wait_until_hostname_resolves "$(kubectl get svc -n $SERVING_INGRESS_NAMESPACE kourier -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')"
Expand All @@ -256,15 +155,6 @@ EOF
header "Knative Installed successfully"
}

function create_configmaps(){
# Create configmap to use the latest manifest.
oc create configmap ko-data-serving -n $OPERATORS_NAMESPACE --from-file="${KNATIVE_SERVING_TEST_MANIFESTS_DIR}/knative-serving-ci.yaml" || return $?

# Create eventing manifest. We don't want to do this, but upstream designed that knative-eventing dir is mandatory
# when KO_DATA_PATH was overwritten.
oc create configmap ko-data-eventing -n $OPERATORS_NAMESPACE --from-file="${KNATIVE_SERVING_TEST_MANIFESTS_DIR}/knative-eventing-ci.yaml" || return $?
}

function prepare_knative_serving_tests_nightly {
echo ">> Creating test resources for OpenShift (test/config/)"

Expand Down
26 changes: 26 additions & 0 deletions openshift/patches/005-pdb-minavailable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/config/core/deployments/activator-hpa.yaml b/config/core/deployments/activator-hpa.yaml
index 75c74798d..27ae13f2e 100644
--- a/config/core/deployments/activator-hpa.yaml
+++ b/config/core/deployments/activator-hpa.yaml
@@ -50,7 +50,7 @@ metadata:
app.kubernetes.io/name: knative-serving
app.kubernetes.io/version: devel
spec:
- minAvailable: 80%
+ minAvailable: 1
selector:
matchLabels:
app: activator
diff --git a/config/core/deployments/webhook-hpa.yaml b/config/core/deployments/webhook-hpa.yaml
index 6a2ae587c..7c95f13bb 100644
--- a/config/core/deployments/webhook-hpa.yaml
+++ b/config/core/deployments/webhook-hpa.yaml
@@ -48,7 +48,7 @@ metadata:
app.kubernetes.io/name: knative-serving
app.kubernetes.io/version: devel
spec:
- minAvailable: 80%
+ minAvailable: 1
selector:
matchLabels:
app: webhook
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
diff --git a/openshift/release/artifacts/2-serving-core.yaml b/openshift/release/artifacts/2-serving-core.yaml
index 53f1a1b3f..b166104c8 100644
--- a/openshift/release/artifacts/2-serving-core.yaml
+++ b/openshift/release/artifacts/2-serving-core.yaml
@@ -1,25 +1,3 @@
diff --git a/config/core/100-namespace.yaml b/config/core/100-namespace.yaml
deleted file mode 100644
index cce6c212b..000000000
--- a/config/core/100-namespace.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 The Knative Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,7 +24,7 @@ index 53f1a1b3f..b166104c8 100644
- name: knative-serving
- labels:
- app.kubernetes.io/name: knative-serving
- app.kubernetes.io/version: "1.7.0"
- app.kubernetes.io/version: devel
-
---
# Copyright 2019 The Knative Authors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
diff --git a/openshift/release/artifacts/2-serving-core.yaml b/openshift/release/artifacts/2-serving-core.yaml
index 4f7af33d..4a5ce15f 100644
--- a/openshift/release/artifacts/2-serving-core.yaml
+++ b/openshift/release/artifacts/2-serving-core.yaml
@@ -5935,3 +5935,27 @@ metadata:
# The data is populated at install time.

---
diff --git a/config/core/200-roles/config-map-view-downstream.yaml b/config/core/200-roles/config-map-view-downstream.yaml
new file mode 100644
index 000000000..91e329703
--- /dev/null
+++ b/config/core/200-roles/config-map-view-downstream.yaml
@@ -0,0 +1,25 @@
+# Extra role for downstream, so that users can get the autoscaling CM to fetch defaults.
+kind: Role
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
Expand Down
Loading