Skip to content

Commit

Permalink
deploy foundation agent with manifestwork
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeey committed Aug 11, 2020
1 parent 43f65c0 commit 1ef856c
Show file tree
Hide file tree
Showing 32 changed files with 51 additions and 201 deletions.
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,32 @@ deploy-hub:
deploy-klusterlet:
deploy/managedcluster/klusterlet/install.sh

deploy-acm-foundation-hub: ensure-kustomize
cp deploy/prod/hub/kustomization.yaml deploy/prod/hub/kustomization.yaml.tmp
cd deploy/prod/hub && ../../../$(KUSTOMIZE) edit set image ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-controller=$(FOUNDATION_IMAGE_NAME)
cd deploy/prod/hub && ../../../$(KUSTOMIZE) edit set image ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-proxyserver=$(FOUNDATION_IMAGE_NAME)
$(KUSTOMIZE) build deploy/prod/hub | $(KUBECTL) apply -f -
mv deploy/prod/hub/kustomization.yaml.tmp deploy/prod/hub/kustomization.yaml

deploy-acm-foundation-agent: ensure-kustomize
cp deploy/prod/klusterlet/kustomization.yaml deploy/prod/klusterlet/kustomization.yaml.tmp
cd deploy/prod/klusterlet && ../../../$(KUSTOMIZE) edit set image ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-agent=$(FOUNDATION_IMAGE_NAME)
$(KUSTOMIZE) build deploy/prod/klusterlet | $(KUBECTL) apply -f -
mv deploy/prod/klusterlet/kustomization.yaml.tmp deploy/prod/klusterlet/kustomization.yaml
deploy-foundation-hub: ensure-kustomize
cp deploy/foundation/hub/kustomization.yaml deploy/foundation/hub/kustomization.yaml.tmp
cd deploy/foundation/hub && ../../../$(KUSTOMIZE) edit set image acm-controller=$(FOUNDATION_IMAGE_NAME)
cd deploy/foundation/hub && ../../../$(KUSTOMIZE) edit set image acm-proxyserver=$(FOUNDATION_IMAGE_NAME)
$(KUSTOMIZE) build deploy/foundation/hub | $(KUBECTL) apply -f -
mv deploy/foundation/hub/kustomization.yaml.tmp deploy/foundation/hub/kustomization.yaml

deploy-foundation-agent: ensure-kustomize
cp deploy/foundation/klusterlet/kustomization.yaml deploy/foundation/klusterlet/kustomization.yaml.tmp
cd deploy/foundation/klusterlet && ../../../$(KUSTOMIZE) edit set image acm-agent=$(FOUNDATION_IMAGE_NAME)
$(KUSTOMIZE) build deploy/foundation/klusterlet | $(KUBECTL) apply -f -
mv deploy/foundation/klusterlet/kustomization.yaml.tmp deploy/foundation/klusterlet/kustomization.yaml

build-e2e:
go test -c ./test/e2e

test-e2e: build-e2e deploy-hub deploy-klusterlet deploy-acm-foundation-hub deploy-acm-foundation-agent
test-e2e: build-e2e deploy-hub deploy-klusterlet deploy-foundation-hub deploy-foundation-agent
./e2e.test -test.v -ginkgo.v

# Generate manifests e.g. CRD, RBAC etc.
manifests: ensure-controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/action/v1beta1" output:crd:artifacts:config=deploy/dev/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/view/v1beta1" output:crd:artifacts:config=deploy/dev/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/cluster/v1alpha1" output:crd:artifacts:config=deploy/dev/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/internal.open-cluster-management.io/v1beta1" output:crd:artifacts:config=deploy/dev/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/inventory/v1alpha1" output:crd:artifacts:config=deploy/dev/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/action/v1beta1" output:crd:artifacts:config=deploy/foundation/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/view/v1beta1" output:crd:artifacts:config=deploy/foundation/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/cluster/v1alpha1" output:crd:artifacts:config=deploy/dev/foundation/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/internal.open-cluster-management.io/v1beta1" output:crd:artifacts:config=deploy/foundation/hub/resources/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/apis/inventory/v1alpha1" output:crd:artifacts:config=deploy/foundation/hub/resources/crds

# Generate code
generate: ensure-controller-gen
Expand Down
51 changes: 2 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,62 +78,15 @@ Need to install ManagedCluster before deploy ACM Foundation.
Deploy hub components

```sh
make deploy-acm-foundation-hub
make deploy-foundation-hub
```

2. Install on managed cluster

Deploy klusterlet components

```sh
make deploy-acm-foundation-agent
```

### Deploy for development environment

You can use `ko` to deploy ACM Foundation with the following step.

Install `ko`, you can use

```sh
go get github.com/google/ko/cmd/ko
```

