Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review changes from scripts-dev to scripts-adopter #2258

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ spec:
type: flink-standalone-kubernetes
egress:
- ports:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
- protocol: TCP
port: 443
- protocol: TCP
port: 6443
to:
- podSelector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ metadata:
spec:
podSelector:
matchLabels:
type: ibm-elasticsearch
app.kubernetes.io/managed-by: ibm-elasticsearch
egress:
- ports:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
- protocol: TCP
port: 443
to:
- podSelector:
matchLabels:
Expand All @@ -21,10 +19,14 @@ spec:
- ports:
- protocol: TCP
port: 443
- protocol: TCP
port: 19300
- protocol: TCP
port: 8081
- protocol: TCP
port: 9081
port: 9300
- protocol: TCP
port: 9200
to:
- podSelector: {}
policyTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ spec:
- ports:
- protocol: TCP
port: 443
- protocol: TCP
port: 6443
to:
- podSelector:
matchLabels:
Expand All @@ -36,9 +34,9 @@ spec:
- protocol: TCP
port: 443
- protocol: TCP
port: 8081
port: 2112
- protocol: TCP
port: 9081
port: 9200
to:
- podSelector: {}
policyTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ spec:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
port: 8081
- protocol: TCP
port: 9081
from:
- podSelector: {}
policyTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
port: 6443
from:
- podSelector: {}
policyTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ spec:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
port: 19300
- protocol: TCP
port: 9300
- protocol: TCP
port: 9200
from:
- podSelector: {}
policyTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ spec:
- protocol: TCP
port: 443
- protocol: TCP
port: 9443
port: 2112
- protocol: TCP
port: 9200
from:
- podSelector: {}
policyTypes:
Expand Down
40 changes: 30 additions & 10 deletions cp3pt0-deployment/common/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ function wait_for_certificate() {
function wait_for_csv() {
local namespace=$1
local package_name=$2
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}'"
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
local key="${package_name}.${namespace}"
local length_limited_key=$(echo ${key:0:63})
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}'"
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"

local retries=180
local sleep_time=10
Expand Down Expand Up @@ -337,8 +339,10 @@ function wait_for_operand_request() {
function wait_for_nss_patch() {
local namespace=$1
local package_name=$2
local key="${package_name}.${namespace}"
local length_limited_key=$(echo ${key:0:63})

local sub_name=$(${OC} get subscription.operators.coreos.com -n ${namespace} -l operators.coreos.com/${package_name}.${namespace}='' --no-headers | awk '{print $1}')
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${namespace} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
local csv_name=$(${OC} get subscription.operators.coreos.com ${sub_name} -n ${namespace} --ignore-not-found -o jsonpath={.status.installedCSV})

local condition="${OC} -n ${namespace} get csv ${csv_name} -o jsonpath='{.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[?(@.name==\"WATCH_NAMESPACE\")].valueFrom.configMapKeyRef.name}'| grep 'namespace-scope'"
Expand Down Expand Up @@ -507,8 +511,11 @@ function wait_for_operator_upgrade() {
local package_name=$2
local channel=$3
local install_mode=$4
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}' | grep -w $channel"
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
local key="${package_name}.${namespace}"
# k8s label name length limit to 64 characters
local length_limited_key=$(echo ${key:0:63})
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}' | grep -w $channel"
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"

local retries=120
local sleep_time=20
Expand Down Expand Up @@ -1272,8 +1279,10 @@ function update_operator() {
local remove_opreq_label=${7:-}
local retries=5 # Number of retries
local delay=5 # Delay between retries in seconds

local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${package_name}.${ns}='' --no-headers | awk '{print $1}')
local key="${package_name}.${ns}"
# k8s label name length limit to 64 characters
local length_limited_key=$(echo ${key:0:63})
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
if [ -z "$sub_name" ]; then
warning "Not found subscription ${package_name} in ${ns}"
return 0
Expand Down Expand Up @@ -1407,9 +1416,18 @@ function scale_down() {
local services_ns=$2
local channel=$3
local source=$4
local cs_sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/ibm-common-service-operator.${operator_ns}='' --no-headers | awk '{print $1}')
local cs_package="ibm-common-service-operator"
local cs_key="${cs_package}.${operator_ns}"
# k8s label name length limit to 64 characters
local length_limited_cs_key=$(echo ${cs_key:0:63})
local cs_sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${length_limited_cs_key}='' --no-headers | awk '{print $1}')
local cs_CSV=$(${OC} get subscription.operators.coreos.com ${cs_sub} -n ${operator_ns} --ignore-not-found -o jsonpath={.status.installedCSV})
local odlm_sub=$(${OC} get subscription.operators.coreos.com -n ${services_ns} -l operators.coreos.com/ibm-odlm.${services_ns}='' --no-headers | awk '{print $1}')

