Skip to content

Commit

Permalink
Merge pull request #163 from weinimo/update-install-yamls-setup
Browse files Browse the repository at this point in the history
Update install_yamls_setup playbook
  • Loading branch information
openshift-ci[bot] authored Oct 30, 2023
2 parents 0456c0a + e923598 commit 9210bdd
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 77 deletions.
6 changes: 4 additions & 2 deletions install_yamls_setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ See `install_yamls_setup/roles/podified_cp/defaults/main.yaml` for variables
and their default values. In addition to that these variables need to be
defined:

openshift_pull_secret: <pull secret from https://console.redhat.com/openshift/create/local >
openshift_pull_secret: '<pull secret from https://console.redhat.com/openshift/create/local >'
podman_dockerio_user: <user>
podman_dockerio_password: <password>
podman_quayio_user: <user>
podman_quayio_password: <password>

The recommended way to manage those secrets is using `ansible-vault`.
The recommended way to manage those secrets is using `ansible-vault`. Pay attention that
`openshift_pull_secret` needs to be a string and hence the JSON data needs to be put in
quotes.

## Playbook

Expand Down
12 changes: 4 additions & 8 deletions install_yamls_setup/roles/podified_cp/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ operators_git_repos:
dest: ~/octavia-operator
version: main
# Optional repositories:
- repo: https://github.com/openstack-k8s-operators/keystone-operator.git
dest: ~/keystone-operator
depth: 10
- repo: https://github.com/openstack-k8s-operators/placement-operator.git
dest: ~/placement-operator
depth: 10
- repo: https://github.com/openstack-k8s-operators/neutron-operator.git
dest: ~/neutron-operator
depth: 10
- repo: https://github.com/openstack-k8s-operators/lib-common.git
dest: ~/lib-common
make_crc_cpus: 10
make_crc_memory: 18000
make_crc_cpus: 20
make_crc_memory: 40000
make_crc_disk: 70
10 changes: 6 additions & 4 deletions install_yamls_setup/roles/podified_cp/files/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch Octavia Operator",
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/octavia-operator/main.go",
"cwd": "${fileDirname}",
"program": "${fileWorkspaceFolder}/main.go",
"cwd": "${fileWorkspaceFolder}",
"preLaunchTask": "Run make",
"env": {
"OPERATOR_TEMPLATES": "${workspaceFolder}/octavia-operator/templates"
"WATCH_NAMESPACE": "openstack",
"OPERATOR_TEMPLATES": "./templates",
"ENABLE_WEBHOOKS": "false"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: octavia.openstack.org/v1beta1
kind: Octavia
metadata:
name: octavia
spec:
databaseInstance: openstack
databaseUser: octavia
serviceUser: octavia
rabbitMqClusterName: rabbitmq
secret: osp-secret
debug:
dbSync: false
service: false
preserveJobs: false
customServiceConfig: |
[DEFAULT]
debug = true
octaviaHousekeeping:
databaseInstance: openstack
databaseUser: octavia
serviceUser: octavia
serviceAccount: octavia
role: housekeeping
certssecret: todo
secret: osp-secret
preserveJobs: false
containerImage: quay.io/podified-antelope-centos9/openstack-octavia-housekeeping:current-podified
customServiceConfig: |
[DEFAULT]
debug = true
octaviaHealthManager:
databaseInstance: openstack
databaseUser: octavia
serviceUser: octavia
serviceAccount: octavia
role: healthmanager
certssecret: todo
secret: osp-secret
preserveJobs: false
containerImage: quay.io/podified-antelope-centos9/openstack-octavia-health-manager:current-podified
customServiceConfig: |
[DEFAULT]
debug = true
octaviaWorker:
databaseInstance: openstack
databaseUser: octavia
serviceUser: octavia
serviceAccount: octavia
role: worker
certssecret: todo
secret: osp-secret
preserveJobs: false
containerImage: quay.io/podified-antelope-centos9/openstack-octavia-worker:current-podified
customServiceConfig: |
[DEFAULT]
debug = true
octaviaAPI:
databaseInstance: openstack
databaseUser: octavia
serviceUser: octavia
serviceAccount: octavia
secret: osp-secret
debug:
dbSync: false
service: false
preserveJobs: false
containerImage: quay.io/podified-antelope-centos9/openstack-octavia-api:current-podified
customServiceConfig: |
[DEFAULT]
debug = true
11 changes: 11 additions & 0 deletions install_yamls_setup/roles/podified_cp/files/stack.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "octavia-operator"
}
],
"settings": {}
}
9 changes: 3 additions & 6 deletions install_yamls_setup/roles/podified_cp/files/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
"label": "Run make",
"type": "shell",
"command": "make install manifests generate fmt vet",
"group": {
"kind": "build",
"isDefault": true
},
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new"
},
"options": {
"cwd": "${workspaceFolder}/octavia-operator",
"cwd": "${fileWorkspaceFolder}/",
"env": {
"OPERATOR_TEMPLATES": "./templates",
"PATH": "~/.crc/bin/oc:${env:PATH}"
Expand All @@ -23,4 +20,4 @@
"problemMatcher": []
}
]
}
}
158 changes: 101 additions & 57 deletions install_yamls_setup/roles/podified_cp/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
# Initial manual preparation (not needed with a c9s cloud image on PSI):
# - Create user, add to group wheel: useradd -m -G wheel stack
# - Set password for new user: passwd stack
# - Let users of wheel group use sudo without password: visudo
# - Copy local ssh key to remote machine: ssh-copy-id stack@<host>
- name: Upgrade all packages
ansible.builtin.dnf:
name: "*"
Expand All @@ -11,7 +16,7 @@
- name: Install required packages
ansible.builtin.package:
name:
- ansible
- ansible-core
- gcc
- git-core
- make
Expand All @@ -26,6 +31,7 @@
ansible.builtin.package:
name:
- bash-completion
- delve
- tmux
- vim
state: latest
Expand All @@ -45,19 +51,39 @@
with_items: "{{ operators_git_repos }}"
tags: git

