Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

add workflow ci for yurt-app-manager #72

Merged
merged 1 commit into from
Jul 25, 2022
Merged
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
117 changes: 117 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI

on:
push:
branches:
- master
- release-*
pull_request: {}
workflow_dispatch: {}

env:
# Common versions
GO_VERSION: '1.16'
GOLANGCI_VERSION: 'v1.42.1'
DOCKER_BUILDX_VERSION: 'v0.4.2'

jobs:

check-license:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Check License
run: hack/make-rules/check_license.sh

golangci-lint:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Lint golang code
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_VERSION }}
args: -v

markdownlint-misspell-shellcheck:
runs-on: ubuntu-18.04
# this image is build from Dockerfile
# https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile
container: pouchcontainer/pouchlinter:v0.1.2
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run misspell
run: find ./* -name "*" | xargs misspell -error
- name: Lint markdown files
run: find ./ -name "*.md" | grep -v enhancements | grep -v .github | xargs mdl -r ~MD010,~MD013,~MD014,~MD022,~MD024,~MD029,~MD031,~MD032,~MD033,~MD034,~MD036
# - name: Check markdown links
# run: |
# set +e
# for name in $(find . -name \*.md | grep -v CHANGELOG); do
# if [ -f $name ]; then
# markdown-link-check -q $name -c .github/workflows/markdown-link-check.config.json;
# if [ $? -ne 0 ]; then
# code=1
# fi
# fi
# done
# bash -c "exit $code";

unit-tests:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run Unit Tests
run: make test
- name: Publish Unit Test Coverage
uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./cover.out
fail_ci_if_error: true
verbose: true
build-binaries:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Fetch History
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Build All Binaries
run: make build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ dockerbuild

*.out
logs
bin
bin/controller-gen
bin/kustomize
48 changes: 48 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This file contains all available configuration options
# with their default values.

# options for analysis running
run:
go: '1.16'
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 15m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# make issues output unique by line, default is true
uniq-by-line: true

# all available settings of specific linters
linters-settings:
gci:
local-prefixes: github.com/openyurtio

linters:
disable-all: true
enable:
- deadcode
- gofmt
- goimports
- gci
- ineffassign
- misspell
- vet
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ifneq (${https_proxy},)
DOCKER_BUILD_ARGS += --build-arg https_proxy='${https_proxy}'
endif

.PHONY: clean all release build
.PHONY: clean all build

all: test build

Expand Down Expand Up @@ -67,7 +67,6 @@ docker-push:

clean:
-rm -Rf _output
-rm -Rf dockerbuild

generate: controller-gen manifests generate-goclient

Expand Down Expand Up @@ -115,6 +114,9 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.1)

lint: golangci-lint ## Run go lint against code.
$(GOLANGCI_LINT) run -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we will install golangci-lint@1.42.1.
But we run golangci-lint@1.31.1 in github actions.
We should make them the same version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


GINKGO = $(shell pwd)/bin/ginkgo
ginkgo: ## Download ginkgo locally if necessary.
$(call go-get-tool,$(GINKGO),github.com/onsi/ginkgo/ginkgo@v1.16.4)
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

This repository contains 4 CRD/controllers: NodePool, YurtAppSet, YurtAppDaemon and YurtIngress.

The NodePool provides a convenient management experience for a pool of nodes within the same region or site.
The YurtAppSet defines a new edge application management methodology of using per node pool workload.
The YurtAppDaemon provides a similar K8S DaemonSet support for user app workload from the NodePool level.
The YurtIngress is responsible to deploy configurable ingress controller to the user specified NodePools.
The NodePool provides a convenient management experience for a pool of nodes within the same region or site.

For details of the design, please see the documents below:
NodePool and YurtAppSet: [document](https://github.com/openyurtio/openyurt/blob/master/docs/enhancements/20201211-nodepool_uniteddeployment.md).
YurtAppDaemon: [document](https://github.com/openyurtio/openyurt/blob/master/docs/enhancements/20210729-yurtappdaemon.md).
YurtIngress: [document](https://github.com/openyurtio/openyurt/blob/master/docs/proposals/20210628-nodepool-ingress-support.md).
The YurtAppSet defines a new edge application management methodology of using per node pool workload.

The YurtAppDaemon provides a similar K8S DaemonSet support for user app workload from the NodePool level.

The YurtIngress is responsible to deploy configurable ingress controller to the user specified NodePools.

For details of the design, please see the documents below:

NodePool and YurtAppSet: [document](https://github.com/openyurtio/openyurt/blob/master/docs/enhancements/20201211-nodepool_uniteddeployment.md).

YurtAppDaemon: [document](https://github.com/openyurtio/openyurt/blob/master/docs/enhancements/20210729-yurtappdaemon.md).

YurtIngress: [document](https://github.com/openyurtio/openyurt/blob/master/docs/proposals/20210628-nodepool-ingress-support.md).

## Getting Start

Expand All @@ -21,7 +27,7 @@ For a complete example, please check out the [tutorial](docs/yurt-app-manager-tu

## Contributing

Contributions are welcome, whether by creating new issues or pull requests. See
Contributions are welcome, whether by creating new issues or pull requests. See
our [contributing document](https://github.com/openyurtio/openyurt/blob/master/CONTRIBUTING.md) to get started.

## Contact
Expand All @@ -35,8 +41,8 @@ our [contributing document](https://github.com/openyurtio/openyurt/blob/master/C
</div>

## License
Yurt-app-manager is under the Apache 2.0 license. See the [LICENSE](LICENSE) file
for details. Certain implementations in Yurt-app-manager rely on the existing code
from [Kubernetes](https://github.com/kubernetes/kubernetes) and
[OpenKruise](https://github.com/openkruise/kruise) the credits go to the
Yurt-app-manager is under the Apache 2.0 license. See the [LICENSE](LICENSE) file
for details. Certain implementations in Yurt-app-manager rely on the existing code
from [Kubernetes](https://github.com/kubernetes/kubernetes) and
[OpenKruise](https://github.com/openkruise/kruise) the credits go to the
original authors.
3 changes: 2 additions & 1 deletion cmd/yurt-app-manager/app-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"math/rand"
"time"

"github.com/openyurtio/yurt-app-manager/cmd/yurt-app-manager/app"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog"

"github.com/openyurtio/yurt-app-manager/cmd/yurt-app-manager/app"
)

func main() {
Expand Down
18 changes: 9 additions & 9 deletions cmd/yurt-app-manager/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ import (
"net/http"
"os"

"github.com/openyurtio/yurt-app-manager/cmd/yurt-app-manager/options"
"github.com/openyurtio/yurt-app-manager/pkg/projectinfo"
appsv1alpha1 "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1alpha1"
extclient "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/client"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/constant"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/util/fieldindex"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/webhook"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -41,7 +33,15 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
// +kubebuilder:scaffold:imports

"github.com/openyurtio/yurt-app-manager/cmd/yurt-app-manager/options"
"github.com/openyurtio/yurt-app-manager/pkg/projectinfo"
appsv1alpha1 "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/apis/apps/v1alpha1"
extclient "github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/client"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/constant"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/controller"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/util/fieldindex"
"github.com/openyurtio/yurt-app-manager/pkg/yurtappmanager/webhook"
)

var (
Expand Down
12 changes: 3 additions & 9 deletions docs/YurtAppDaemon.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


<a name="Ynuk5"></a>
# Description
<br />In edge scenarios,edge nodes from the same region are allocated to the same nodepool, generally it is necessary to deploy some system components at the nodepool level, such as CoreDNS. When a nodepool is created, we want these system components bo be created automatically without any manual actions.
Expand All @@ -12,8 +10,8 @@
- Support Deployment and Statefulset as template
- Support template update and trigger sub-resources update, such as image update of the Deployment template will trigger the child Deployment image update accordingly
- Support auto distribution of the template resources from the nodepool level:
- When the nodepools match the corresponding label, sub-resources are created automatically
- When the nodepools delete the corresponding label, sub-resources are deleted automatically
- When the nodepools match the corresponding label, sub-resources are created automatically
- When the nodepools delete the corresponding label, sub-resources are deleted automatically

​<br />
<a name="cvH4w"></a>
Expand All @@ -34,8 +32,6 @@
## create nodepool test1
```bash
cat <<EOF | kubectl apply -f -


apiVersion: apps.openyurt.io/v1alpha1
kind: NodePool
metadata:
Expand All @@ -45,10 +41,9 @@ spec:
matchLabels:
apps.openyurt.io/nodepool: test1
type: Edge


EOF
```

<a name="rfeAg"></a>
## create nodepool test2
```bash
Expand Down Expand Up @@ -155,7 +150,6 @@ kubectl get deployments.apps
# Check the Pod
```


<a name="UTCfl"></a>
## remove nodepool label
```bash
Expand Down
Loading