Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: Iafe4120bd5ef05210930f78144754a5da17ed633
-apt-get update && apt-get install ssh -y
+apk add --no-cache openssh
if [ -z "${HELM_USER_PASSWD}" ];
then
HELM_USER_PASSWD=St8rlingX*
fi
if [ -z "${HELM_USER_PASSWD}" ];
then
HELM_USER_PASSWD=St8rlingX*
fi
-useradd helm
-passwd helm << EOF
${HELM_USER_PASSWD}
${HELM_USER_PASSWD}
EOF
${HELM_USER_PASSWD}
${HELM_USER_PASSWD}
EOF
-service ssh restart
-
-tail -f /dev/null
\ No newline at end of file
+ssh-keygen -A
+exec /usr/sbin/sshd -D -e "$@"
\ No newline at end of file
volumeMounts:
- name: scripts
mountPath: /opt
volumeMounts:
- name: scripts
mountPath: /opt
- # - name: configs
- # mountPath: /configs
+ {{- if .Values.o2dms.helm_cli_enable }}
+ - name: share
+ mountPath: /share
+ {{- end }}
- name: applicationconfig
mountPath: /configs/o2app.conf
subPath: config.json
- name: applicationconfig
mountPath: /configs/o2app.conf
subPath: config.json
volumeMounts:
- name: scripts
mountPath: /opt
volumeMounts:
- name: scripts
mountPath: /opt
+ - name: share
+ mountPath: /share
{{- end }}
volumes:
- name: scripts
configMap:
name: {{ .Chart.Name }}-scripts-configmap
{{- end }}
volumes:
- name: scripts
configMap:
name: {{ .Chart.Name }}-scripts-configmap
- # - name: configs
- # emptyDir: {}
+ {{- if .Values.o2dms.helm_cli_enable }}
+ - name: share
+ emptyDir: {}
+ {{- end }}
- configMap:
name: {{ .Chart.Name }}-application-config
name: applicationconfig
- configMap:
name: {{ .Chart.Name }}-application-config
name: applicationconfig
- /bin/sh
- /tests/o2app-redis-entry.sh
- /bin/sh
- /tests/o2app-redis-entry.sh
- helm_cli:
- image: o2imsdms
- depends_on:
- - watcher
- environment:
- - LOGGING_CONFIG_LEVEL=DEBUG
- - HELM_USER_PASSWD=St8rlingX*
- volumes:
- - ./configs:/configs
- - ./helm_sdk:/helm_sdk
- - ./tests:/tests
- entrypoint:
- - /bin/sh
- - /tests/o2app-helmcli-entry.sh
- ports:
- - "10022:22"
+ # helm_cli:
+ # image: o2imsdms
+ # depends_on:
+ # - watcher
+ # environment:
+ # - LOGGING_CONFIG_LEVEL=DEBUG
+ # - HELM_USER_PASSWD=St8rlingX*
+ # volumes:
+ # - ./share:/share
+ # - ./helm_sdk:/helm_sdk
+ # - ./tests:/tests
+ # entrypoint:
+ # - /bin/sh
+ # - /tests/o2app-helmcli-entry.sh
+ # ports:
+ # - "10022:22"
- HELM_USER_PASSWD=St8rlingX*
volumes:
- ./configs:/configs
- HELM_USER_PASSWD=St8rlingX*
volumes:
- ./configs:/configs
- ./o2ims:/o2ims
- ./o2dms:/o2dms
- ./o2common:/o2common
- ./o2ims:/o2ims
- ./o2dms:/o2dms
- ./o2common:/o2common
return '/usr/local/bin/helm'
return '/usr/local/bin/helm'
+def get_containers_shared_folder():
+ return '/share'
+
+
def get_system_controller_as_respool():
return True
def get_system_controller_as_respool():
return True
def get_dms_support_profiles():
def get_dms_support_profiles():
- profiles = config.conf.API.DMS_SUPPORT_PROFILES
- if profiles is None or profiles == '':
- profiles = []
- elif "[" in profiles and "]" in profiles:
- profiles = profiles.replace("'", "").replace(
- '"', "").replace('[', "").replace(']', "")
- profiles = profiles.split(',')
- if 'native_k8sapi' not in profiles:
- profiles.append('native_k8sapi')
- return profiles
+ profiles_list = []
+ profiles_str = config.conf.API.DMS_SUPPORT_PROFILES
+ if profiles_str:
+ profiles_strip = profiles_str.strip(' []')
+ profiles_str = profiles_strip.replace("'", "").replace(
+ '"', "")
+ profiles_list = profiles_str.split(',')
+ if 'native_k8sapi' not in profiles_list:
+ profiles_list.append('native_k8sapi')
+ return profiles_list
def _gen_kube_config(dmId: str, kubeconfig: dict) -> dict:
def _gen_kube_config(dmId: str, kubeconfig: dict) -> dict:
+ shared_folder = config.get_containers_shared_folder()
data = config.gen_k8s_config_dict(
kubeconfig.pop('cluster_api_endpoint', None),
data = config.gen_k8s_config_dict(
kubeconfig.pop('cluster_api_endpoint', None),
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
tmp_file_name = 'kubeconfig_' + name_key + "_" + current_time
kube_config_name = 'kubeconfig_' + name_key + '.config'
current_time = datetime.now().strftime("%Y%m%d%H%M%S")
tmp_file_name = 'kubeconfig_' + name_key + "_" + current_time
kube_config_name = 'kubeconfig_' + name_key + '.config'
+ kube_config_path = f'{shared_folder}/{kube_config_name}'
# write down the yaml file of kubectl into tmp folder
with open('/tmp/' + tmp_file_name, 'w') as file:
# write down the yaml file of kubectl into tmp folder
with open('/tmp/' + tmp_file_name, 'w') as file:
# generate the kube config file if not exist or update the file if it
# changes
# generate the kube config file if not exist or update the file if it
# changes
- if not os.path.exists('/configs/' + kube_config_name) or not \
- filecmp.cmp('/tmp/'+tmp_file_name, '/configs/'+kube_config_name):
+ if not os.path.exists(kube_config_path) or not \
+ filecmp.cmp('/tmp/'+tmp_file_name, kube_config_path):
shutil.move(os.path.join('/tmp', tmp_file_name),
shutil.move(os.path.join('/tmp', tmp_file_name),
- os.path.join('/configs', kube_config_name))
+ os.path.join(shared_folder, kube_config_name))
- return '/configs/'+kube_config_name
+ return kube_config_path
def subscriptions(uow: unit_of_work.AbstractUnitOfWork, **kwargs):
def subscriptions(uow: unit_of_work.AbstractUnitOfWork, **kwargs):
-apt-get update && apt-get install ssh -y
+apk add --no-cache openssh
if [ -z "${HELM_USER_PASSWD}" ];
then
if [ -z "${HELM_USER_PASSWD}" ];
then
- HELM_USER_PASSWD=St8rlingX
+ HELM_USER_PASSWD=St8rlingX*
-useradd helm
-passwd helm << EOF
${HELM_USER_PASSWD}
${HELM_USER_PASSWD}
EOF
${HELM_USER_PASSWD}
${HELM_USER_PASSWD}
EOF
-service ssh restart
-
-tail -f /dev/null
\ No newline at end of file
+ssh-keygen -A
+exec /usr/sbin/sshd -D -e "$@"
\ No newline at end of file