- name: Create ~/install_yamls/devsetup/pull-secret.txt
- name: Create ~/pull-secret.txt
template:
src: pull-secret.txt.j2
dest: "~/install_yamls/devsetup/pull-secret.txt"
tags: [crc, pull-secret]
dest: "~/pull-secret.txt"
tags: [crc, pre-config]

- name: Ensure ~/.config/openstack directory exists
ansible.builtin.file:
path: ~/.config/openstack
state: directory
mode: '0755'
tags: [crc, pre-config]

- name: Set up ~/.config/openstack/clouds.yaml
copy:
src: clouds.yaml
dest: ~/.config/openstack/clouds.yaml
tags: [crc, pre-config]

- name: Create devsetup using make (may take 30 minutes or more)
shell:
cmd: "{{ item }}"
make:
target: crc
params:
CPUS: "{{ make_crc_cpus }}"
MEMORY: "{{ make_crc_memory }}"
DISK: "{{ make_crc_disk }}"
chdir: "~/install_yamls/devsetup"
tags: crc

- name: Run make download_tools
make:
target: download_tools
chdir: "~/install_yamls/devsetup"
with_items:
- "CPUS={{ make_crc_cpus }} MEMORY={{ make_crc_memory }} make crc"
- make download_tools
tags: crc

- name: Create symbolic link for kubectl
Expand All @@ -75,24 +101,40 @@
oc login -u kubeadmin -p 12345678 https://api.crc.testing:6443
make crc_storage
make input
make openstack
for i in mariadb keystone ovn neutron rabbitmq ; do \
make $i
sleep 60
make ${i}_deploy
chdir: "~/install_yamls"
tags: crc

- name: Run make crc_attach_default_interface
shell:
cmd: |
set +ex
eval $(crc oc-env)
oc login -u kubeadmin -p 12345678 https://api.crc.testing:6443
make crc_attach_default_interface
exit 0
chdir: "~/install_yamls/devsetup"
tags: crc

- name: Deploy openstack operators
shell:
cmd: |
set +ex
eval $(crc oc-env)
oc login -u kubeadmin -p 12345678 https://api.crc.testing:6443
oc project openstack-operators
for i in mariadb keystone ovn neutron rabbitmq ; do
make $i || break ; sleep 60 ; make ${i}_deploy || break
done
make infra
make memcached_deploy
sleep 300
oc completion bash | sudo tee /etc/bash_completion.d/oc_completion
openstack complete | sudo tee /etc/bash_completion.d/osc.bash_completion
exit 0
creates: "/etc/bash_completion.d/oc_completion"
#creates: "/etc/bash_completion.d/oc_completion"
chdir: "~/install_yamls"
tags: crc

