Skip to content

Commit

Permalink
Refactored, added features and updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Jul 11, 2022
1 parent 5a5d92a commit d259b87
Show file tree
Hide file tree
Showing 51 changed files with 2,494 additions and 2,137 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#
# K2HR3 K2HR3 Utilities
#
# Copyright 2020 Yahoo! Japan Corporation.
#
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
# common management information for the cloud.
# K2HR3 can dynamically manage information as "who", "what", "operate".
# These are stored as roles, resources, policies in K2hdkc, and the
# client system can dynamically read and modify these information.
#
# For the full copyright and license information, please view
# the licenses file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Thu, 14 Nov 2019
# REVISION:
#

# Logs
logs
*.log
Expand Down Expand Up @@ -59,3 +78,12 @@ typings/

# next.js build output
.next

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# syntax=docker/dockerfile:1
#
# K2HR3 K2HR3 Utilities
#
# Copyright 2020 Yahoo! Japan Corporation.
#
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
# common management information for the cloud.
# K2HR3 can dynamically manage information as "who", "what", "operate".
# These are stored as roles, resources, policies in K2hdkc, and the
# client system can dynamically read and modify these information.
#
# For the full copyright and license information, please view
# the licenses file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Thu, 14 Nov 2019
# REVISION:
#

# [See]
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
# https://docs.docker.com/develop/develop-images/multistage-build/

FROM python:3.6-alpine as build

RUN apk --update --no-cache add build-base libffi-dev openssl-dev
RUN pip3 install --upgrade pip
RUN pip3 install --prefix=/install ansible

FROM python:3.6-alpine

LABEL maintainer="[email protected]"

RUN mkdir /lib64 \
&& ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 \
&& apk --update --no-cache add git curl openssh-client rsync bash

COPY --from=build /install /usr/local

WORKDIR /ansible

CMD [ "ansible-playbook", "--version" ]

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
9 changes: 9 additions & 0 deletions ansible/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,12 @@ EOF
fi
exit 0
#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
8 changes: 4 additions & 4 deletions devcluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ Here are summary of installation procedures:
5. Installs binary packages
k2hr3_dkc needs the k2htpdtor, libfullock, k2hash, chmpx and k2hdkc.
6. Configures the chmpx default configuratoin
The default server.ini contains dummy server name. You need to change it.
The default k2hdkc.ini contains dummy server name. You need to change it.
7. Installs the configured chmpx config file
k2hr3_dkc uses a configuration file(for instance /etc/k2hdkc/server.ini) for [chmpx](https://github.com/yahoojapan/chmpx).
k2hr3_dkc uses a configuration file(for instance /etc/antpickax/k2hdkc.ini) for [chmpx](https://github.com/yahoojapan/chmpx).
8. Configures the chmpx's service manager default configuration
We recommend [chmpx](https://github.com/yahoojapan/chmpx) processes work as a service by [systemd](https://freedesktop.org/wiki/Software/systemd/).
9. Installs the chmpx service manager configuration and enables it
Expand Down Expand Up @@ -194,9 +194,9 @@ Here are summary of installation procedures:
5. Installs binary packages
k2hr3_api needs the nodejs, k2htpdtor, libfullock, k2hash, chmpx and k2hdkc.
6. Configures the chmpx slave default configuration
The default slave.ini contains dummy server name. You need to change it.
The default chmpx.ini contains dummy server name. You need to change it.
7. Installs the configured chmpx slave config file
k2hr3_api uses a configuration file(for instance /etc/k2hdkc/slave.ini) for [chmpx](https://github.com/yahoojapan/chmpx).
k2hr3_api uses a configuration file(for instance /etc/k2hdkc/chmpx.ini) for [chmpx](https://github.com/yahoojapan/chmpx).
8. Configures the chmpx slave's service manager default configuration
We recommend [chmpx](https://github.com/yahoojapan/chmpx) process works as a service by [systemd](https://freedesktop.org/wiki/Software/systemd/).
9. Configures the chmpx slave's service manager default configuration
Expand Down
34 changes: 22 additions & 12 deletions devcluster/api/local-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* CREATE: Tue Nov 12 2019
* REVISION:
*/

//
// This program generates a local.json of k2hr3-api from a k2hr3-utils setup.ini
//
Expand All @@ -27,21 +28,30 @@ const srcdir = path.resolve(__dirname);
const process = require('process');

if ( process.argv.length != 4) {
let err = "Usage: node " + process.argv[1] + " <path to setup.ini> <path to local.json>";
console.error(err);
throw new Error(err);
let err = "Usage: node " + process.argv[1] + " <path to setup.ini> <path to local.json>";
console.error(err);
throw new Error(err);
}
const input = process.argv[2];
const output = process.argv[3];
try {
let rci = require(path.join(srcdir, 'r3clusterini.js'));
let raj = require(path.join(srcdir, 'r3apijson.js'));
let cluster = new rci.R3clusterIni(input, 'k2hr3_api');
let r3api= new raj.R3apiJson();
for (const val of cluster) {
r3api.configure(val[0], val[1]); // key, value
}
r3api.dumpTo(output);
let rci = require(path.join(srcdir, 'r3clusterini.js'));
let raj = require(path.join(srcdir, 'r3apijson.js'));
let cluster = new rci.R3clusterIni(input, 'k2hr3_api');
let r3api= new raj.R3apiJson();
for (const val of cluster) {
r3api.configure(val[0], val[1]); // key, value
}
r3api.dumpTo(output);
} catch (err) {
console.error(err.name + ' ' + err.message);
console.error(err.name + ' ' + err.message);
}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noexpandtab sw=4 ts=4 fdm=marker
* vim<600: noexpandtab sw=4 ts=4
*/
29 changes: 28 additions & 1 deletion devcluster/api/local_api.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* K2HR3 Utils
*
* Copyright 2019 Yahoo! Japan Corporation.
*
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
* common management information for the cloud.
* K2HR3 can dynamically manage information as "who", "what", "operate".
* These are stored as roles, resources, policies in K2hdkc, and the
* client system can dynamically read and modify these information.
*
* For the full copyright and license information, please view
* the license file that was distributed with this source code.
*
* AUTHOR: Hirotaka Wakabayashi
* CREATE: Tue Nov 12 2019
* REVISION:
*/

{
"keystone": {
"type": "openstackapiv3",
Expand Down Expand Up @@ -51,8 +70,16 @@
"allowcredauth": true,

"k2hdkc": {
"config": "/etc/antpickax/slave.ini",
"config": "/etc/antpickax/chmpx.ini",
"port": 8031
}
}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noexpandtab sw=4 ts=4 fdm=marker
* vim<600: noexpandtab sw=4 ts=4
*/
Loading

0 comments on commit d259b87

Please sign in to comment.