Skip to content

Instantly share code, notes, and snippets.

@flyemsafe
Last active November 12, 2020 07:34
Show Gist options
  • Save flyemsafe/8be5a767f011955f49c4887928817d4b to your computer and use it in GitHub Desktop.
Save flyemsafe/8be5a767f011955f49c4887928817d4b to your computer and use it in GitHub Desktop.
Setup OpenShift 3.11 Satellite
  • Set Environment Variables
ARCH="x86_64"
TYPE="app"
LC_ENVS="Testing Production"
ORG=ACME
SAT_VER="6.4"
CV_PRODUCT="openshift"
CV="cv-${TYPE}-${CV_PRODUCT}"
PRODUCT='"Red Hat OpenShift Container Platform"'
enabled_products=$(mktemp)
REPOSITORY_SETS=$(mktemp)
releasever="7Server"
  • Enable Products
cat > $REPOSITORY_SETS <<EOF
"Red Hat OpenShift Container Platform 3.11 (RPMs)"
EOF

echo hammer --output json repository-set list --enabled=true --product "$PRODUCT" --organization $ORG|sh | awk '/Name/ {print $0}' > $enabled_products

while read product;
do
  grep "$product" $enabled_products >/dev/null
  if [ "$?" -ne "0" ];
  then
    echo hammer repository-set enable --name "$product" --product "$PRODUCT" --organization $ORG --basearch $ARCH --releasever $releasever
  fi
done<$REPOSITORY_SETS

Create content

DESCRIPTION='"OpenShift Platform"'
create_content_view

Add software repositories

REPOS="$(mktemp)"
cat > $REPOS << EOF
'Red Hat OpenShift Container Platform 3.11 RPMs x86_64'
EOF

while read repo;
do
 echo hammer content-view add-repository --name "${CV}" --organization $ORG \
    --product "${PRODUCT}" --repository "${repo}"|sh
done < $REPOS

Publish Content View

hammer content-view publish --name "${CV}" --organization $ORG \
    --description "Initial publish"

CVID=$(hammer --csv content-view list --name "${CV}" --organization ${ORG} | grep -vi '^Content View ID,' | awk -F',' '{print $1}')
APP_CVID=`get_latest_version "${CV}"`

hammer content-view version promote --content-view-id $CVID \
--organization "$ORG" \
--to-lifecycle-environment Testing \
--id $APP_CVID \
--async

APP_CVID=`get_latest_version "${CV}"`
hammer content-view version promote --content-view-id $CVID \
--organization "$ORG" \
--to-lifecycle-environment Production \
--id $APP_CVID \
--async

Create OpeNShift Composite View

  • Get subscription ids
find_subscription 'Red Hat OpenShift Container Platform Broker/Master Infrastructure' 100
  • Setup Environment Variables
TYPE="infra"
CV_PRODUCT="openshift"
CCV="ccv-${TYPE}-${CV_PRODUCT}"
ROLE="${TYPE}-${CV_PRODUCT}-server"
SubIDs='48'
  • Get the latest versions of all required content views
composite_cv='cv-os-rhel-7Server cv-app-gluster cv-app-ansible cv-tools-rhel7-fast-datapath cv-app-openshift'
result=$(for cv in $(echo $composite_cv); do get_latest_version $cv; done)
CV_IDS=$(echo $result | sed -e "s/ /,/g")
  • Create composite content view
echo hammer content-view create --name "$CCV" \
--composite --description "'CCV Role for $PRODUCT'" \
--organization $ORG --component-ids $CV_IDS|sh
  • Publish content view
hammer content-view publish --name "$CCV" \
--organization "$ORG"

VID=`get_latest_version $CCV`

echo hammer content-view version promote --organization "$ORG" \
--content-view "$CCV" \
--to-lifecycle-environment Testing \
--id $VID|sh

VID=`get_latest_version ccv-infra-capsule`
echo hammer content-view version promote --organization "$ORG" \
--content-view "$CCV" \
--to-lifecycle-environment Production \
--id $VID|sh
  • Activation Key
REPOS="$(mktemp)"
cat > $REPOS << EOF
rhel-7-server-satellite-tools-6.4-rpms
rhel-7-server-optional-rpms
rhel-7-server-rpms
rhel-7-server-supplementary-rpms
rhel-7-server-extras-rpms
rh-gluster-3-for-rhel-7-server-rpms
rhel-7-server-ose-3.6-rpms
EOF

create_activation_keys

Create Red Hat Container Catalog


[https://gist.github.com/flyemsafe/603b4c9d897b18038b7bf80a1c2d776e](Create Red Hat Container Catalog)

PRODUCT="Red Hat Container Catalog"
PRODUCT_REPO_NAME="Red Hat Container Images"
PRODUCT_REPO_TYPE="docker"
PRODUCT_REPO_URL="http://registry.access.redhat.com/"


OCP_INSTALLATION_CONTAINERS="$(mktemp)"
cat > $OCP_INSTALLATION_CONTAINERS <<EOF
openshift3/ose-ansible
openshift3/ose-web-console
openshift3/ose-cluster-capacity
openshift3/ose-deployer
openshift3/ose-docker-builder
openshift3/oauth-proxy
openshift3/ose-docker-registry
openshift3/ose-egress-http-proxy
openshift3/ose-egress-router
openshift3/ose-f5-router
openshift3/ose-haproxy-router
openshift3/ose-keepalived-ipfailover
openshift3/ose-pod
openshift3/ose-sti-builder
openshift3/container-engine
openshift3/node
openshift3/ose-node
openshift3/openvswitch
rhel7/etcd
openshift3/ose-recycler
EOF

OCP_LOGGING_METRICS="$(mktemp)"
cat > $OCP_LOGGING_METRICS <<EOF
openshift3/logging-auth-proxy
openshift3/logging-curator
openshift3/logging-elasticsearch
openshift3/logging-fluentd
openshift3/logging-kibana
openshift3/metrics-cassandra
openshift3/metrics-hawkular-metrics
openshift3/metrics-hawkular-openshift-agent
openshift3/metrics-heapster
openshift3/prometheus
openshift3/prometheus-alert-buffer
openshift3/prometheus-alertmanager
openshift3/prometheus-node-exporter
cloudforms46/cfme-openshift-postgresql
cloudforms46/cfme-openshift-memcached
cloudforms46/cfme-openshift-app-ui
cloudforms46/cfme-openshift-app
cloudforms46/cfme-openshift-embedded-ansible
cloudforms46/cfme-openshift-httpd
cloudforms46/cfme-httpd-configmap-generator
rhgs3/rhgs-server-rhel7
rhgs3/rhgs-volmanager-rhel7
rhgs3/rhgs-gluster-block-prov-rhel7
rhgs3/rhgs-s3-server-rhel7
EOF

OCP_BROKERS_CATALOGS="$(mktemp)"
cat > $OCP_BROKERS_CATALOGS <<EOF
openshift3/ose-service-catalog
openshift3/ose-ansible-service-broker
openshift3/mediawiki-apb
openshift3/postgresql-apb
EOF


hammer product create --name="$PRODUCT" --organization "$ORG"

sync_container_repos $OCP_INSTALLATION_CONTAINERS
sync_container_repos $OCP_LOGGING_METRICS
sync_container_repos $OCP_BROKERS_CATALOGS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment