From 97501c44602ebeef778937c051a78febbd51ca9a Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Sun, 3 May 2020 14:20:00 -0400 Subject: [PATCH] Added basic keystone support Change-Id: Ib1b143438053cb43c071bc4d4db3a6c6fc923e98 --- .dockerignore | 3 + .../identity.openstack.org_keystones.yaml | 24 ++++ chart/templates/clusterrole.yaml | 2 + chart/templates/deployment.yaml | 2 + .../samples/identity_v1alpha1_keystone.yaml | 7 ++ .../infrastructure_v1alpha1_memcached.yaml | 2 +- devstack/override-defaults | 106 ++++++++++++++++++ images/keystone/Dockerfile | 28 +++++ images/keystone/bindep.txt | 3 + openstack_operator/keystone.py | 37 ++++++ .../templates/keystone/deployment.yml.j2 | 74 ++++++++++++ .../templates/keystone/service.yml.j2 | 28 +++++ playbooks/functional/devstack.yaml | 2 +- playbooks/functional/tests/memcached.yaml | 4 +- zuul.d/functional-jobs.yaml | 24 ++-- zuul.d/horizon-jobs.yaml | 4 + zuul.d/keystone-jobs.yaml | 35 ++++++ 17 files changed, 371 insertions(+), 14 deletions(-) create mode 100644 .dockerignore create mode 100644 chart/crds/identity.openstack.org_keystones.yaml create mode 100644 config/samples/identity_v1alpha1_keystone.yaml create mode 100644 images/keystone/Dockerfile create mode 100644 images/keystone/bindep.txt create mode 100644 openstack_operator/keystone.py create mode 100644 openstack_operator/templates/keystone/deployment.yml.j2 create mode 100644 openstack_operator/templates/keystone/service.yml.j2 create mode 100644 zuul.d/keystone-jobs.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a0adc5c6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.eggs +.stestr +.tox diff --git a/chart/crds/identity.openstack.org_keystones.yaml b/chart/crds/identity.openstack.org_keystones.yaml new file mode 100644 index 00000000..0fc6cca5 --- /dev/null +++ b/chart/crds/identity.openstack.org_keystones.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: keystones.identity.openstack.org +spec: + group: identity.openstack.org + names: + kind: Keystone + listKind: KeystoneList + plural: keystones + singular: keystone + scope: Namespaced + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/chart/templates/clusterrole.yaml b/chart/templates/clusterrole.yaml index 0e70bb93..89da1440 100644 --- a/chart/templates/clusterrole.yaml +++ b/chart/templates/clusterrole.yaml @@ -113,6 +113,7 @@ rules: - identity.openstack.org resources: - services + - keystones verbs: - create - delete @@ -125,6 +126,7 @@ rules: - identity.openstack.org resources: - services/status + - keystones/status verbs: - get - patch diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index adc30a43..2c2e9ad9 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -31,6 +31,8 @@ spec: - -m - openstack_operator.horizon - -m + - openstack_operator.keystone + - -m - openstack_operator.mcrouter - -m - openstack_operator.memcached diff --git a/config/samples/identity_v1alpha1_keystone.yaml b/config/samples/identity_v1alpha1_keystone.yaml new file mode 100644 index 00000000..a9b3c4a9 --- /dev/null +++ b/config/samples/identity_v1alpha1_keystone.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: identity.openstack.org/v1alpha1 +kind: Keystone +metadata: + name: sample +spec: + configDir: /etc/keystone diff --git a/config/samples/infrastructure_v1alpha1_memcached.yaml b/config/samples/infrastructure_v1alpha1_memcached.yaml index 086a6f1d..05f89e10 100644 --- a/config/samples/infrastructure_v1alpha1_memcached.yaml +++ b/config/samples/infrastructure_v1alpha1_memcached.yaml @@ -1,7 +1,7 @@ apiVersion: infrastructure.vexxhost.cloud/v1alpha1 kind: Memcached metadata: - name: sample + name: devstack labels: monitoring: haha spec: diff --git a/devstack/override-defaults b/devstack/override-defaults index a7ef98ef..78b9f491 100644 --- a/devstack/override-defaults +++ b/devstack/override-defaults @@ -14,6 +14,29 @@ # License for the specific language governing permissions and limitations # under the License. +function get_kubernetes_service_ip { + local svc="$1" + + for i in {1..30}; do + ip=$(kubectl get svc/$svc -ojsonpath='{.spec.clusterIP}') && break || sleep 1; + done + + return $ip +} + +function proxy_pass_to_kubernetes { + local url=$1 + local svc=$2 + + local ip=$(get_kubernetes_service_ip $svc) + local apache_conf=$(apache_site_config_for $name) + + echo "ProxyPass \"${url}\" \"http://${ip}/\"" | sudo tee -a $apache_conf + + enable_apache_site $name + restart_apache_server +} + # Gets or creates service # Usage: get_or_create_service function get_or_create_service { @@ -29,3 +52,86 @@ spec: EOF } export -f get_or_create_service + +# install_keystone() - Collect source and prepare +function install_keystone { + cat <