This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/skywalking-swck.git
The following commit(s) were added to refs/heads/master by this push: new 96fe630 Update README.md (#5) 96fe630 is described below commit 96fe630c853ac471b1dfc999b33fd9d6fdaabe88 Author: Gao Hongtao <hanahm...@gmail.com> AuthorDate: Sun Nov 8 15:39:32 2020 +0800 Update README.md (#5) * Update README.md Basic guides how to deploy swck * Add CHANGES.md Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Use release docker image Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Add service rbac Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Add license header Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Update registry of kube-rbac-proxy in order to make it accessible to users who can't touch gcr.io Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Add release script Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Update rbac Signed-off-by: Gao Hongtao <hanahm...@gmail.com> * Tweak README.md Signed-off-by: Gao Hongtao <hanahm...@gmail.com> Co-authored-by: 吴晟 Wu Sheng <wu.sh...@foxmail.com> --- .gitignore | 4 ++ CHANGES.md | 12 ++++ Dockerfile | 15 ++++ Makefile | 15 +++- PROJECT | 15 ++++ README.md | 75 ++++++++++++++++++- build/package/release.sh | 103 +++++++++++++++++++++++++++ config/default/manager_auth_proxy_patch.yaml | 2 +- config/manager/kustomization.yaml | 3 +- config/rbac/role.yaml | 12 ++++ controllers/oapserver_controller.go | 1 + golangci.yml | 15 ++++ 12 files changed, 267 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d97ffc5..6e34f53 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ *.so *.dylib bin +build/bin +build/release/ # Test binary, build with `go test -c` *.test @@ -22,3 +24,5 @@ bin *.swp *.swo *~ + +.DS_Store diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..093f274 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,12 @@ +Changes by Version +================== +Release Notes. + +0.1.0 +------------------ + +#### Features +- Add OAPServer CRDs and controller. + +#### Chores +- Set up GitHub actions to build from sources, check code styles, licenses. diff --git a/Dockerfile b/Dockerfile index aea1663..dbe197d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,18 @@ +# 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. + # Build the manager binary FROM golang:1.14 as builder diff --git a/Makefile b/Makefile index 9f90d36..897c5c2 100644 --- a/Makefile +++ b/Makefile @@ -132,4 +132,17 @@ $(LINTER): lint: $(LINTER) $(LINTER) run --config ./golangci.yml -.PHONY: lint \ No newline at end of file +.PHONY: lint + +release-manager: generate + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o build/bin/manager-liunx-amd64 main.go + +RELEASE_SCRIPTS := ./build/package/release.sh + +release-binary: release-manager + ${RELEASE_SCRIPTS} -b + +release-source: + ${RELEASE_SCRIPTS} -s + +.PHONY: release-manager release-binary release-source diff --git a/PROJECT b/PROJECT index e04083d..5a6c59d 100644 --- a/PROJECT +++ b/PROJECT @@ -1,3 +1,18 @@ +# 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. + domain: skywalking.apache.org repo: github.com/skywalking-swck resources: diff --git a/README.md b/README.md index 2085fdf..7fce344 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,74 @@ -# skywalking-swck - Apache SkyWalking Cloud on Kubernetes +============ + +![](https://github.com/apache/skywalking-swck/workflows/Build/badge.svg?branch=master) + +<img src="http://skywalking.apache.org/assets/logo.svg" alt="Sky Walking logo" height="90px" align="right" /> + +A bridge project between [Apache SkyWalking](https://github.com/apache/skywalking) and Kubernetes. + +SWCK is a platform for the SkyWalking user, provisions, upgrades, maintains SkyWalking relevant components, and makes them work natively on Kubernetes. + +# Quick Start + + 1. Go to the [download page](https://skywalking.apache.org/downloads/) to download latest release manifest. + + 2. Apply the manifests for the Controller and CRDs in release/config: + ``` + kubectl apply -f release/config + ``` + +# Guides of Deployment +## Use kustomize to customise your deployment + +1. Clone the source code: + +```sh +git clone g...@github.com:apache/skywalking-swck.git +``` + +2. Edit file `config/default/kustomization.yaml` file to change your preferences. If you prefer to your private docker image, a quick path to override `IMG` environment variable : `export IMG=<private registry>/controller:<tag>` + +3. Use `make` to generate the final manifests and deploy: + +```sh +make deploy +``` + +4. Deploy the CRDs: + +```sh +make install +``` + +## Test your deployment + +1. Deploy a sample OAP server, this will create a OAP server in the default namespace: + +```sh +curl https://raw.githubusercontent.com/apache/skywalking-swck/master/config/samples/oap.yaml | kubectl apply -f - +``` + +2. Check the OAP server in Kubernetes: + +```sh +kubectl get oapserver +``` + +## Troubleshooting + +If you encounter any issue, you can check the log of the controller by pulling it from Kubernetes: + +```sh +# get the pod name of your controller +kubectl --namespace skywalking-swck-system get pods + +# pull the logs +kubectl --namespace skywalking-swck-system logs -f [name_of_the_controller_pod] +``` + +# Contributing +For developers who want to contribute to this project, see [Contribution Guide](CONTRIBUTING.md) + +# License +[Apache 2.0 License.](/LICENSE) diff --git a/build/package/release.sh b/build/package/release.sh new file mode 100755 index 0000000..4f18db1 --- /dev/null +++ b/build/package/release.sh @@ -0,0 +1,103 @@ +#!/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. +# + +set -ex +SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +BUILDDIR=${SCRIPTDIR}/.. +ROOTDIR=${BUILDDIR}/.. + +RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) +RELEASE_VERSION=${RELEASE_TAG#"v"} + +binary(){ + bindir=${BUILDDIR}/release/binary + rm -rf ${bindir} + mkdir -p ${bindir}/config + # Copy relevant files + cp -Rfv ${BUILDDIR}/bin ${bindir} + cp -Rfv ${ROOTDIR}/CHANGES.md ${bindir} + cp -Rfv ${ROOTDIR}/README.md ${bindir} + cp -Rfv ${ROOTDIR}/dist/* ${bindir} + # Generates CRDs and deployment manifests + kustomize build config/crd > ${bindir}/config/crds.yaml + pushd ${ROOTDIR}/config/manager + kustomize edit set image controller=apache/skywalking-swck:${RELEASE_VERSION} + popd + kustomize build config/default > ${bindir}/config/deploy.yaml + # Package + tar -czf ${BUILDDIR}/release/skywalking-swck-${RELEASE_VERSION}-bin.tgz -C ${bindir} . +} + +source(){ + # Package + rm -rf ${BUILDDIR}/release/skywalking-swck-${RELEASE_VERSION}-src.tgz + pushd ${ROOTDIR} + tar \ + --exclude="bin" \ + --exclude="build" \ + --exclude=".*" \ + --exclude="*.test" \ + --exclude="*.out" \ + -czf ${BUILDDIR}/release/skywalking-swck-${RELEASE_VERSION}-src.tgz \ + . + popd +} + +parseCmdLine(){ + ARGS=$1 + if [ $# -eq 0 ]; then + echo "Exactly one argument required." + usage + fi + while getopts "bsh" FLAG; do + case "${FLAG}" in + b) binary ;; + s) source ;; + h) usage ;; + \?) usage ;; + esac + done + return 0 +} + + + +usage() { +cat <<EOF +Usage: + ${0} -[bsh] + +Parameters: + -b Build and assemble the binary package + -s Assemble the source package + -h Show this help. +EOF +exit 1 +} + +# +# main +# + +ret=0 + +parseCmdLine "$@" +ret=$? +[ $ret -ne 0 ] && exit $ret +echo "Done release [$RELEASE_TAG] (exit $ret)" + diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index 3b9ee3d..7206a8f 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -27,7 +27,7 @@ spec: spec: containers: - name: kube-rbac-proxy - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 + image: docker.io/kubesphere/kube-rbac-proxy:v0.4.1 args: - "--secure-listen-address=0.0.0.0:8443" - "--upstream=http://127.0.0.1:8080/" diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 992d1c3..8ceb745 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -21,4 +21,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: hanahmily/swck + newName: apache/skywalking-swck + newTag: 0.1.0 diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index bde338f..9c7c975 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -24,6 +24,18 @@ metadata: name: manager-role rules: - apiGroups: + - "" + resources: + - services + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: - apps resources: - deployments diff --git a/controllers/oapserver_controller.go b/controllers/oapserver_controller.go index 5b82275..e606b17 100644 --- a/controllers/oapserver_controller.go +++ b/controllers/oapserver_controller.go @@ -52,6 +52,7 @@ type OAPServerReconciler struct { // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=oapservers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=oapservers/status,verbs=get;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups="",resources=services,verbs=get;list;watch;create;update;patch;delete func (r *OAPServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { ctx := context.Background() diff --git a/golangci.yml b/golangci.yml index 1777ea7..2f79cbb 100644 --- a/golangci.yml +++ b/golangci.yml @@ -1,3 +1,18 @@ +# 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. + linters: enable: - deadcode