-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f03257f
Showing
12 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
KEYSTONE_IMG=quay.io/openstack-k8s-operators/keystone-operator-index:latest | ||
MARIADB_IMG=quay.io/openstack-k8s-operators/mariadb-operator-index:latest | ||
|
||
all: keystone mariadb | ||
|
||
crc_init: | ||
bash scripts/create-pv.sh | ||
bash scripts/gen-crc-pv-kustomize.sh | ||
oc kustomize out/crc | oc apply -f - | ||
|
||
# KEYSTONE | ||
out/keystone/subscription.yaml: | ||
bash scripts/gen-olm.sh keystone ${KEYSTONE_IMG} | ||
|
||
.PHONY: keystone | ||
keystone: out/keystone/subscription.yaml | ||
oc apply -f out/keystone | ||
|
||
.PHONY: keystone_cleanup | ||
keystone_cleanup: | ||
oc delete -n openstack csv keystone-operator.v0.0.1 || true | ||
oc delete -n openstack subscription keystone-operator || true | ||
oc delete -n openstack catalogsource keystone-operator-index || true | ||
rm -Rf out/keystone | ||
|
||
# MARIADB | ||
out/mariadb/subscription.yaml: | ||
bash scripts/gen-olm.sh mariadb ${MARIADB_IMG} | ||
|
||
.PHONY: mariadb | ||
mariadb: out/mariadb/subscription.yaml | ||
oc apply -f out/mariadb | ||
|
||
.PHONY: mariadb_cleanup | ||
mariadb_cleanup: | ||
oc delete -n openstack csv mariadb-operator.v0.0.1 || true | ||
oc delete -n openstack subscription mariadb-operator || true | ||
oc delete -n openstack catalogsource mariadb-operator-index || true | ||
rm -Rf out/mariadb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# k8s yaml generator/installer for Cloud Native OpenStack | ||
|
||
Scripts to automate Installing OpenStack in your *pre-installed* OpenShift environment. | ||
|
||
Aside from generating Yaml and running *oc* commands to apply them to your cluster nothing in this repo should modify the local machine, require sudo, or make any changes to the local environment. | ||
|
||
## Goals | ||
|
||
1) WIP: Support installing individual operators for fast testing iteration | ||
|
||
2) TODO: Support installing the combined Openstack umbrella operator | ||
|
||
### Example using your preinstalled CRC (Code Ready Containers) Environment | ||
### Similar commands should work in any OCP environment though. | ||
```bash | ||
# set your CRC ENV variables and PATH for 'oc' | ||
eval $(crc oc-env) | ||
|
||
# one time operation to initialize PVs within the CRC VM | ||
make crc_init | ||
|
||
# Install MariaDB Operator using OLM (defaults to quay.io/openstack-k8s-operators) | ||
make mariadb MARIADB_IMG=quay.io/openstack-k8s-operators/mariadb-operator-index:latest | ||
|
||
# Install Keystone Operator using OLM (defaults to quay.io/openstack-k8s-operators) | ||
make keystone KEYSTONE_IMG=quay.io/openstack-k8s-operators/keystone-operator-index:latest | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- storage.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: local-storage | ||
provisioner: kubernetes.io/no-provisioner | ||
volumeBindingMode: WaitForFirstConsumer | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage001 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv001" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage002 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv002" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage003 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv003" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage004 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv004" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage005 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv005" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: local-storage006 | ||
spec: | ||
storageClassName: local-storage | ||
capacity: | ||
storage: 500M | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
local: | ||
path: "/mnt/openstack/pv006" | ||
type: DirectoryOrCreate | ||
volumeMode: Filesystem | ||
nodeAffinity: | ||
required: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: CatalogSource | ||
metadata: | ||
name: osp-director-operator-index | ||
namespace: openstack | ||
spec: | ||
sourceType: grpc | ||
image: operator-index:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resources: | ||
- operatorgroup.yaml | ||
- catalogsource.yaml | ||
- subscription.yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: operator-name | ||
namespace: openstack | ||
spec: | ||
config: | ||
env: | ||
- name: WATCH_NAMESPACE | ||
value: openstack | ||
source: operator-index | ||
sourceNamespace: openstack | ||
name: operator-name | ||
# to install a specific version | ||
# installPlanApproval: Manual | ||
# startingCSV: operator.vX.X.X | ||
channel: alpha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
oc delete -n default pv local-storage001 | ||
oc delete -n default pv local-storage002 | ||
oc delete -n default pv local-storage003 | ||
oc delete -n default pv local-storage004 | ||
oc delete -n default storageclass local-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
NODE_NAME=$(oc get node -o name) | ||
if [ -z "$NODE_NAME" ]; then | ||
echo "Unable to determine node name with 'oc' command." | ||
exit 1 | ||
fi | ||
oc debug $NODE_NAME -T -- chroot /host /usr/bin/bash -c "for i in {0..5}; do echo \"creating dir /mnt/openstack/pv00\$i\"; mkdir -p /mnt/openstack/pv00\$i; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -d out ]; then | ||
mkdir -p out/crc | ||
fi | ||
|
||
NODE_NAME=$(oc get node -o name) | ||
if [ -z "$NODE_NAME" ]; then | ||
echo "Unable to determine node name with 'oc' command." | ||
exit 1 | ||
fi | ||
|
||
cat > out/crc/kustomization.yaml <<EOF_CAT | ||
resources: | ||
- ../../crc | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /spec/nodeAffinity/required/nodeSelectorTerms/0/matchExpressions/0/values/0 | ||
value: $NODE_NAME | ||
target: | ||
kind: PersistentVolume | ||
EOF_CAT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
OPERATOR_NAME=$1 | ||
IMAGE=$2 | ||
if [ -z "$OPERATOR_NAME" ]; then | ||
echo "Please set OPERATOR_NAME as ARG1"; exit 1 | ||
fi | ||
if [ -z "$IMAGE" ]; then | ||
echo "Please set IMAGE as ARG2"; exit 1 | ||
fi | ||
|
||
if [ ! -d out/$OPERATOR_NAME ]; then | ||
mkdir -p out/$OPERATOR_NAME | ||
fi | ||
|
||
# can share this for all the operators, won't get re-applied if it already exists | ||
cat > out/$OPERATOR_NAME/operatorgroup.yaml <<EOF_CAT | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: openstack | ||
namespace: openstack | ||
spec: | ||
targetNamespaces: | ||
- openstack | ||
EOF_CAT | ||
|
||
cat > out/$OPERATOR_NAME/catalogsource.yaml <<EOF_CAT | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: CatalogSource | ||
metadata: | ||
name: $OPERATOR_NAME-operator-index | ||
namespace: openstack | ||
spec: | ||
image: $IMAGE | ||
sourceType: grpc | ||
EOF_CAT | ||
|
||
cat > out/$OPERATOR_NAME/subscription.yaml <<EOF_CAT | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: $OPERATOR_NAME-operator | ||
namespace: openstack | ||
spec: | ||
name: $OPERATOR_NAME-operator | ||
channel: alpha | ||
config: | ||
env: | ||
- name: WATCH_NAMESPACE | ||
value: openstack | ||
source: $OPERATOR_NAME-operator-index | ||
sourceNamespace: openstack | ||
EOF_CAT |