# set -eux
+JUJU_AGENT_VERSION=2.8.6
K8S_CLOUD_NAME="k8s-cloud"
KUBECTL="microk8s.kubectl"
IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
cat $KUBECFG | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
[ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME \
--config controller-service-type=loadbalancer \
- --agent-version=2.8.1
+ --agent-version=$JUJU_AGENT_VERSION
else
sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
sg ${KUBEGRP} -c "microk8s.enable ingress"
[ ! -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "microk8s.config" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
[ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c \
- "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer --agent-version=2.8.1" \
+ "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer --agent-version=$JUJU_AGENT_VERSION" \
&& K8S_CLOUD_NAME=microk8s
fi
value: mongo
- name: OSMPLA_MESSAGE_HOST
value: kafka
+ - name: OSMPLA_DATABASE_URI
+ value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
volumeMounts:
- name: osm-packages
mountPath: /app/storage
initContainers:
- name: kafka-ro-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 ro 9090 && nc -zvw1 mongo 27017 ); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 ro 9090 && nc -zvw1 mongodb-k8s 27017 ); do sleep 3; done; exit 0"]
containers:
- name: lcm
image: opensourcemano/lcm:8
env:
- name: OSMLCM_RO_HOST
value: ro
- - name: OSMLCM_DATABASE_HOST
- value: mongo
+ - name: OSMLCM_DATABASE_URI
+ value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
- name: OSMLCM_MESSAGE_HOST
value: kafka
envFrom:
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongo 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
containers:
- name: mon
image: opensourcemano/mon:8
value: kafka
- name: OSMMON_MESSAGE_PORT
value: "9092"
+ - name: OSMMON_DATABASE_URI
+ value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
envFrom:
- secretRef:
name: mon-secret
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongo 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
containers:
- name: nbi
image: opensourcemano/nbi:8
- containerPort: 9999
protocol: TCP
env:
- - name: OSMNBI_DATABASE_HOST
- value: mongo
+ - name: OSMNBI_DATABASE_URI
+ value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
- name: OSMNBI_MESSAGE_HOST
value: kafka
envFrom:
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongo 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
containers:
- name: pol
image: opensourcemano/pol:8
value: kafka
- name: OSMPOL_MESSAGE_PORT
value: "9092"
+ - name: OSMPOL_DATABASE_URI
+ value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
envFrom:
- secretRef:
name: pol-secret
function generate_k8s_manifest_files() {
#Kubernetes resources
$WORKDIR_SUDO cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR
+ $WORKDIR_SUDO rm -f $OSM_K8S_WORK_DIR/mongo.yaml
if [ -n "$NGUI" ]; then
$WORKDIR_SUDO rm -f $OSM_K8S_WORK_DIR/light-ui.yaml
else
kubectl apply -n $OSM_STACK_NAME -f $OSM_K8S_WORK_DIR
}
+#deploy charmed services
+function deploy_charmed_services() {
+ juju add-model $OSM_STACK_NAME $OSM_VCA_K8S_CLOUDNAME
+ # deploy mongodb charm
+ namespace=$OSM_STACK_NAME
+ juju deploy cs:~charmed-osm/mongodb-k8s \
+ --config enable-sidecar=true \
+ --config replica-set=rs0 \
+ --config namespace=$namespace \
+ -m $namespace
+}
+
function deploy_osm_pla_service() {
# corresponding to namespace_vol
$WORKDIR_SUDO sed -i "s#path: /var/lib/osm#path: $OSM_NAMESPACE_VOL#g" $OSM_DOCKER_WORK_DIR/osm_pla/pla.yaml
}
function namespace_vol() {
- osm_services="nbi lcm ro pol mon kafka mongo mysql prometheus"
+ osm_services="nbi lcm ro pol mon kafka mysql prometheus"
for osm in $osm_services; do
$WORKDIR_SUDO sed -i "s#path: /var/lib/osm#path: $OSM_NAMESPACE_VOL#g" $OSM_K8S_WORK_DIR/$osm.yaml
done
track env_files
if [ -n "$KUBERNETES" ]; then
+ deploy_charmed_services
kube_secrets
[ ! $OSM_DOCKER_TAG == "8" ] && parse_yaml $OSM_DOCKER_TAG
namespace_vol
wget -q -O /dev/null $url
}
-JUJU_AGENT_VERSION=2.8.1
+JUJU_AGENT_VERSION=2.8.6
UNINSTALL=""
DEVELOP=""
UPDATE=""