mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
Compare commits
8 Commits
pg-dump-re
...
2.5.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7012a6acfc | ||
|
|
1dc64b551c | ||
|
|
c949d6e58d | ||
|
|
0e0f413e82 | ||
|
|
7935873746 | ||
|
|
a57b9e0475 | ||
|
|
39eee1370b | ||
|
|
48dcb08c78 |
8
Makefile
8
Makefile
@@ -334,6 +334,14 @@ helm-chart-generate: kustomize helm kubectl-slice yq charts
|
||||
for file in charts/$(CHART_NAME)/raw-files/*rolebinding*; do\
|
||||
$(YQ) -i '.subjects[0].namespace = "{{ .Release.Namespace }}"' $${file};\
|
||||
done
|
||||
# Correct .metadata.name for cluster scoped resources
|
||||
cluster_scoped_files="charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-metrics-reader.yaml charts/$(CHART_NAME)/raw-files/clusterrole-awx-operator-proxy-role.yaml";\
|
||||
for file in $${cluster_scoped_files}; do\
|
||||
$(YQ) -i '.metadata.name += "-{{ .Release.Name }}"' $${file};\
|
||||
done
|
||||
|
||||
# Correct the reference for the clusterrolebinding
|
||||
$(YQ) -i '.roleRef.name += "-{{ .Release.Name }}"' 'charts/$(CHART_NAME)/raw-files/clusterrolebinding-awx-operator-proxy-rolebinding.yaml'
|
||||
# move all custom resource definitions to crds folder
|
||||
mkdir charts/$(CHART_NAME)/crds
|
||||
mv charts/$(CHART_NAME)/raw-files/customresourcedefinition*.yaml charts/$(CHART_NAME)/crds/.
|
||||
|
||||
125
hack/publish-to-operator-hub.sh
Normal file
125
hack/publish-to-operator-hub.sh
Normal file
@@ -0,0 +1,125 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create PR to Publish to community-operators and community-operators-prod
|
||||
#
|
||||
# * Create upstream awx-operator release
|
||||
# * Check out tag (1.1.2).
|
||||
# * Run VERSION=1.1.2 make bundle
|
||||
# * Clone https://github.com/k8s-operatorhub/community-operators --branch main
|
||||
# * mkdir -p operators/awx-operator/0.31.0/
|
||||
# * Copy in manifests/ metadata/ and tests/ directories into operators/awx-operator/1.1.2/
|
||||
# * Use sed to add in a replaces or skip entry. replace by default.
|
||||
# * No need to update config.yaml
|
||||
# * Build and Push operator and bundle images
|
||||
# * Open PR or at least push to a branch so that a PR can be manually opened from it.
|
||||
#
|
||||
# Usage:
|
||||
# First, check out awx-operator tag you intend to release, in this case, 1.0.0
|
||||
# $ VERSION=1.1.2 PREV_VERSION=1.1.1 FORK=<your-fork> ./publish-operator.sh
|
||||
#
|
||||
# Remember to change update the VERSION and PREV_VERSION before running!!!
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
VERSION=${VERSION:-blah2}
|
||||
PREV_VERSION=${PREV_VERSION:-blah1}
|
||||
BRANCH=publish-awx-operator-$VERSION
|
||||
FORK=${FORK:-fork}
|
||||
|
||||
IMG=quay.io/ansible/awx-operator:$VERSION
|
||||
CATALOG_IMG=quay.io/ansible/awx-operator-catalog:$VERSION
|
||||
BUNDLE_IMG=quay.io/ansible/awx-operator-bundle:$VERSION
|
||||
|
||||
# Set path variables
|
||||
OPERATOR_PATH=${OPERATOR_PATH:-~/awx-operator}
|
||||
|
||||
# Build & Push Operator Image # Not needed because it is done as part of the GHA release automation
|
||||
# make docker-build docker-push IMG=$IMG
|
||||
|
||||
# Build bundle directory
|
||||
rm -rf bundle/
|
||||
make bundle IMG=$IMG
|
||||
|
||||
# Build bundle and catalog images
|
||||
make bundle-build bundle-push BUNDLE_IMG=$BUNDLE_IMG IMG=$IMG
|
||||
make catalog-build catalog-push CATALOG_IMG=$CATALOG_IMG BUNDLE_IMGS=$BUNDLE_IMG BUNDLE_IMG=$BUNDLE_IMG IMG=$IMG
|
||||
|
||||
# Set containerImage & namespace variables in CSV
|
||||
sed -i -e "s|containerImage: quay.io/ansible/awx-operator:devel|containerImage: quay.io/ansible/awx-operator:${VERSION}|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
sed -i -e "s|namespace: placeholder|namespace: awx|g" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
|
||||
# Add replaces to dependency graph for upgrade path
|
||||
if ! grep -qF 'replaces: awx-operator.v${PREV_VERSION}' bundle/manifests/awx-operator.clusterserviceversion.yaml; then
|
||||
sed -i -e "/version: ${VERSION}/a \\
|
||||
replaces: awx-operator.v$PREV_VERSION" bundle/manifests/awx-operator.clusterserviceversion.yaml
|
||||
fi
|
||||
|
||||
# Rename CSV to contain version in name
|
||||
mv bundle/manifests/awx-operator.clusterserviceversion.yaml bundle/manifests/awx-operator.v${VERSION}.clusterserviceversion.yaml
|
||||
|
||||
# Set Openshift Support Range (bump minKubeVersion in CSV when changing)
|
||||
if ! grep -qF 'openshift.versions' bundle/metadata/annotations.yaml; then
|
||||
sed -i -e "/annotations:/a \\
|
||||
com.redhat.openshift.versions: v4.10-v4.13\n" bundle/metadata/annotations.yaml
|
||||
fi
|
||||
|
||||
# -- Put up community-operators PR
|
||||
cd $OPERATOR_PATH
|
||||
git clone git@github.com:k8s-operatorhub/community-operators.git
|
||||
|
||||
mkdir -p community-operators/operators/awx-operator/$VERSION/
|
||||
cp -r bundle/* community-operators/operators/awx-operator/$VERSION/
|
||||
cd community-operators/operators/awx-operator/$VERSION/
|
||||
pwd
|
||||
ls -la
|
||||
|
||||
# Commit and push PR
|
||||
git checkout -b $BRANCH
|
||||
git add ./
|
||||
git status
|
||||
|
||||
message='operator [N] [CI] awx-operator'
|
||||
commitMessage="${message} ${VERSION}"
|
||||
git commit -m "$commitMessage" -s
|
||||
|
||||
git remote add upstream git@github.com:$FORK/community-operators.git
|
||||
git push upstream $BRANCH
|
||||
|
||||
|
||||
# -- Put up community-operators-prod PR
|
||||
# Reset directory
|
||||
cd $OPERATOR_PATH
|
||||
|
||||
pwd
|
||||
|
||||
git clone git@github.com:redhat-openshift-ecosystem/community-operators-prod.git
|
||||
|
||||
mkdir -p community-operators-prod/operators/awx-operator/$VERSION/
|
||||
cp -r bundle/* community-operators-prod/operators/awx-operator/$VERSION/
|
||||
cd community-operators-prod/operators/awx-operator/$VERSION/
|
||||
|
||||
pwd
|
||||
ls -la
|
||||
|
||||
# Commit and push PR
|
||||
git checkout -b $BRANCH
|
||||
git add ./
|
||||
git status
|
||||
|
||||
message='operator [N] [CI] awx-operator'
|
||||
commitMessage="${message} ${VERSION}"
|
||||
git commit -m "$commitMessage" -s
|
||||
|
||||
git remote add upstream git@github.com:$FORK/community-operators-prod.git
|
||||
git push upstream $BRANCH
|
||||
|
||||
|
||||
# -- Print Links to Branches
|
||||
echo "Commnity Operators: https://github.com/$FORK/community-operators/pull/new/$BRANCH"
|
||||
echo "Commnity Operators Prod: https://github.com/$FORK/community-operators-prod/pull/new/$BRANCH"
|
||||
|
||||
# -- Cleanup
|
||||
|
||||
rm -rf $OPERATOR_PATH/community-operators
|
||||
rm -rf $OPERATOR_PATH/community-operators-prod
|
||||
@@ -273,7 +273,7 @@ _init_projects_container_image: quay.io/centos/centos:stream9
|
||||
|
||||
create_preload_data: true
|
||||
|
||||
replicas: "1"
|
||||
replicas: 1
|
||||
web_replicas: ''
|
||||
task_replicas: ''
|
||||
|
||||
|
||||
@@ -59,14 +59,29 @@
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
pod: "{{ postgres_pod_name }}"
|
||||
command: |
|
||||
bash -c """
|
||||
bash -c "
|
||||
function end_keepalive {
|
||||
rc=$?
|
||||
rm -f \"$1\"
|
||||
kill $(cat /proc/$2/task/$2/children 2>/dev/null) 2>/dev/null || true
|
||||
wait $2 || true
|
||||
exit $rc
|
||||
}
|
||||
keepalive_file=\"$(mktemp)\"
|
||||
while [[ -f \"$keepalive_file\" ]]; do
|
||||
echo 'Migrating data from old database...'
|
||||
sleep 60
|
||||
done &
|
||||
keepalive_pid=$!
|
||||
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
||||
echo keepalive_pid: $keepalive_pid
|
||||
set -e -o pipefail
|
||||
PGPASSWORD='{{ awx_old_postgres_pass }}' {{ pgdump }} | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
||||
PGPASSWORD=\"$PGPASSWORD_OLD\" {{ pgdump }} | PGPASSWORD=\"$POSTGRES_PASSWORD\" {{ pg_restore }}
|
||||
set +e +o pipefail
|
||||
echo 'Successful'
|
||||
"""
|
||||
"
|
||||
no_log: "{{ no_log }}"
|
||||
register: data_migration
|
||||
failed_when: "'Successful' not in data_migration.stdout"
|
||||
|
||||
- name: Set flag signifying that this instance has been migrated
|
||||
set_fact:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||
replicas: 0
|
||||
wait: yes
|
||||
wait_timeout: "{{ termination_grace_period_seconds | default(120) }}"
|
||||
loop:
|
||||
- "{{ ansible_operator_meta.name }}-task"
|
||||
- "{{ ansible_operator_meta.name }}-web"
|
||||
|
||||
@@ -94,6 +94,13 @@ spec:
|
||||
value: '{{ postgres_initdb_args }}'
|
||||
- name: POSTGRES_HOST_AUTH_METHOD
|
||||
value: '{{ postgres_host_auth_method }}'
|
||||
{% if 'resources' in old_pg_config and old_pg_config['resources'] and 'password' in old_pg_config['resources'][0]['data'] %}
|
||||
- name: PGPASSWORD_OLD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: '{{ old_pg_config['resources'][0]['metadata']['name'] }}'
|
||||
key: password
|
||||
{% endif %}
|
||||
ports:
|
||||
- containerPort: {{ awx_postgres_port | default('5432')}}
|
||||
name: postgres-{{ supported_pg_version }}
|
||||
|
||||
Reference in New Issue
Block a user