作者 tangxuhui
apiVersion: v1
kind: Service
metadata:
name: allied-creation-user
namespace: mmm-suplus-preonline
labels:
k8s-app: allied-creation-user
spec:
ports:
- name: "http"
port: 80
targetPort: 8082
selector:
k8s-app: allied-creation-user
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: allied-creation-user
namespace: mmm-suplus-preonline
labels:
k8s-app: allied-creation-user
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: allied-creation-user
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference: {}
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cn-hangzhou.i-bp1djh1xn7taumbue1ze
- cn-hangzhou.i-bp1djh1xn7taumbue1zd
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: allied-creation-user
image: 192.168.0.243:5000/mmm/allied-creation-user:preonline
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: REDIS_AUTH
value: ""
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ENABLE_KAFKA_LOG
value: "true"
- name: HTTP_PORT
value: "8082"
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: SERVICE_ENV
value: "pre"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-preonline get pods | grep -q allied-creation-user
if [ "$?" == "1" ];then
kubectl create -f /tmp/preonline/allied-creation-user/allied-creation-user.yaml --record
kubectl -n mmm-suplus-preonline get svc | grep -q allied-creation-user
if [ "$?" == "0" ];then
echo "allied-creation-user service install success!"
else
echo "allied-creation-user service install fail!"
fi
kubectl -n mmm-suplus-preonline get pods | grep -q allied-creation-user
if [ "$?" == "0" ];then
echo "allied-creation-user deployment install success!"
else
echo "allied-creation-user deployment install fail!"
fi
else
kubectl delete -f /tmp/preonline/allied-creation-user/allied-creation-user.yaml
kubectl -n mmm-suplus-preonline get svc | grep -q allied-creation-user
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-preonline get svc | grep -q allied-creation-user
done
kubectl -n mmm-suplus-preonline get pods | grep -q allied-creation-user
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-preonline get pods | grep -q allied-creation-user
done
kubectl create -f /tmp/preonline/allied-creation-user/allied-creation-user.yaml --record
kubectl -n mmm-suplus-preonline get svc | grep -q allied-creation-user
if [ "$?" == "0" ];then
echo "allied-creation-user service update success!"
else
echo "allied-creation-user service update fail!"
fi
kubectl -n mmm-suplus-preonline get pods | grep -q allied-creation-user
if [ "$?" == "0" ];then
echo "allied-creation-user deployment update success!"
else
echo "allied-creation-user deployment update fail!"
fi
fi
\ No newline at end of file
... ...
... ... @@ -16,7 +16,7 @@ type ListOrgQuery struct {
// 查询限制
Limit int `cname:"查询限制" json:"limit,omitempty"`
// 企业id
CompanyId int64 `cname:"企业id" json:"companyId" valid:"Required"`
CompanyId int64 `cname:"企业id" json:"companyId"`
// 组织编码
OrgCode string `cname:"组织编码" json:"orgCode,omitempty"`
// 部门名称
... ...
... ... @@ -176,7 +176,7 @@ func (orgService *OrgService) GetOrgSubDepartment(getOrgSubDepartmentQuery *quer
if err != nil {
return nil, err
}
_, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId})
_, orgs, err := orgRepository.Find(map[string]interface{}{"companyId": org.CompanyId, "limit": 1000})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...