Skip to content

Commit

Permalink
Merge pull request #31 from pubudu538/master
Browse files Browse the repository at this point in the history
Adding Operator hub readmes
  • Loading branch information
pubudu538 authored Apr 5, 2020
2 parents c7673d3 + 57e098b commit 6fc7315
Show file tree
Hide file tree
Showing 30 changed files with 574 additions and 335 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. 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.

FROM scratch
COPY wso2am-controller /
ENTRYPOINT ["/wso2am-controller","-logtostderr=true"]
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. 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:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o wso2am-controller ./cmd/controller/
Expand Down
103 changes: 55 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WSO2 API Manager Operator for Kubernetes

With WSO2 API Manager Operator, it makes easy to deploy WSO2 API Manager in Kubernetes through a simple command. Also it supports deploying recommended deployment patterns in Kubernetes. Introducing a new Custom Resource Definition called APIManager to efficiently and easily deploy patterns, and the custom pattern in Kubernetes.
With WSO2 API Manager Operator, it makes easy to deploy WSO2 API Manager in Kubernetes through a simple command. Also it supports deploying recommended deployment patterns in Kubernetes. Introducing a new Custom Resource Definition called APIManager to efficiently and easily deploy patterns, and custom patterns in Kubernetes.

![K8S CRD workflow](docs/images/wso2am-operator.png "K8S CRD workflow")

Expand All @@ -16,64 +16,69 @@ In this document, we will walk through the following.
* Minimum CPU : **4 vCPU**
* Minimum Memory : **6 GB** <br>

**Note:** This is for testing scenario-1.
**Note:** This is for running scenario-1.

