Polish documents and introduce webhook health checker (#52)
* fix bug in the configmap controller
* add webhook healthychecker
* fix issue in the doc
* delete the script of waiting webhook install
* update changes.md
diff --git a/CHANGES.md b/CHANGES.md
index 298065a..b555487 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,7 @@
- Fix operator role patch issues
- Fix invalid CSR signername
+- Fix bug in the configmap controller
#### Chores
- Bump up KubeBuilder to V3
diff --git a/README.md b/README.md
index 89977b2..ca7e94f 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@
## Operator
- * To install the operator in an existing cluster, make sure you have [`cert-manager` installed](https://cert-manager.io/docs/installation/)
+ * To install the operator in an existing cluster, make sure you have [`cert-manager`](https://cert-manager.io/docs/installation/) installed.
* Apply the manifests for the Controller and CRDs in release/config:
```
diff --git a/docs/binary-readme.md b/docs/binary-readme.md
index b9e8b60..77b158f 100644
--- a/docs/binary-readme.md
+++ b/docs/binary-readme.md
@@ -35,7 +35,7 @@
The java agent injector and operator share a same binary. To onboard them, you should follow:
-* To install the java agent injector and operator in an existing cluster, make sure you have [`cert-manager` installed](https://cert-manager.io/docs/installation/)
+* To install the java agent injector and operator in an existing cluster, make sure you have [`cert-manager`](https://cert-manager.io/docs/installation/) installed.
* Apply the manifests for the Controller and CRDs in `config`:
```
diff --git a/docs/examples/java-agent-injector-usage.md b/docs/examples/java-agent-injector-usage.md
index bf14c6c..da5b19e 100644
--- a/docs/examples/java-agent-injector-usage.md
+++ b/docs/examples/java-agent-injector-usage.md
@@ -67,7 +67,7 @@
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
command:
- sh
- image: apache/skywalking-java-agent:8.7.0-jdk8
+ image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
@@ -349,7 +349,7 @@
-i cp {} /sky/agent/plugins/
command:
- sh
- image: apache/skywalking-java-agent:8.7.0-jdk8
+ image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
diff --git a/docs/java-agent-injector.md b/docs/java-agent-injector.md
index 62bb934..e05e1eb 100644
--- a/docs/java-agent-injector.md
+++ b/docs/java-agent-injector.md
@@ -98,7 +98,7 @@
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
command:
- sh
- image: apache/skywalking-java-agent:8.7.0-jdk8
+ image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
@@ -155,7 +155,7 @@
| Annotation key | Description | Annotation Default value |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `sidecar.skywalking.apache.org/initcontainer.Name` | The name of the injected java agent container. | `inject-skywalking-agent` |
-| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.7.0-jdk8` |
+| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.8.0-java8` |
| `sidecar.skywalking.apache.org/initcontainer.Command` | The command of the injected java agent container. | `sh` |
| `sidecar.skywalking.apache.org/initcontainer.args.Option` | The args option of the injected java agent container. | `-c` |
| `sidecar.skywalking.apache.org/initcontainer.args.Command` | The args command of the injected java agent container. | `mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent` |
diff --git a/hack/wait-webhook.sh b/hack/wait-webhook.sh
deleted file mode 100644
index dea5931..0000000
--- a/hack/wait-webhook.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-TIMEOUT=60
-
-MANIFEST=$(mktemp)
-
-cat <<EOF > $MANIFEST
-apiVersion: operator.skywalking.apache.org/v1alpha1
-kind: OAPServer
-metadata:
- name: dummy
-spec:
- version: 8.8.1
- instances: 1
- image: apache/skywalking-oap-server:8.8.1
-EOF
-
-timeout $TIMEOUT bash -c -- "\
- while ! kubectl create -f $MANIFEST 2> /dev/null; \
- do \
- sleep 0.1; \
- done"
-
-# make sure the dummy OAPServer will be deleted
-trap "kubectl delete OAPServer dummy; rm $MANIFEST" 0 2 3 15
diff --git a/operator/controllers/operator/configmap_controller.go b/operator/controllers/operator/configmap_controller.go
index e118faa..b6721d7 100644
--- a/operator/controllers/operator/configmap_controller.go
+++ b/operator/controllers/operator/configmap_controller.go
@@ -57,13 +57,15 @@
// if validate false , we will delete the configmap and recreate a default configmap
if !apierrors.IsNotFound(err) {
ok, errinfo := injector.ValidateConfigmap(configmap)
- if !ok {
- log.Error(errinfo, "the default configmap validate false")
- if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
- log.Error(deleteErr, "failed to delete the configmap that validate false")
- }
+ if ok {
+ return ctrl.Result{}, nil
}
- log.Info("delete the configmap that validate false")
+ log.Error(errinfo, "the default configmap validate false")
+ if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
+ log.Error(deleteErr, "failed to delete the configmap that validate false")
+ return ctrl.Result{}, deleteErr
+ }
+ log.Info("deleted the configmap that validate false")
}
app := kubernetes.Application{
Client: r.Client,
diff --git a/operator/main.go b/operator/main.go
index d32526c..06f80af 100644
--- a/operator/main.go
+++ b/operator/main.go
@@ -162,15 +162,22 @@
&webhook.Admission{
Handler: &injector.JavaagentInjector{Client: mgr.GetClient()}})
setupLog.Info("/mutate-v1-pod webhook is registered")
- }
- if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
- setupLog.Error(err, "unable to set up health check")
- os.Exit(1)
- }
- if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
- setupLog.Error(err, "unable to set up ready check")
- os.Exit(1)
+ if err := mgr.AddHealthzCheck("healthz", mgr.GetWebhookServer().StartedChecker()); err != nil {
+ setupLog.Error(err, "unable to set up health check for webhook")
+ os.Exit(1)
+ }
+ if err := mgr.AddReadyzCheck("readyz", mgr.GetWebhookServer().StartedChecker()); err != nil {
+ setupLog.Error(err, "unable to set up ready check for webhook")
+ os.Exit(1)
+ }
+ } else {
+ if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
+ setupLog.Error(err, "unable to set up ready check")
+ }
+ if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
+ setupLog.Error(err, "unable to set up ready check")
+ }
}
setupLog.Info("starting manager")
diff --git a/test/e2e/oap-agent-adapter-hpa/e2e.yaml b/test/e2e/oap-agent-adapter-hpa/e2e.yaml
index 2a0d9a7..da5a40f 100644
--- a/test/e2e/oap-agent-adapter-hpa/e2e.yaml
+++ b/test/e2e/oap-agent-adapter-hpa/e2e.yaml
@@ -39,9 +39,6 @@
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- - name: wait webhook installing
- command: |
- bash hack/wait-webhook.sh
- name: install metrics-adapter
command: |
export ADAPTER_IMG=metrics-adapter
diff --git a/test/e2e/oap-ui-agent-external-storage/e2e.yaml b/test/e2e/oap-ui-agent-external-storage/e2e.yaml
index 58ee5f1..0c13d67 100644
--- a/test/e2e/oap-ui-agent-external-storage/e2e.yaml
+++ b/test/e2e/oap-ui-agent-external-storage/e2e.yaml
@@ -39,9 +39,6 @@
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- - name: wait webhook installing
- command: |
- bash hack/wait-webhook.sh
- name: setup elasticsearch
command: |
kubectl apply -f test/e2e/deploy-elasticsearch.yaml
diff --git a/test/e2e/oap-ui-agent-internal-storage/e2e.yaml b/test/e2e/oap-ui-agent-internal-storage/e2e.yaml
index ca75d31..f45a4e6 100644
--- a/test/e2e/oap-ui-agent-internal-storage/e2e.yaml
+++ b/test/e2e/oap-ui-agent-internal-storage/e2e.yaml
@@ -39,9 +39,6 @@
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- - name: wait webhook installing
- command: |
- bash hack/wait-webhook.sh
- name: setup storage(use the internal type)
command: |
kubectl apply -f test/e2e/internal-storage.yaml
diff --git a/test/e2e/oap-ui-agent/e2e.yaml b/test/e2e/oap-ui-agent/e2e.yaml
index f8721c2..06405b1 100644
--- a/test/e2e/oap-ui-agent/e2e.yaml
+++ b/test/e2e/oap-ui-agent/e2e.yaml
@@ -39,9 +39,6 @@
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- - name: wait webhook installing
- command: |
- bash hack/wait-webhook.sh
- name: setup oapserver and ui
command: |
kubectl create namespace skywalking-system