local odlm_package="ibm-odlm"
local odlm_key="${odlm_package}.${services_ns}"
# k8s label name length limit to 64 characters
local length_limited_odlm_key=$(echo ${odlm_key:0:63})
local odlm_sub=$(${OC} get subscription.operators.coreos.com -n ${services_ns} -l operators.coreos.com/${length_limited_odlm_key}='' --no-headers | awk '{print $1}')
local odlm_CSV=$(${OC} get subscription.operators.coreos.com ${odlm_sub} -n ${services_ns} --ignore-not-found -o jsonpath={.status.installedCSV})

${OC} get subscription.operators.coreos.com ${cs_sub} -n ${operator_ns} -o yaml > /tmp/sub.yaml
Expand Down Expand Up @@ -1496,7 +1514,9 @@ function scale_up() {
local services_ns=$2
local package_name=$3
local deployment=$4
local sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${package_name}.${operator_ns}='' --no-headers | awk '{print $1}')
local key="${package_name}.${operator_ns}"
local length_limited_key=$(echo ${key:0:63})
local sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
local csv=$(${OC} get subscription.operators.coreos.com ${sub} -n ${operator_ns} --ignore-not-found -o jsonpath={.status.installedCSV})

if [[ "$deployment" == "operand-deployment-lifecycle-manager" ]]; then
Expand Down
9 changes: 7 additions & 2 deletions cp3pt0-deployment/setup_tenant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@ function install_cs_operator() {
else
for ns in ${ns_list//,/ }; do
if [[ "$ns" != "$OPERATOR_NS" ]]; then
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${pm}.${ns}='' --no-headers | awk '{print $1}')
local key="${pm}.${ns}"
local length_limited_key=$(echo ${key:0:63})
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
if [ ! -z "$sub_name" ]; then
op_source=$SOURCE
op_source_ns=$SOURCE_NS
Expand Down Expand Up @@ -788,7 +790,10 @@ EOF
function upgrade_mitigation() {
# When it is upgrade scenario, and it is complex toppology, then do the mitigation
if [[ $IS_UPGRADE -eq 1 && $IS_NOT_COMPLEX_TOPOLOGY -eq 0 ]]; then
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${OPERATOR_NS} -l operators.coreos.com/ibm-common-service-operator.${OPERATOR_NS}='' --no-headers | awk '{print $1}')
local package_name="ibm-common-service-operator"
local key="${package_name}.${OPERATOR_NS}"
local length_limited_key=$(echo ${key:0:63})
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${OPERATOR_NS} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
local csv_name=$(${OC} get subscription.operators.coreos.com ${sub_name} -n ${OPERATOR_NS} --ignore-not-found -o jsonpath={.status.installedCSV})
if [[ ! -z ${csv_name} ]]; then
local csv_deleted=$(${OC} get csv -n ${OPERATOR_NS} --ignore-not-found -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep ibm-common-service-operator | grep -v ${csv_name})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ spec:
metadata:
annotations:
backup.velero.io/backup-volumes: cs-db-backup
pre.hook.backup.velero.io/command: '["sh", "-c", "/cs-db/br_cs-db.sh backup <cs-db namespace>"]'
pre.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /cs-db/cs-db-backup/database; /cs-db/br_cs-db.sh backup <cs-db namespace>"]'
pre.hook.backup.velero.io/timeout: 300s
post.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /cs-db/cs-db-backup/database"]'
post.hook.restore.velero.io/command: '["sh", "-c", "/cs-db/br_cs-db.sh restore <cs-db namespace>"]'
post.hook.restore.velero.io/wait-timeout: 300s
post.hook.restore.velero.io/exec-timeout: 300s
Expand Down Expand Up @@ -67,4 +66,4 @@ spec:
name: cs-db-br-configmap
defaultMode: 0777
- emptyDir: {}
name: logs
name: logs
Loading