- name: Set up ~/.config/openstack/clouds.yaml
copy:
src: clouds.yaml
dest: ~/.config/openstack/clouds.yaml

- name: Export OS_CLOUD and OS_PASSWORD in .bashrc
lineinfile:
path: ~/.bashrc
Expand All @@ -101,6 +143,15 @@
- export PATH=$PATH:~/.crc/bin/oc
- export OS_CLOUD=default
- export OS_PASSWORD=12345678
tags: config

- name: Copy ~/.tmux.conf
copy:
src: ~/.tmux.conf
dest: ~/.tmux.conf
force: no
ignore_errors: true
tags: config

- name: Copy ~/.vscode jsons
copy:
Expand All @@ -110,58 +161,51 @@
with_items:
- launch.json
- tasks.json
tags: config

- name: Copy VSCode workspace config
copy:
src: stack.code-workspace
dest: ~/
force: no
tags: config

- name: Increase max_user_watches for VSCode
become: yes
lineinfile:
path: /etc/sysctl.conf
line: fs.inotify.max_user_watches=524288
notify: "Apply sysctl"
tags: config

- name: Export OS_CLOUD and OS_PASSWORD in .bashrc
- name: Add exports to .bashrc
lineinfile:
path: ~/.bashrc
line: "{{ item }}"
with_items:
- export OS_CLOUD=default
- export OS_PASSWORD=12345678
- export EDPM_COMPUTE_CEPH_ENABLED=false
- export BMO_SETUP=false
- export PATH=$PATH:~/.crc/bin/oc
tags: config

- name: Deploy CRD, build and push Octavia Operator image
shell:
cmd: |
set +ex
eval $(crc oc-env)
make generate
make manifests
go mod tidy
oc apply -f ~/octavia-operator/config/crd/bases/octavia.openstack.org_octaviaapis.yaml
podman rmi -f $(podman images --filter="reference=*octavia*" -q)
podman login -u {{ podman_dockerio_user }} -p \
{{ podman_dockerio_password }} docker.io
podman login -u {{ podman_quayio_user }} -p \
{{ podman_quayio_password }} quay.io
podman pull docker.io/library/golang:1.19
IMAGE_TAG_BASE=quay.io/tweining/octavia-operator VERSION=0.0.1 \
IMG=$IMAGE_TAG_BASE:v$VERSION make \
manifests build docker-build docker-push bundle bundle-build \
bundle-push catalog-build catalog-push
chdir: "~/octavia-operator"
tags: image

- name: Prepare for running Octavia Operator locally
shell:
cmd: |
set +ex
eval $(crc oc-env)
oc login -u kubeadmin -p 12345678 https://api.crc.testing:6443
OCTAVIA_IMG="quay.io/tweining/octavia-operator-index:v0.0.1" make octavia
sleep 10
OCTAVIAAPI_IMG="quay.io/tweining/octavia-operator:v0.0.1" make octavia_deploy
sleep 50
make octavia_cleanup
chdir: "~/install_yamls"
tags: octavia-prep
- name: Copy PodSet CR with containerImage fields set
copy:
src: octavia_v1beta1_octavia.yaml
dest: ~/octavia_v1beta1_octavia.yaml
force: no
tags: config

# Now run the operator as a Go program locally (outside the Kubernetes cluster):
# cd ~/octavia-operator; OPERATOR_TEMPLATES=./templates make install run
#
# Either using VSCode or directly in a shell:
# In VSCode open the home folder and add the ~/octavia_operator folder to the
# workspace (File->Add folder to workspace...). Then open
# ~/octavia_operator/main.go and press F5 to start the debugger
# In shell:
# cd ~/octavia-operator; ENABLE_WEBHOOKS=false GOWORK= OPERATOR_TEMPLATES=./templates make install run
#
# Deploy your PodSet Custom Resource to the live OpenShift Cluster:
# oc create -f ~/octavia_v1beta1_octavia.yaml
# watch octavia pods get created using `oc get pods -w`

0 comments on commit 9210bdd

Please sign in to comment.