mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
Delete scripts/ directory
This commit is contained in:
119
scripts/build.sh
119
scripts/build.sh
@@ -1,119 +0,0 @@
|
||||
#!/bin/bash
|
||||
## This script will generate a bundle manifest, build 3 images awx-{operator,bundle,catalog}
|
||||
## and push to the $REGISTRY specified.
|
||||
##
|
||||
## The goal is provide an quick way to build a test image.
|
||||
##
|
||||
## Example:
|
||||
##
|
||||
## git clone https://github.com/ansible/awx-operator.git
|
||||
## cd awx-operator
|
||||
## REGISTRY=registry.example.com/ansible TAG=mytag ANSIBLE_DEBUG_LOGS=true scripts/build.sh
|
||||
##
|
||||
## As a result, the $REGISTRY will be populated with 3 images
|
||||
## registry.example.com/ansible/awx-operator:mytag
|
||||
## registry.example.com/ansible/awx-operator-bundle:mytag
|
||||
## registry.example.com/ansible/awx-operator-catalog:mytag
|
||||
|
||||
OPERATOR_IMAGE=${OPERATOR_IMAGE:-awx-operator}
|
||||
BUNDLE_IMAGE=${BUNDLE_IMAGE:-awx-operator-bundle}
|
||||
CATALOG_IMAGE=${CATALOG_IMAGE:-awx-operator-catalog}
|
||||
|
||||
verify_podman_binary() {
|
||||
if hash podman 2>/dev/null; then
|
||||
POD_MANAGER="podman"
|
||||
else
|
||||
POD_MANAGER="docker"
|
||||
fi
|
||||
}
|
||||
|
||||
verify_operator_sdk_binary() {
|
||||
if hash operator-sdk 2>/dev/null; then
|
||||
OPERATOR_SDK="$(which operator-sdk)"
|
||||
else
|
||||
echo "operator-sdk binary not found."
|
||||
echo "Please visit https://sdk.operatorframework.io/docs/building-operators/ansible/installation"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_opm_binary() {
|
||||
if hash opm 2>/dev/null; then
|
||||
OPM_BINARY="$(which opm)"
|
||||
else
|
||||
echo "opm binary not found."
|
||||
echo "Please visit https://github.com/operator-framework/operator-registry/releases"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_local_deploy() {
|
||||
echo "operator_image: $REGISTRY/$OPERATOR_IMAGE" > ansible/group_vars/all
|
||||
echo "operator_version: $TAG" >> ansible/group_vars/all
|
||||
echo "pull_policy: Always" >> ansible/group_vars/all
|
||||
echo "ansible_debug_logs: ${ANSIBLE_DEBUG_LOGS:-false}" >> ansible/group_vars/all
|
||||
ansible-playbook ansible/chain-operator-files.yml
|
||||
}
|
||||
|
||||
|
||||
REGISTRY=${REGISTRY:-''}
|
||||
if [[ -z "$REGISTRY" ]]; then
|
||||
echo "Set your \$REGISTRY variable to your registry server."
|
||||
echo "export REGISTRY=quay.io/ansible"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG=${TAG:-''}
|
||||
if [[ -z "$TAG" ]]; then
|
||||
echo "Set your \$TAG variable to your registry server."
|
||||
echo "export TAG=mytag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_operator_image() {
|
||||
echo "Building and pushing $OPERATOR_IMAGE image"
|
||||
$POD_MANAGER build . -f build/Dockerfile -t $REGISTRY/$OPERATOR_IMAGE:$TAG
|
||||
$POD_MANAGER push $REGISTRY/$OPERATOR_IMAGE:$TAG
|
||||
}
|
||||
|
||||
build_bundle_image() {
|
||||
echo "Building and pushing $BUNDLE_IMAGE image"
|
||||
operator-sdk generate bundle --operator-name awx-operator --version $TAG
|
||||
$POD_MANAGER build . -f bundle.Dockerfile -t $REGISTRY/$BUNDLE_IMAGE:$TAG
|
||||
$POD_MANAGER push $REGISTRY/$BUNDLE_IMAGE:$TAG
|
||||
}
|
||||
|
||||
build_catalog_image() {
|
||||
echo "Building and pushing $CATALOG_IMAGE image"
|
||||
$OPM_BINARY index add --bundles $REGISTRY/$BUNDLE_IMAGE:$TAG --tag $REGISTRY/$CATALOG_IMAGE:$TAG
|
||||
$POD_MANAGER push $REGISTRY/$CATALOG_IMAGE:$TAG
|
||||
}
|
||||
|
||||
generate_catalogsource_yaml() {
|
||||
echo "Creating CatalogSource YAML"
|
||||
cat > catalogsource.yaml << EOF
|
||||
---
|
||||
apiVersion: operators.coreos.com/v1alpha1
|
||||
kind: CatalogSource
|
||||
metadata:
|
||||
name: awx-operator
|
||||
namespace: operators
|
||||
spec:
|
||||
displayName: 'Ansible AWX Operator'
|
||||
image: "$REGISTRY/$CATALOG_IMAGE:$TAG"
|
||||
publisher: 'Ansible AWX Operator'
|
||||
sourceType: grpc
|
||||
EOF
|
||||
|
||||
echo "Now run: 'kubectl apply -f catalogsource.yaml' to update the operator"
|
||||
echo "Happy testing!"
|
||||
}
|
||||
|
||||
verify_podman_binary
|
||||
verify_operator_sdk_binary
|
||||
verify_opm_binary
|
||||
prepare_local_deploy
|
||||
build_operator_image
|
||||
build_bundle_image
|
||||
build_catalog_image
|
||||
generate_catalogsource_yaml
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
## This script will auto-generate the templated files and bundle files
|
||||
## after changes to CRD template files. Please use this instead of manually
|
||||
## updating the managed yaml files.
|
||||
##
|
||||
## Example:
|
||||
## TAG=0.10.0 ./generate-files.sh
|
||||
|
||||
TAG=${TAG:-''}
|
||||
if [[ -z "$TAG" ]]; then
|
||||
echo "Set your \$TAG variable to your registry server."
|
||||
echo "export TAG=mytag"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ansible-playbook ansible/chain-operator-files.yml
|
||||
operator-sdk generate bundle --operator-name awx-operator --version $TAG
|
||||
@@ -1,115 +0,0 @@
|
||||
### Don't run this deployment in production
|
||||
### The current configuration will run the
|
||||
### OKD console without any authentication!!!!
|
||||
###
|
||||
### A prerequisite is to install the OLM
|
||||
### as instructed at https://olm.operatorframework.io/docs/getting-started/#install-released-olm
|
||||
###
|
||||
### i.e:
|
||||
### $ export olm_release=0.15.1
|
||||
### $ kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${olm_release}/crds.yaml
|
||||
### $ kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${olm_release}/olm.yaml
|
||||
###
|
||||
### This deployment is intented to run locally
|
||||
### and to troubleshoot OLM UI changes.
|
||||
###
|
||||
### To access the console, then execute:
|
||||
### kubectl port-forward svc/okd-console -n okd-console 9000:9000
|
||||
###
|
||||
### Then point your browser:
|
||||
### http://localhost:9000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: okd-console
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: okd-console
|
||||
name: okd-console
|
||||
namespace: okd-console
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: okd-console
|
||||
labels:
|
||||
k8s-app: okd-console
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: okd-console
|
||||
namespace: okd-console
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: okd-console
|
||||
namespace: okd-console
|
||||
labels:
|
||||
k8s-app: okd-console
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: okd-console
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: okd-console
|
||||
spec:
|
||||
serviceAccountName: okd-console
|
||||
containers:
|
||||
- name: okd-console
|
||||
image: quay.io/openshift/origin-console:4.9.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: web
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 10
|
||||
failureThreshold: 60
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: web
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 10
|
||||
failureThreshold: 60
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "550m"
|
||||
ports:
|
||||
- name: web
|
||||
containerPort: 9000
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: okd-console
|
||||
namespace: okd-console
|
||||
labels:
|
||||
k8s-app: okd-console
|
||||
spec:
|
||||
ports:
|
||||
- name: web
|
||||
targetPort: 9000
|
||||
port: 9000
|
||||
protocol: TCP
|
||||
selector:
|
||||
k8s-app: okd-console
|
||||
Reference in New Issue
Block a user