Skip to content

Commit 9e79a31

Browse files
authored
Merge pull request #499 from oracle-devrel/alcampag-2
Moved pre-existent functions in the right section
2 parents 5beaec9 + 8e9af49 commit 9e79a31

File tree

3 files changed

+150
-0
lines changed

3 files changed

+150
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CAPOCI installation
2+
This project includes a simplified procedure to deploy and use Cluster API inside any
3+
OKE cluster.
4+
The only prerequisite is to have an Oracle Cloud tenancy with an OKE cluster already
5+
provisioned and accessible.
6+
7+
1. Create a dynamic group for the OKE cluster. As an example, we will call the
8+
dynamic group my-oke-cluster:
9+
` instance.compartment.id = 'OKE_COMPARTMENT_ID' `
10+
2. Create the following policies:
11+
```
12+
Allow dynamic-group <oke-dynamic-group> to manage instance-family in compartment <compartment name>
13+
Allow dynamic-group <oke-dynamic-group> to manage virtual-network-family in compartment <compartment name>
14+
Allow dynamic-group <oke-dynamic-group> to manage cluster-family in compartment <compartment name>
15+
```
16+
3. Open the Cloud Shell, upload the install.sh script and execute it. Be sure that your
17+
Kubeconfig file is correctly configured and in the right context.
18+
4. To provision another OKE cluster, substitute the variable in oke-capoci.yaml and
19+
apply it to the cluster.
20+
5. See the creation of the OKE cluster and the Node Pool.
21+
22+
NOTE: The cluster deployed here is very simple, but you can actually configure it in
23+
every aspect, you can configure the network and even create Virtual Node clusters!
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
: '
2+
Copyright (c) 2021 Oracle and/or its affiliates.
3+
4+
The Universal Permissive License (UPL), Version 1.0
5+
6+
Subject to the condition set forth below, permission is hereby granted to any
7+
person obtaining a copy of this software, associated documentation and/or data
8+
(collectively the "Software"), free of charge and under any and all copyright
9+
rights in the Software, and any and all patent rights owned or freely
10+
licensable by each licensor hereunder covering either (i) the unmodified
11+
Software as contributed to or provided by such licensor, or (ii) the Larger
12+
Works (as defined below), to deal in both
13+
14+
(a) the Software, and
15+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
one is included with the Software (each a "Larger Work" to which the Software
17+
is contributed by such licensors),
18+
19+
without restriction, including without limitation the rights to copy, create
20+
derivative works of, display, perform, and distribute the Software and make,
21+
use, sell, offer for sale, import, export, have made, and have sold the
22+
Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
either these or other terms.
24+
25+
This license is subject to the following condition:
26+
The above copyright notice and either this complete permission notice or at
27+
a minimum a reference to the UPL must be included in all copies or
28+
substantial portions of the Software.
29+
30+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
SOFTWARE.
37+
'
38+
39+
#!/bin/bash
40+
41+
# Be sure that the following policies are in place for the OKE instance principal:
42+
# Allow dynamic-group <oke-dynamic-group> to manage instance-family in compartment <compartment name>
43+
# Allow dynamic-group <oke-dynamic-group> to manage virtual-network-family in compartment <compartment name>
44+
# Allow dynamic-group <oke-dynamic-group> to manage cluster-family in compartment <compartment name>
45+
46+
# Modify url to change ClusterAPI version to be installed
47+
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.1/clusterctl-linux-amd64 -o clusterctl
48+
49+
export USE_INSTANCE_PRINCIPAL="true"
50+
export USE_INSTANCE_PRINCIPAL_B64="$(echo -n "$USE_INSTANCE_PRINCIPAL" | base64 | tr -d '\n')"
51+
export EXP_CLUSTER_RESOURCE_SET="true"
52+
export EXP_MACHINE_POOL="true"
53+
export EXP_OKE="true"
54+
55+
chmod +x clusterctl
56+
./clusterctl init --infrastructure oci --wait-providers
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: Cluster
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/cluster-name: "oke-capoci"
6+
name: "oke-capoci"
7+
namespace: "default"
8+
spec:
9+
infrastructureRef:
10+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
11+
kind: OCIManagedCluster
12+
name: "oke-capoci"
13+
namespace: "default"
14+
controlPlaneRef:
15+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
16+
kind: OCIManagedControlPlane
17+
name: "oke-capoci"
18+
namespace: "default"
19+
---
20+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
21+
kind: OCIManagedCluster
22+
metadata:
23+
labels:
24+
cluster.x-k8s.io/cluster-name: "oke-capoci"
25+
name: "oke-capoci"
26+
spec:
27+
compartmentId: "${OKE_COMPARTMENT_ID}"
28+
region: "${OKE_REGION}"
29+
---
30+
kind: OCIManagedControlPlane
31+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
32+
metadata:
33+
name: "oke-capoci"
34+
namespace: "default"
35+
spec:
36+
version: "v1.27.2"
37+
---
38+
apiVersion: cluster.x-k8s.io/v1beta1
39+
kind: MachinePool
40+
metadata:
41+
name: "oke-capoci-mp-0"
42+
namespace: default
43+
annotations:
44+
"cluster.x-k8s.io/replicas-managed-by": ""
45+
spec:
46+
clusterName: "oke-capoci"
47+
replicas: 1
48+
template:
49+
spec:
50+
clusterName: "oke-capoci"
51+
bootstrap:
52+
dataSecretName: ""
53+
infrastructureRef:
54+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
55+
kind: OCIManagedMachinePool
56+
name: "oke-capoci-mp-0"
57+
version: "v1.27.2"
58+
---
59+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
60+
kind: OCIManagedMachinePool
61+
metadata:
62+
name: "oke-capoci-mp-0"
63+
namespace: default
64+
spec:
65+
version: "v1.27.2"
66+
nodeShape: "VM.Standard.E4.Flex"
67+
nodeSourceViaImage:
68+
imageId: "" # specify in production
69+
bootVolumeSizeInGBs: 50
70+
nodeShapeConfig:
71+
ocpus: "1"

0 commit comments

Comments
 (0)