Skip to content

Commit

Permalink
Merge branch 'master' into optimize_installation
Browse files Browse the repository at this point in the history
Signed-off-by: lfbear <lfbear@gmail.com>
  • Loading branch information
lfbear committed May 19, 2021
2 parents 21b0600 + 7a0d6c9 commit 16fd4f0
Show file tree
Hide file tree
Showing 861 changed files with 64,003 additions and 18,305 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
# Dependency directories (remove the comment below to include it)
# vendor/

.idea/
.idea/
.vscode/
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ linters:
enable:
# linters maintained by golang.org
- gofmt
- goimports
- golint
- govet
# linters default enabled by golangci-lint .
Expand All @@ -40,6 +41,12 @@ linters:
- typecheck
- unused
- varcheck
# other linters supported by golangci-lint.
- whitespace

linters-settings:
goimports:
local-prefixes: github.com/karmada-io/karmada

issues:
# The list of ids of default excludes to include or disable. By default it's empty.
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Please make sure to read and observe our [Code of Conduct](/CODE_OF_CONDUCT.md).
## Community Expectations

Karmada is a community project driven by its community which strives to promote a healthy, friendly and productive environment.
Karmada aims to provide turnkey automation for multi-cluster application management in multi-cloud and hybrid cloud scenarios,
Karmada aims to provide turnkey automation for multi-cluster application management in multi-cloud and hybrid cloud scenarios,
and intended to realize multi-cloud centralized management, high availability, failure recovery and traffic scheduling.

# Getting started
Expand All @@ -37,10 +37,10 @@ and intended to realize multi-cloud centralized management, high availability, f

# Your First Contribution

We will help you to contribute in different areas like filing issues, developing features, fixing critical bugs and
We will help you to contribute in different areas like filing issues, developing features, fixing critical bugs and
getting your work reviewed and merged.

