diff --git a/CHANGES.md b/CHANGES.md index 298065a6..b5554876 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Release Notes. - 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 89977b23..ca7e94f8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ For more details, please read [Java agent injector](docs/java-agent-injector.md) ## 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 b9e8b605..77b158fd 100644 --- a/docs/binary-readme.md +++ b/docs/binary-readme.md @@ -35,7 +35,7 @@ To onboard operator or adapter, you should push the image to a registry where th 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 bf14c6c6..da5b19e3 100644 --- a/docs/examples/java-agent-injector-usage.md +++ b/docs/examples/java-agent-injector-usage.md @@ -67,7 +67,7 @@ spec: - 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 @@ spec: -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 62bb9347..e05e1eb7 100644 --- a/docs/java-agent-injector.md +++ b/docs/java-agent-injector.md @@ -98,7 +98,7 @@ initContainers: - 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 @@ The injector can recognize the following annotations to configure the sidecar: | 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 dea59313..00000000 --- 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 < $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 e118faaa..b6721d77 100644 --- a/operator/controllers/operator/configmap_controller.go +++ b/operator/controllers/operator/configmap_controller.go @@ -57,13 +57,15 @@ func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( // 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 d32526c9..06f80af8 100644 --- a/operator/main.go +++ b/operator/main.go @@ -162,15 +162,22 @@ func main() { &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 2a0d9a74..da5a40f2 100644 --- a/test/e2e/oap-agent-adapter-hpa/e2e.yaml +++ b/test/e2e/oap-agent-adapter-hpa/e2e.yaml @@ -39,9 +39,6 @@ setup: - 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 58ee5f13..0c13d67e 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 @@ setup: - 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 ca75d311..f45a4e64 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 @@ setup: - 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 f8721c28..06405b1d 100644 --- a/test/e2e/oap-ui-agent/e2e.yaml +++ b/test/e2e/oap-ui-agent/e2e.yaml @@ -39,9 +39,6 @@ setup: - 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