More information see [ko](https://github.com/google/ko)

> Note:
> * Go version needs >= go1.11.
> * Need `export GO111MODULE=on` if Go version is go1.11 or go1.12.

1. Config `KO_DOCKER_REPO` for deployment tool **ko**

Configure `KO_DOCKER_REPO` by running `gcloud auth configure-docker` if you are using Google Container Registry or `docker login` if you are using Docker Hub.

```sh
export PROJECT_ID=$(gcloud config get-value core/project)
export KO_DOCKER_REPO="gcr.io/${PROJECT_ID}"
```

or

```sh
export KO_DOCKER_REPO=docker.io/<your account>
```

2. Install on hub cluster

Deploy hub components

```sh
ko apply -f deploy/dev/hub/resources --base-import-paths --tags=latest
```

3. Install klusterlet-addon on the hub cluster

Deploy klusterlet components

```sh
ko apply -f deploy/dev/klusterlet/resources --base-import-paths --tags=latest
make deploy-foundation-agent
```

## Security Response
Expand Down
4 changes: 0 additions & 4 deletions deploy/dev/klusterlet/kustomization.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions deploy/dev/klusterlet/resources/100-clusterrole.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions deploy/dev/klusterlet/resources/100-service.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions deploy/dev/klusterlet/resources/200-agent.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@ resources:
- resources/crds/hive.openshift.io_syncsets.yaml
- resources/crds/hive.openshift.io_clusterdeployments.yaml
- resources/crds/hive.openshift.io_syncsetinstances.yaml
- resources/100-clusterrole.yaml
- resources/100-proxyserver-apiservice.yaml
- resources/100-proxyserver-service.yaml
- resources/200-proxyserver.yaml
- resources/200-controller.yaml
- resources/clusterrole.yaml
- resources/proxyserver-apiservice.yaml
- resources/proxyserver-service.yaml
- resources/proxyserver.yaml
- resources/controller.yaml

images:
- name: acm-controller
newName: quay.io/open-cluster-management/multicloud-manager
newTag: latest
- name: acm-proxyserver
newName: quay.io/open-cluster-management/multicloud-manager
newTag: latest
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
serviceAccountName: acm-foundation-sa
containers:
- name: acm-controller
image: ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-controller
image: acm-controller
imagePullPolicy: IfNotPresent
args:
- "/acm-controller"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
serviceAccountName: acm-foundation-sa
containers:
- name: acm-proxyserver
image: ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-proxyserver
image: acm-proxyserver
imagePullPolicy: IfNotPresent
args:
- "/acm-proxyserver"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
resources:
- ../../dev/klusterlet/
- resources/cluster-namespace.yaml
- resources/agent-manifestwork.yaml

images:
- name: ko://github.com/open-cluster-management/multicloud-operators-foundation/cmd/acm-agent
- name: acm-agent
newName: quay.io/open-cluster-management/multicloud-manager
newTag: latest
apiVersion: kustomize.config.k8s.io/v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
secretName: hub-kubeconfig-secret
containers:
- name: acm-agent
image: quay.io/open-cluster-management/multicloud-manager
image: acm-agent
imagePullPolicy: IfNotPresent
args:
- "/acm-agent"
Expand Down
4 changes: 4 additions & 0 deletions deploy/foundation/klusterlet/resources/cluster-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: cluster1
12 changes: 0 additions & 12 deletions deploy/prod/hub/kustomization.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/controllers/autodetect/autodetect_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (

func TestMain(m *testing.M) {
t := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "dev", "hub", "resources", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "foundation", "hub", "resources", "crds")},
}

clusterv1.AddToScheme(cliScheme.Scheme)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/clusterinfo/clusterinfo_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (

func TestMain(m *testing.M) {
t := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "dev", "hub", "resources", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "foundation", "hub", "resources", "crds")},
}

clusterinfov1beta1.AddToScheme(cliScheme.Scheme)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/clusterrole/clusterrole_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (

func TestMain(m *testing.M) {
t := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "dev", "hub", "resources", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "foundation", "hub", "resources", "crds")},
}

clusterv1beta1.AddToScheme(cliScheme.Scheme)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/gc/garbagecollector_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (

func TestMain(m *testing.M) {
t := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "dev", "hub", "resources", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "foundation", "hub", "resources", "crds")},
}

actionv1beta1.AddToScheme(cliScheme.Scheme)
Expand Down
2 changes: 1 addition & 1 deletion pkg/klusterlet/action/action_controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var cfg *rest.Config

func TestMain(m *testing.M) {
t := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "dev", "hub", "resources", "crds")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "deploy", "foundation", "hub", "resources", "crds")},
}

actionv1beta1.AddToScheme(scheme.Scheme)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestE2E(t *testing.T) {
}

const (
eventuallyTimeout = 120
eventuallyTimeout = 300
eventuallyInterval = 2
)

Expand Down

0 comments on commit 1ef856c

Please sign in to comment.