Skip to content

Commit

Permalink
update developer guides
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderflow committed Aug 2, 2021
1 parent 62b952e commit f46f312
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 25 deletions.
15 changes: 8 additions & 7 deletions contribute/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ This guide helps you get started developing KubeVela.
2. Kubernetes version v1.18+ with `~/.kube/config` configured.
3. ginkgo 1.14.0+ (just for [E2E test](./developer-guide.md#e2e-test))
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
5. kubebuilder v2.3.0+
5. kubebuilder v3.1.0+ and you need to manually install the dependency tools for unit test.

<details>
<summary>Install Kubebuilder manually</summary>

linux:
```
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz
tar -zxvf kubebuilder_2.3.1_linux_amd64.tar.gz
wget https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.21.2-linux-amd64.tar.gz
tar -zxvf kubebuilder-tools-1.21.2-linux-amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder_2.3.1_linux_amd64/bin/* /usr/local/kubebuilder/bin
sudo mv kubebuilder/bin/* /usr/local/kubebuilder/bin
```

macOS:
```
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_darwin_amd64.tar.gz
tar -zxvf kubebuilder_2.3.1_darwin_amd64.tar.gz
wget https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.21.2-darwin-amd64.tar.gz
tar -zxvf kubebuilder-tools-1.21.2-darwin-amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder_2.3.1_darwin_amd64/bin/* /usr/local/kubebuilder/bin
sudo mv kubebuilder/bin/* /usr/local/kubebuilder/bin
```

For other OS or system architecture, please refer to https://storage.googleapis.com/kubebuilder-tools/
</details>

You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ type Reconciler struct {
// +kubebuilder:rbac:groups=core.oam.dev,resources=clusters/status,verbs=get;update;patch

// Reconcile is the main logic of appDeployment controller

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res reconcile.Result, retErr error) {
ctx, cancel := common2.NewReconcileContext(ctx)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ type ObjectOwner interface {
SetOwnerReferences([]metav1.OwnerReference)
}

// setOrOverrideOAMControllerOwner will set the
// setOrOverrideOAMControllerOwner will set the new owner and remove the legacy OAM owner
func setOrOverrideOAMControllerOwner(obj ObjectOwner, controllerOwner metav1.OwnerReference) {
newOwnerRefs := []metav1.OwnerReference{controllerOwner}
for _, owner := range obj.GetOwnerReferences() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ func NewReconciler(m ctrl.Manager, dm discoverymapper.DiscoveryMapper, o ...Reco

// Reconcile an OAM ApplicationConfigurations by rendering and instantiating its
// Components and Traits.

func (r *OAMApplicationReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
ctx, cancel := common.NewReconcileContext(ctx)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ type Reconciler struct {
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
ctx, cancel := common2.NewReconcileContext(ctx)
defer cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,9 @@ type Reconciler struct {
// +kubebuilder:rbac:groups=standard.oam.dev,resources=podspecworkloads/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
<<<<<<< HEAD
func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx, cancel := common2.NewReconcileContext()
defer cancel()
=======
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
>>>>>>> bde2baea... upgrade K8s dependency to v0.21
ctx, cancel := common2.NewReconcileContext(ctx)
defer cancel()
log := r.log.WithValues("podspecworkload", req.NamespacedName)
log.Info("Reconcile podspecworkload workload")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,11 @@ type reconciler struct {
concurrentReconciles int
}

<<<<<<< HEAD
func (r *reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx, cancel := common2.NewReconcileContext()
=======
func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
rollout := new(v1alpha1.Rollout)
ctx, cancel := context.WithTimeout(ctx, reconcileTimeOut)
>>>>>>> bde2baea... upgrade K8s dependency to v0.21
ctx, cancel := common2.NewReconcileContext(ctx)
defer cancel()
rollout := new(v1alpha1.Rollout)

rollout := new(v1alpha1.Rollout)
ctx = oamutil.SetNamespaceInCtx(ctx, req.Namespace)
if err := r.Get(ctx, req.NamespacedName, rollout); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
Expand Down

0 comments on commit f46f312

Please sign in to comment.