Most users are expected to use a released version of the operator, but if you're testing or want to use a pre-released version of of the release yamls, you may want to build your own copy of the operator.
You can install the Knative Operator from the source code using the ko build tool.
-
Download the source code:
git clone https://github.com/knative/operator.git
-
Install the Operator in the root directory of the source:
ko apply -f config/
-
To verify the installation:
kubectl get deployment
The following result indicates the installation is fine:
NAME READY UP-TO-DATE AVAILABLE AGE knative-operator 1/1 1 1 17m operator-webhook 1/1 1 1 17m
-
Check the log via the command:
kubectl logs -f deploy/knative-operator
The operator bundles the last N=4 releases of Knative components in
/cmd/operator/kodata/
in various subdirectories. A few notes:
-
The
kodata
files can be automatically regenerated by running./hack/update-codegen.sh
or thecmd/fetcher
command; it has a configuration for fetching updates in its ownkodata
directory. -
If you only want to update the yaml files, you can also mount a volume over
/var/run/kodata
(or set$KO_DATA_PATH
) on the operator to pick up different yaml files. You can combine this with aReadWriteMany
volume (or a sidecar) to be able to update the yaml files live on-cluster without rebuilding the operator image.
go test -v ./...
First, install the Knative Operator. The integration tests use two environment
variables: TEST_NAMESPACE
for Knative Serving tests and
TEST_EVENTING_NAMESPACE
for Knative Eventing tests.
export TEST_NAMESPACE=knative-serving
export TEST_EVENTING_NAMESPACE=knative-eventing
You can choose any names, but the Knative Serving and Knative Eventing should have different namespaces.
Create the namespaces:
kubectl create namespace $TEST_NAMESPACE
kubectl create namespace $TEST_EVENTING_NAMESPACE
All the integration tests are tagged with e2e
. Run the integration tests for
Knative Serving and Eventing:
go test -v -tags=e2e -count=1 ./test/e2e
You should get all the tests passed, which means your installation is successful. If you run into any issues, log your issues here.
The upgrade tests have taken everything into account. You do not even need to
install Knative Operator or Istio before running the tests. Make sure you have
set two of these environment variables: TEST_NAMESPACE
and
TEST_EVENTING_NAMESPACE
.
export TEST_NAMESPACE=knative-serving
export TEST_EVENTING_NAMESPACE=knative-eventing
IMPORTANT: Before running ANY upgrade tests, run the following commands to clean up the existing resources:
kubectl delete KnativeServing --all -n $TEST_NAMESPACE
kubectl delete KnativeEventing --all -n $TEST_EVENTING_NAMESPACE
Run the upgrade tests for the Serving and Eventing CRs:
go test -v -tags=upgrade -count=1 ./test/upgrade