* Download [k8s-wso2am-operator-1.0.0.zip](https://github.com/wso2/k8s-wso2am-operator/releases/download/1.0.0/k8s-wso2am-operator-1.0.0.zip) and extract it.
* Download [k8s-wso2am-operator-1.0.0.zip](https://github.com/wso2/k8s-wso2am-operator/releases/download/v1.0.0/k8s-wso2am-operator-1.0.0.zip) and extract it.

This zip contains the artifacts that required to deploy in Kubernetes.

**Note:** You need to run all commands from within the k8s-wso2am-operator-1.0.0 directory.

#### Step 1: Deploy WSO2 API Manager Operator
**Note:** You need to run all commands from within the k8s-wso2am-operator-1.0.0 directory.

<br>

```
kubectl apply -f artifacts/operator-artifacts/ -f artifacts/operator-configs/ -f artifacts/api-manager-artifacts/pattern-1/
#### Step 1: Deploy WSO2 API Manager Operator

Output:
- Creates a namespace called wso2-system and deploy the controller artifacts.

namespace/wso2-system created
serviceaccount/wso2am-pattern-1-svc-account created
...
configmap/wso2am-p1-apim-2-conf created
configmap/wso2am-p1-mysql-dbscripts created
```
```
>> kubectl apply -f artifacts/operator-artifacts/ -f artifacts/operator-configs/ -f artifacts/api-manager-artifacts/pattern-1/
Output:
namespace/wso2-system created
serviceaccount/wso2am-pattern-1-svc-account created
...
configmap/wso2am-p1-apim-2-conf created
configmap/wso2am-p1-mysql-dbscripts created
```
<br>
#### Step 2: Deploy scenario 1 - Single node API Manager
```
kubectl apply -f scenarios/scenario-1/
Output:
- Deploys a single node API Manager.
configmap/apim-conf created
apimanager.apim.wso2.com/custom-pattern-1 created
```
```
>> kubectl apply -f scenarios/scenario-1/
Output:
configmap/apim-conf created
apimanager.apim.wso2.com/custom-pattern-1 created
```
* You can check the status of the API Manager pod and service by using the following commands.
```
kubectl get pods
Output:
NAME READY STATUS RESTARTS AGE
all-in-one-api-manager-d66d6c574-bnwps 0/1 Running 0 2m43s
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.32.1 <none> 443/TCP 6h28m
wso2apim NodePort 10.0.36.136 <none> 8280:32004/TCP,8243:32003/TCP,9763:32002/TCP,9443:32001/TCP 4m32s
```
```
>> kubectl get pods
Output:
NAME READY STATUS RESTARTS AGE
all-in-one-api-manager-d66d6c574-bnwps 0/1 Running 0 2m43s
>> kubectl get svc
Output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.32.1 <none> 443/TCP 6h28m
wso2apim NodePort 10.0.36.136 <none> 8280:32004/TCP,8243:32003/TCP,9763:32002/TCP,9443:32001/TCP 4m32s
```
<br>
#### Step 3: Access API Manager
To access the API Manager, add a host mapping entry to the /etc/hosts file. As we have exposed the API portal service in Node Port type, you can use the IP address of any Kubernetes node.
- To access the API Manager, add a host mapping entry to the /etc/hosts file. As we have exposed the API portal service in Node Port type, you can use the IP address of any Kubernetes node.
```
<Any K8s Node IP> wso2apim
```
```
<Any K8s Node IP> wso2apim
```
- For Docker for Mac use "127.0.0.1" for the K8s node IP
- For Minikube, use minikube ip command to get the K8s node IP
Expand All @@ -83,10 +88,12 @@ To access the API Manager, add a host mapping entry to the /etc/hosts file. As w
```
- This will give the external IPs of the nodes available in the cluster. Pick any IP to include in /etc/hosts file.
- **API Publisher** : https://wso2apim:32001/publisher
- **API Devportal** : https://wso2apim:32001/devportal
- Access URLs
- **API Publisher** : https://wso2apim:32001/publisher
- **API Devportal** : https://wso2apim:32001/devportal
<br>
## Sample Scenarios
1. [Scenario-1 : Deploy A Single API Manager Instance (Custom Pattern)](scenarios/scenario-1)
Expand All @@ -101,11 +108,11 @@ To access the API Manager, add a host mapping entry to the /etc/hosts file. As w
## Clean up
Execute the following command if you wish to clean up the Kubernetes cluster by removing all the applied artifacts and configurations related to WSO2AM Operator.
- Execute the following command if you wish to clean up the Kubernetes cluster by removing all the applied artifacts and configurations related to WSO2AM Operator.
```
kubectl delete -f artifacts/ -R
```
```
>> kubectl delete -f artifacts/ -R
```
### Troubleshooting Guide
Expand Down
2 changes: 1 addition & 1 deletion artifacts/operator-artifacts/6-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ spec:
spec:
containers:
- name: wso2am-controller
image: pubudu/k8s-wso2am-operator:0.8
image: wso2/k8s-wso2am-operator:1.0.0
imagePullPolicy: Always
serviceAccountName: wso2am-pattern-1-svc-account
15 changes: 15 additions & 0 deletions distribution/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@
<outputDirectory>/docs</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
<directory>../artifacts/api-manager-artifacts</directory>
<outputDirectory>/artifacts/operatorhub-controller-configs/</outputDirectory>
</fileSet>
<fileSet>
<directory>../artifacts/operator-artifacts/</directory>
<outputDirectory>/artifacts/operatorhub-controller-configs/</outputDirectory>
<includes>
<include>1-namespace.yaml</include>
</includes>
</fileSet>
<fileSet>
<directory>../artifacts/operator-configs/</directory>
<outputDirectory>/artifacts/operatorhub-controller-configs/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<modelVersion>4.0.0</modelVersion>
<groupId>apim.wso2.com</groupId>
<artifactId>wso2am-k8s-operator-distribution</artifactId>
<artifactId>k8s-wso2am-operator-distribution</artifactId>
<version>1.0.0</version>
<name>K8S WSO2AM Operator Distribution</name>

Expand Down
31 changes: 16 additions & 15 deletions docs/GettingStarted/overview.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
## Overview WSO2AM-K8S-Operator

WSO2 AM K8S Operator provides a fully automated experience for cloud-native API management. A user can deploy the entire WSO2 API Manager based of different patterns into K8S cluster through a simple command.
WSO2 AM K8S Operator provides a fully automated experience for cloud-native API management. A user can deploy WSO2 API Manager different patterns in K8S cluster through a simple command.

For this, WSO2 AM K8S Operator introduced a new custom resource definition(CRD) called **APIManager**

### Custom resource: APIManager
`APIManager` holds API-related information. You can see the APIManager definition and data structure for APIManager here, with cluster name and pattern name. The following YAML shows sample payload for APIManager.

```
apiVersion: apim.wso2.com/v1alpha1
kind: APIManager
metadata:
name: cluster-1
spec:
pattern: Pattern-1
```
The above CRD has corresponding custom controller. Custom controllers are the “brains” behind the custom resources.

- `APIManager` holds API-related information. The following YAML shows the simplest custom resource for deploying APIManager in Kubernetes.

```
apiVersion: apim.wso2.com/v1alpha1
kind: APIManager
metadata:
name: cluster-1
spec:
pattern: Pattern-1
```
- The above CRD has corresponding custom controller. Custom controllers are the “brains” behind the custom resources.
### Custom Controller: wso2am-controller
APIManager controller is quite complex compared to other controllers. It has the main task to Create Kubernetes artifacts and deploy them into Kubernetes cluster.
- APIManager controller is quite complex compared to other controllers. It has the main task to create Kubernetes artifacts and deploy them into Kubernetes cluster.
When the API custom controller is triggered, it will start to create the deployements and services of relevant kubernetes artifacts based on specified pattern, and finally deploys the entire APIManager into K8S cluster.
- When the wso2am controller is triggered, it starts to create the deployments and services of relevant Kubernetes artifacts based on specified pattern, and finally deploys the entire API Manager in Kubernetes cluster.
As you can see, API Controller has taken out all the complexity from DevOps and automates deployment with all the best practices required to deploy APIManager.
- As you can see, wso2am controller has taken out all the complexity from DevOps and automates deployment with all the best practices required to deploy API Manager.
Loading

0 comments on commit 6fc7315

Please sign in to comment.