If you have questions about the development process,
If you have questions about the development process,
feel free to [file an issue](https://github.com/karmada-io/karmada/issues/new/choose).

## Find something to work on
Expand All @@ -53,13 +53,13 @@ Here is how you get started.

There are [multiple repositories](https://github.com/karmada-io/) within the Karmada organization.
Each repository has beginner-friendly issues that provide a good first issue.
For example, [karmada-io/karmada](https://github.com/karmada-io/karmada) has
[help wanted](https://github.com/karmada-io/karmada/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) and
[good first issue](https://github.com/karmada-io/karmada/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
For example, [karmada-io/karmada](https://github.com/karmada-io/karmada) has
[help wanted](https://github.com/karmada-io/karmada/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) and
[good first issue](https://github.com/karmada-io/karmada/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
labels for issues that should not need deep knowledge of the system.
We can help new contributors who wish to work on such issues.

Another good way to contribute is to find a documentation improvement, such as a missing/broken link.
Another good way to contribute is to find a documentation improvement, such as a missing/broken link.
Please see [Contributing](#contributing) below for the workflow.

#### Work on an issue
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ karmada control plane.

#### 1. Create member cluster
We are going to create a cluster named `member1` and we want the `KUBECONFIG` file

in `/root/.kube/karmada.config`. Run following command:
```
# hack/create-cluster.sh member1 /root/.kube/karmada.config
Expand Down Expand Up @@ -237,6 +238,23 @@ NAME READY UP-TO-DATE AVAILABLE AGE
nginx 1/1 1 1 43s
```

## Meeting

Regular Community Meeting:
* Tuesday at 14:30 CST(China Standard Time)(biweekly). [Convert to your timezone.](https://www.thetimezoneconverter.com/?t=14%3A30&tz=GMT%2B8&)

Resources:
- [Meeting notes and agenda](https://docs.google.com/document/d/1y6YLVC-v7cmVAdbjedoyR5WL0-q45DBRXTvz5_I7bkA/edit)
- [Meeting Calendar](https://calendar.google.com/calendar/embed?src=karmadaoss%40gmail.com&ctz=Asia%2FShanghai) | [Subscribe](https://calendar.google.com/calendar/u/1?cid=a2FybWFkYW9zc0BnbWFpbC5jb20)

## Contact

If you have questions, feel free to reach out to us in the following ways:

- [mailing list](https://groups.google.com/forum/#!forum/karmada)
- [slack](https://join.slack.com/t/karmada-io/shared_invite/zt-omhy1wfa-LmAkCLfpDMnBjVXp3_U~0w)
- [twitter](https://twitter.com/karmada_io)

## Contributing

If you're interested in being a contributor and want to get involved in
Expand Down
5 changes: 5 additions & 0 deletions artifacts/deploy/cluster.karmada.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ spec:
description: Provider represents the cloud provider name of the member
cluster.
type: string
proxyURL:
description: 'ProxyURL is the proxy URL for the cluster. If not empty,
the karmada control plane will use this proxy to talk to the cluster.
More details please refer to: https://github.com/kubernetes/client-go/issues/351'
type: string
region:
description: Region represents the region of the member cluster locate
in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
properties:
component:
description: 'Component is part of image name. Basically
we presume an image can be make of ''[registry/]repository[:tag]''.
we presume an image can be made of ''[registry/]repository[:tag]''.
The registry could be: - k8s.gcr.io - fictional.registry.example:10443
The repository could be: - kube-apiserver - fictional/nginx
The tag cloud be: - latest - v1.19.1 - @sha256:dbcc1c35ac38df41fd2f5e4130b32ffdb93ebae8b3dbe638c23575912276fc9c'
Expand Down Expand Up @@ -125,7 +125,7 @@ spec:
type: object
resourceSelectors:
description: ResourceSelectors restricts resource types that this
override policy applies to.
override policy applies to. nil means matching all resources.
items:
description: ResourceSelector the resources will be selected.
properties:
Expand Down Expand Up @@ -196,7 +196,8 @@ spec:
type: array
targetCluster:
description: TargetCluster defines restrictions on this override policy
that only applies to resources propagated to the matching clusters
that only applies to resources propagated to the matching clusters.
nil means matching all clusters.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
Expand Down Expand Up @@ -293,6 +294,8 @@ spec:
type: object
type: object
type: object
required:
- overriders
type: object
required:
- spec
Expand Down
9 changes: 6 additions & 3 deletions artifacts/deploy/policy.karmada.io_overridepolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
properties:
component:
description: 'Component is part of image name. Basically
we presume an image can be make of ''[registry/]repository[:tag]''.
we presume an image can be made of ''[registry/]repository[:tag]''.
The registry could be: - k8s.gcr.io - fictional.registry.example:10443
The repository could be: - kube-apiserver - fictional/nginx
The tag cloud be: - latest - v1.19.1 - @sha256:dbcc1c35ac38df41fd2f5e4130b32ffdb93ebae8b3dbe638c23575912276fc9c'
Expand Down Expand Up @@ -125,7 +125,7 @@ spec:
type: object
resourceSelectors:
description: ResourceSelectors restricts resource types that this
override policy applies to.
override policy applies to. nil means matching all resources.
items:
description: ResourceSelector the resources will be selected.
properties:
Expand Down Expand Up @@ -196,7 +196,8 @@ spec:
type: array
targetCluster:
description: TargetCluster defines restrictions on this override policy
that only applies to resources propagated to the matching clusters
that only applies to resources propagated to the matching clusters.
nil means matching all clusters.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
Expand Down Expand Up @@ -293,6 +294,8 @@ spec:
type: object
type: object
type: object
required:
- overriders
type: object
required:
- spec
Expand Down
14 changes: 7 additions & 7 deletions artifacts/deploy/webhook-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
- name: clusterpropagationpolicy.karmada.io
rules:
Expand All @@ -31,7 +31,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
- name: overridepolicy.karmada.io
rules:
Expand All @@ -45,7 +45,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
- name: work.karmada.io
rules:
Expand All @@ -59,7 +59,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
---
apiVersion: admissionregistration.k8s.io/v1
Expand All @@ -81,7 +81,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
- name: propagationpolicy.karmada.io
rules:
Expand All @@ -95,7 +95,7 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
- name: clusterpropagationpolicy.karmada.io
rules:
Expand All @@ -109,5 +109,5 @@ webhooks:
caBundle: {{caBundle}}
failurePolicy: Fail
sideEffects: None
admissionReviewVersions: ["v1beta1"]
admissionReviewVersions: ["v1"]
timeoutSeconds: 3
2 changes: 1 addition & 1 deletion artifacts/example/binding.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: policy.karmada.io/v1alpha1
apiVersion: work.karmada.io/v1alpha1
kind: ResourceBinding
metadata:
name: binding-foo
Expand Down
17 changes: 9 additions & 8 deletions cmd/agent/app/agent.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"context"
"flag"
"fmt"
"os"
Expand All @@ -27,14 +28,14 @@ import (
)

// NewAgentCommand creates a *cobra.Command object with default parameters
func NewAgentCommand(stopChan <-chan struct{}) *cobra.Command {
func NewAgentCommand(ctx context.Context) *cobra.Command {
opts := options.NewOptions()

cmd := &cobra.Command{
Use: "karmada-agent",
Long: `The karmada agent runs the cluster registration agent`,
Run: func(cmd *cobra.Command, args []string) {
if err := run(opts, stopChan); err != nil {
if err := run(ctx, opts); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
Expand All @@ -46,7 +47,7 @@ func NewAgentCommand(stopChan <-chan struct{}) *cobra.Command {
return cmd
}

func run(opts *options.Options, stopChan <-chan struct{}) error {
func run(ctx context.Context, opts *options.Options) error {
controlPlaneRestConfig, err := clientcmd.BuildConfigFromFlags("", opts.KarmadaKubeConfig)
if err != nil {
return fmt.Errorf("error building kubeconfig of karmada control plane: %s", err.Error())
Expand Down Expand Up @@ -74,10 +75,10 @@ func run(opts *options.Options, stopChan <-chan struct{}) error {
return err
}

setupControllers(controllerManager, opts, stopChan)
setupControllers(controllerManager, opts, ctx.Done())

// blocks until the stop channel is closed.
if err := controllerManager.Start(stopChan); err != nil {
if err := controllerManager.Start(ctx); err != nil {
klog.Errorf("controller manager exits unexpectedly: %v", err)
return err
}
Expand All @@ -88,13 +89,13 @@ func run(opts *options.Options, stopChan <-chan struct{}) error {
func setupControllers(mgr controllerruntime.Manager, opts *options.Options, stopChan <-chan struct{}) {
predicateFun := predicate.Funcs{
CreateFunc: func(createEvent event.CreateEvent) bool {
return createEvent.Meta.GetName() == opts.ClusterName
return createEvent.Object.GetName() == opts.ClusterName
},
UpdateFunc: func(updateEvent event.UpdateEvent) bool {
return updateEvent.MetaOld.GetName() == opts.ClusterName
return updateEvent.ObjectOld.GetName() == opts.ClusterName
},
DeleteFunc: func(deleteEvent event.DeleteEvent) bool {
return deleteEvent.Meta.GetName() == opts.ClusterName
return deleteEvent.Object.GetName() == opts.ClusterName
},
GenericFunc: func(genericEvent event.GenericEvent) bool {
return false
Expand Down
1 change: 0 additions & 1 deletion cmd/agent/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"time"

"github.com/spf13/pflag"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ func main() {
logs.InitLogs()
defer logs.FlushLogs()

stopChan := apiserver.SetupSignalHandler()
ctx := apiserver.SetupSignalContext()

if err := app.NewAgentCommand(stopChan).Execute(); err != nil {
if err := app.NewAgentCommand(ctx).Execute(); err != nil {
klog.Fatal(err.Error())
}
}
Loading

0 comments on commit 16fd4f0

Please sign in to comment.