mirror of
https://github.com/ansible/awx-operator.git
synced 2026-04-27 17:06:45 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef17865f12 | ||
|
|
d5fd5d3819 | ||
|
|
a61ed18147 | ||
|
|
e3e3da0e0e | ||
|
|
1470779b8f | ||
|
|
400df47678 | ||
|
|
0f0ff32bf6 | ||
|
|
a9245454a4 | ||
|
|
bba8b8e2b5 | ||
|
|
93c5e4a0c3 | ||
|
|
06c0dd96d0 | ||
|
|
e6b11084db | ||
|
|
669fe1d253 | ||
|
|
e4cfa2f809 | ||
|
|
7251961bcc | ||
|
|
3a5fbb0b06 | ||
|
|
a69ca7f8b5 | ||
|
|
0fb252b6e4 |
38
.github/workflows/publish-operator-hub.yaml
vendored
38
.github/workflows/publish-operator-hub.yaml
vendored
@@ -31,45 +31,55 @@ jobs:
|
|||||||
promote:
|
promote:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set TAG_NAME from workflow_dispatch event
|
- name: Set GITHUB_ENV from workflow_dispatch event
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
run: |
|
run: |
|
||||||
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
echo "VERSION=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
||||||
|
echo "IMAGE_REGISTRY=${{ github.event.inputs.image_registry }}" >> $GITHUB_ENV
|
||||||
|
echo "IMAGE_REGISTRY_ORGANIZATION=${{ github.event.inputs.image_registry_organization }}" >> $GITHUB_ENV
|
||||||
|
echo "COMMUNITY_OPERATOR_GITHUB_ORG=${{ github.event.inputs.community_operator_github_org }}" >> $GITHUB_ENV
|
||||||
|
echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=${{ github.event.inputs.community_operator_prod_github_org }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set TAG_NAME for release event
|
- name: Set GITHUB_ENV for release event
|
||||||
if: ${{ github.event_name == 'release' }}
|
if: ${{ github.event_name == 'release' }}
|
||||||
run: |
|
run: |
|
||||||
echo "TAG_NAME=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
||||||
|
echo "IMAGE_REGISTRY=quay.io" >> $GITHUB_ENV
|
||||||
|
echo "IMAGE_REGISTRY_ORGANIZATION=ansible" >> $GITHUB_ENV
|
||||||
|
echo "COMMUNITY_OPERATOR_GITHUB_ORG=k8s-operatorhub" >> $GITHUB_ENV
|
||||||
|
echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=redhat-openshift-ecosystem" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Log in to image registry
|
- name: Log in to image registry
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.QUAY_TOKEN }} | docker login ${{github.event.inputs.image_registry}} -u ${{ secrets.QUAY_USER }} --password-stdin
|
echo ${{ secrets.QUAY_TOKEN }} | docker login ${{ env.IMAGE_REGISTRY }} -u ${{ secrets.QUAY_USER }} --password-stdin
|
||||||
|
|
||||||
- name: Checkout awx-operator at workflow branch
|
- name: Checkout awx-operator at workflow branch
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: awx-operator
|
path: awx-operator
|
||||||
|
|
||||||
- name: Checkout awx-opearator at TAG_NAME
|
- name: Checkout awx-opearator at ${{ env.VERSION }}
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
ref: ${{ env.TAG_NAME }}
|
ref: ${{ env.VERSION }}
|
||||||
path: awx-operator-${{ env.TAG_NAME }}
|
path: awx-operator-${{ env.VERSION }}
|
||||||
|
fetch-depth: 0 # fetch all history so that git describe works
|
||||||
|
|
||||||
- name: Copy scripts to awx-operator-${{ env.TAG_NAME }}
|
- name: Copy scripts to awx-operator-${{ env.VERSION }}
|
||||||
run: |
|
run: |
|
||||||
cp -f \
|
cp -f \
|
||||||
awx-operator/hack/publish-to-operator-hub.sh \
|
awx-operator/hack/publish-to-operator-hub.sh \
|
||||||
awx-operator-${{ env.TAG_NAME }}/hack/publish-to-operator-hub.sh
|
awx-operator-${{ env.VERSION }}/hack/publish-to-operator-hub.sh
|
||||||
|
cp -f \
|
||||||
|
awx-operator/Makefile \
|
||||||
|
awx-operator-${{ env.VERSION }}/Makefile
|
||||||
|
|
||||||
- name: Build and publish bundle to operator-hub
|
- name: Build and publish bundle to operator-hub
|
||||||
working-directory: awx-operator-${{ env.TAG_NAME }}
|
working-directory: awx-operator-${{ env.VERSION }}
|
||||||
env:
|
env:
|
||||||
IMG_REPOSITORY: ${{ github.event.inputs.image_registry }}/${{ github.event.inputs.image_registry_organization }}
|
IMG_REPOSITORY: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REGISTRY_ORGANIZATION }}
|
||||||
GITHUB_TOKEN: ${{ secrets.AWX_AUTO_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.AWX_AUTO_GITHUB_TOKEN }}
|
||||||
COMMUNITY_OPERATOR_GITHUB_ORG: ${{ github.event.inputs.community_operator_github_org }}
|
|
||||||
COMMUNITY_OPERATOR_PROD_GITHUB_ORG: ${{ github.event.inputs.community_operator_prod_github_org }}
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.email "awx-automation@redhat.com"
|
git config --global user.email "awx-automation@redhat.com"
|
||||||
git config --global user.name "AWX Automation"
|
git config --global user.name "AWX Automation"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM quay.io/operator-framework/ansible-operator:v1.31.0
|
FROM quay.io/operator-framework/ansible-operator:v1.32.0
|
||||||
|
|
||||||
USER 0
|
USER root
|
||||||
|
RUN dnf update --security --bugfix -y && \
|
||||||
RUN dnf install -y openssl
|
dnf install -y openssl
|
||||||
|
|
||||||
USER 1001
|
USER 1001
|
||||||
|
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -4,7 +4,7 @@
|
|||||||
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
|
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
|
||||||
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
|
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
|
||||||
VERSION ?= $(shell git describe --tags)
|
VERSION ?= $(shell git describe --tags)
|
||||||
PREV_VERSION ?= $(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))
|
PREV_VERSION ?= $(shell git describe --abbrev=0 --tags $(shell git rev-list --tags --skip=1 --max-count=1))
|
||||||
|
|
||||||
CONTAINER_CMD ?= docker
|
CONTAINER_CMD ?= docker
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ ifeq (,$(shell which operator-sdk 2>/dev/null))
|
|||||||
@{ \
|
@{ \
|
||||||
set -e ;\
|
set -e ;\
|
||||||
mkdir -p $(dir $(OPERATOR_SDK)) ;\
|
mkdir -p $(dir $(OPERATOR_SDK)) ;\
|
||||||
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/operator-sdk_$(OS)_$(ARCHA) ;\
|
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/operator-sdk_$(OS)_$(ARCHA) ;\
|
||||||
chmod +x $(OPERATOR_SDK) ;\
|
chmod +x $(OPERATOR_SDK) ;\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -178,7 +178,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
|
|||||||
@{ \
|
@{ \
|
||||||
set -e ;\
|
set -e ;\
|
||||||
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
|
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
|
||||||
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.31.0/ansible-operator_$(OS)_$(ARCHA) ;\
|
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/ansible-operator_$(OS)_$(ARCHA) ;\
|
||||||
chmod +x $(ANSIBLE_OPERATOR) ;\
|
chmod +x $(ANSIBLE_OPERATOR) ;\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
70
README.md
70
README.md
@@ -12,75 +12,11 @@ An [Ansible AWX](https://github.com/ansible/awx) operator for Kubernetes built w
|
|||||||
<!-- gh-md-toc --insert README.md -->
|
<!-- gh-md-toc --insert README.md -->
|
||||||
<!--ts-->
|
<!--ts-->
|
||||||
|
|
||||||
**Note**: We are in the process of moving this readme into official docs in the /docs folder. Please go there to find additional sections during this interim move phase.
|
# AWX Operator Documentation
|
||||||
|
|
||||||
|
The AWX Operator documentation is now available at https://awx-operator.readthedocs.io/en/latest/
|
||||||
|
|
||||||
Table of Contents
|
For docs changes, create PRs on the appropriate files in the /docs folder.
|
||||||
=================
|
|
||||||
|
|
||||||
- [AWX Operator](#awx-operator)
|
|
||||||
- [Table of Contents](#table-of-contents)
|
|
||||||
- [Install and Configuration](#install-and-configuration)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [Release Process](#release-process)
|
|
||||||
- [Author](#author)
|
|
||||||
- [Code of Conduct](#code-of-conduct)
|
|
||||||
- [Get Involved](#get-involved)
|
|
||||||
|
|
||||||
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
||||||
|
|
||||||
<!--te-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Install and Configuration
|
|
||||||
|
|
||||||
All of our usage and configuration docs are nested in the `docs/` directory. Below is a Table of Contents for those.
|
|
||||||
|
|
||||||
- Introduction
|
|
||||||
- [Introduction](./docs/introduction/introduction.md)
|
|
||||||
- Contributors Guide
|
|
||||||
- [Code of Conduct](./docs/contributors-guide/code-of-conduct.md)
|
|
||||||
- [Get Involved](./docs/contributors-guide/get-involved.md)
|
|
||||||
- [Contributing](./docs/contributors-guide/contributing.md)
|
|
||||||
- [Release Process](./docs/contributors-guide/release-process.md)
|
|
||||||
- [Authors](./docs/contributors-guide/author.md)
|
|
||||||
- Installation
|
|
||||||
- [Basic Install](./docs/installation/basic-install.md)
|
|
||||||
- [Creating a Minikube cluster for testing](./docs/installation/creating-a-minikube-cluster-for-testing.md)
|
|
||||||
- [Helm Install](./docs/installation/helm-install-on-existing-cluster.md)
|
|
||||||
- [Migration](./docs/migration/migration.md)
|
|
||||||
- [Uninstall](./docs/uninstall/uninstall.md)
|
|
||||||
- User Guide
|
|
||||||
- [Admin User Configuration](./docs/user-guide/admin-user-account-configuration.md)
|
|
||||||
- [Database Configuration](./docs/user-guide/database-configuration.md)
|
|
||||||
- [Network and TLS Configuration](./docs/user-guide/network-and-tls-configuration.md)
|
|
||||||
- Advanced Configuration
|
|
||||||
- [No Log](./docs/user-guide/advanced-configuration/no-log.md)
|
|
||||||
- [Deploy a Specific Version of AWX](./docs/user-guide/advanced-configuration/deploying-a-specific-version-of-awx.md)
|
|
||||||
- [Resource Requirements](./docs/user-guide/advanced-configuration/containers-resource-requirements.md)
|
|
||||||
- [Extra Settings](./docs/user-guide/advanced-configuration/extra-settings.md)
|
|
||||||
- [Environment Variables](./docs/user-guide/advanced-configuration/exporting-environment-variables-to-containers.md)
|
|
||||||
- [Custom Labels](./docs/user-guide/advanced-configuration/labeling-operator-managed-objects.md)
|
|
||||||
- [Custom Volumes](./docs/user-guide/advanced-configuration/custom-volume-and-volume-mount-options.md)
|
|
||||||
- [Scaling Deployments](./docs/user-guide/advanced-configuration/scaling-the-web-and-task-pods-independently.md)
|
|
||||||
- [Auto Update Upon Operator Upgrade](./docs/user-guide/advanced-configuration/auto-upgrade.md)
|
|
||||||
- [Termination Grace Period](./docs/user-guide/advanced-configuration/pods-termination-grace-period.md)
|
|
||||||
- [Node Selector for Deployments](./docs/user-guide/advanced-configuration/assigning-awx-pods-to-specific-nodes.md)
|
|
||||||
- [Default EE from Private Registries](./docs/user-guide/advanced-configuration/default-execution-environments-from-private-registries.md)
|
|
||||||
- [CSRF Cookie Secure](./docs/user-guide/advanced-configuration/csrf-cookie-secure-setting.md)
|
|
||||||
- [Disable IPv6](./docs/user-guide/advanced-configuration/disable-ipv6.md)
|
|
||||||
- [LDAP](./docs/user-guide/advanced-configuration/enabling-ldap-integration-at-awx-bootstrap.md)
|
|
||||||
- [Priority Clases](./docs/user-guide/advanced-configuration/priority-classes.md)
|
|
||||||
- [Priveleged Tasks](./docs/user-guide/advanced-configuration/privileged-tasks.md)
|
|
||||||
- [Redis Container Capabilities](./docs/user-guide/advanced-configuration/redis-container-capabilities.md)
|
|
||||||
- [Trusting a Custom Certificate Authority](./docs/user-guide/advanced-configuration/trusting-a-custom-certificate-authority.md)
|
|
||||||
- [Service Account](./docs/user-guide/advanced-configuration/service-account.md)
|
|
||||||
- [Security Context](./docs/user-guide/advanced-configuration/security-context.md)
|
|
||||||
- [Persisting the Projects Directory](./docs/user-guide/advanced-configuration/persisting-projects-directory.md)
|
|
||||||
- Troubleshooting
|
|
||||||
- [General Debugging](./docs/troubleshooting/debugging.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ spec:
|
|||||||
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
|
description: Maintain some of the recommended `app.kubernetes.io/*` labels on the resource (self)
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
force_drop_db:
|
||||||
|
description: Force drop the database before restoring. USE WITH CAUTION!
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
status:
|
status:
|
||||||
type: object
|
type: object
|
||||||
x-kubernetes-preserve-unknown-fields: true
|
x-kubernetes-preserve-unknown-fields: true
|
||||||
|
|||||||
@@ -1608,6 +1608,9 @@ spec:
|
|||||||
web_extra_volume_mounts:
|
web_extra_volume_mounts:
|
||||||
description: Specify volume mounts to be added to the Web container
|
description: Specify volume mounts to be added to the Web container
|
||||||
type: string
|
type: string
|
||||||
|
postgres_extra_volume_mounts:
|
||||||
|
description: Specify volume mounts to be added to Postgres container
|
||||||
|
type: string
|
||||||
uwsgi_processes:
|
uwsgi_processes:
|
||||||
description: Set the number of uwsgi processes to run in a web container
|
description: Set the number of uwsgi processes to run in a web container
|
||||||
type: integer
|
type: integer
|
||||||
@@ -1715,6 +1718,9 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
postgres_extra_volumes:
|
||||||
|
description: Specify extra volumes to add to the application pod
|
||||||
|
type: string
|
||||||
postgres_keepalives:
|
postgres_keepalives:
|
||||||
description: Controls whether client-side TCP keepalives are used for Postgres connections.
|
description: Controls whether client-side TCP keepalives are used for Postgres connections.
|
||||||
default: true
|
default: true
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ spec:
|
|||||||
memory: "32Mi"
|
memory: "32Mi"
|
||||||
cpu: "50m"
|
cpu: "50m"
|
||||||
limits:
|
limits:
|
||||||
memory: "4096Mi"
|
memory: "960Mi"
|
||||||
cpu: "2000m"
|
cpu: "1500m"
|
||||||
serviceAccountName: controller-manager
|
serviceAccountName: controller-manager
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: redhat-operators-pull-secret
|
- name: redhat-operators-pull-secret
|
||||||
|
|||||||
@@ -194,6 +194,11 @@ spec:
|
|||||||
path: db_management_pod_node_selector
|
path: db_management_pod_node_selector
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- displayName: Force drop database before restore
|
||||||
|
path: force_drop_db
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
|
||||||
statusDescriptors:
|
statusDescriptors:
|
||||||
- description: The state of the restore
|
- description: The state of the restore
|
||||||
displayName: Restore Status
|
displayName: Restore Status
|
||||||
@@ -583,6 +588,18 @@ spec:
|
|||||||
x-descriptors:
|
x-descriptors:
|
||||||
- urn:alm:descriptor:com.tectonic.ui:advanced
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
- urn:alm:descriptor:com.tectonic.ui:hidden
|
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||||
|
- displayName: Postgres Extra Volumes
|
||||||
|
description: Specify extra volumes to add to the postgres pod
|
||||||
|
path: postgres_extra_volumes
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||||
|
- description: Specify volume mounts to be added to Postgres container
|
||||||
|
displayName: Postgres Extra Volume Mounts
|
||||||
|
path: postgres_extra_volume_mounts
|
||||||
|
x-descriptors:
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:advanced
|
||||||
|
- urn:alm:descriptor:com.tectonic.ui:hidden
|
||||||
- displayName: Enable Postgres Keepalives
|
- displayName: Enable Postgres Keepalives
|
||||||
path: postgres_keepalives
|
path: postgres_keepalives
|
||||||
x-descriptors:
|
x-descriptors:
|
||||||
|
|||||||
@@ -1,7 +1,29 @@
|
|||||||
### Basic Install
|
### Basic Install
|
||||||
|
|
||||||
|
After cloning this repository, you must choose the tag to run:
|
||||||
|
```sh
|
||||||
|
git clone git@github.com:ansible/awx-operator.git
|
||||||
|
cd awx-operator
|
||||||
|
git tag
|
||||||
|
git checkout tags/<tag>
|
||||||
|
|
||||||
|
# For instance:
|
||||||
|
git checkout tags/2.7.2
|
||||||
|
```
|
||||||
|
|
||||||
|
If you work from a fork and made modifications since the tag was issued, you must provide the VERSION number to deploy. Otherwise the operator will get stuck in "ImagePullBackOff" state:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export VERSION=<tag>
|
||||||
|
|
||||||
|
# For instance:
|
||||||
|
export VERSION=2.7.2
|
||||||
|
```
|
||||||
|
|
||||||
Once you have a running Kubernetes cluster, you can deploy AWX Operator into your cluster using [Kustomize](https://kubectl.docs.kubernetes.io/guides/introduction/kustomize/). Since kubectl version 1.14 kustomize functionality is built-in (otherwise, follow the instructions here to install the latest version of Kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/ )
|
Once you have a running Kubernetes cluster, you can deploy AWX Operator into your cluster using [Kustomize](https://kubectl.docs.kubernetes.io/guides/introduction/kustomize/). Since kubectl version 1.14 kustomize functionality is built-in (otherwise, follow the instructions here to install the latest version of Kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/ )
|
||||||
|
|
||||||
|
> Some things may need to be configured slightly differently for different Kubernetes flavors for the networking aspects. When installing on Kind, see the [kind install docs](./kind-install.md) for more details.
|
||||||
|
|
||||||
There is a make target you can run:
|
There is a make target you can run:
|
||||||
```
|
```
|
||||||
make deploy
|
make deploy
|
||||||
@@ -67,7 +89,7 @@ So we don't have to keep repeating `-n awx`, let's set the current namespace for
|
|||||||
$ kubectl config set-context --current --namespace=awx
|
$ kubectl config set-context --current --namespace=awx
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, create a file named `awx-demo.yaml` in the same folder with the suggested content below. The `metadata.name` you provide will be the name of the resulting AWX deployment.
|
Next, create a file named `awx-demo.yml` in the same folder with the suggested content below. The `metadata.name` you provide will be the name of the resulting AWX deployment.
|
||||||
|
|
||||||
**Note:** If you deploy more than one AWX instance to the same namespace, be sure to use unique names.
|
**Note:** If you deploy more than one AWX instance to the same namespace, be sure to use unique names.
|
||||||
|
|
||||||
@@ -104,7 +126,7 @@ Make sure to add this new file to the list of "resources" in your `kustomization
|
|||||||
resources:
|
resources:
|
||||||
- github.com/ansible/awx-operator/config/default?ref=<tag>
|
- github.com/ansible/awx-operator/config/default?ref=<tag>
|
||||||
# Add this extra line:
|
# Add this extra line:
|
||||||
- awx-demo.yaml
|
- awx-demo.yml
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
This Kubernetes Operator is meant to be deployed in your Kubernetes cluster(s) and can manage one or more AWX instances in any namespace.
|
This Kubernetes Operator is meant to be deployed in your Kubernetes cluster(s) and can be used to install and manage the lifecycle of an AWX instance in the same namespace.
|
||||||
|
|||||||
125
docs/installation/kind-install.md
Normal file
125
docs/installation/kind-install.md
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
# AWX Operator on Kind
|
||||||
|
|
||||||
|
## Kind Install
|
||||||
|
|
||||||
|
Install Kind by running the following
|
||||||
|
|
||||||
|
```
|
||||||
|
# For Intel Macs
|
||||||
|
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-darwin-amd64
|
||||||
|
# For M1 / ARM Macs
|
||||||
|
[ $(uname -m) = arm64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-darwin-arm64
|
||||||
|
chmod +x ./kind
|
||||||
|
mv ./kind /some-dir-in-your-PATH/kind
|
||||||
|
```
|
||||||
|
|
||||||
|
> https://kind.sigs.k8s.io/docs/user/quick-start/
|
||||||
|
|
||||||
|
|
||||||
|
### Create the Kind cluster
|
||||||
|
|
||||||
|
Create a file called `kind.config`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
kind: Cluster
|
||||||
|
nodes:
|
||||||
|
- role: control-plane
|
||||||
|
extraPortMappings:
|
||||||
|
- containerPort: 32000
|
||||||
|
hostPort: 32000
|
||||||
|
listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
|
||||||
|
protocol: tcp # Optional, defaults to tcp
|
||||||
|
- role: worker
|
||||||
|
```
|
||||||
|
|
||||||
|
Then create a cluster using that config
|
||||||
|
|
||||||
|
```
|
||||||
|
kind create cluster --config=kind.config
|
||||||
|
```
|
||||||
|
|
||||||
|
Set cluster context for kubectl
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl cluster-info --context kind-kind
|
||||||
|
```
|
||||||
|
|
||||||
|
Install NGINX Ingress Controller
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## AWX
|
||||||
|
|
||||||
|
Set the namespace context
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl config set-context --current --namespace=awx
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout the tag you want to install from
|
||||||
|
|
||||||
|
```
|
||||||
|
git checkout 2.7.2
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a file named `kustomization.yaml` in the root of your local awx-operator clone. Include the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
|
||||||
|
- github.com/ansible/awx-operator/config/default?ref=2.7.2
|
||||||
|
|
||||||
|
# Set the image tags to match the git version from above
|
||||||
|
images:
|
||||||
|
- name: quay.io/ansible/awx-operator
|
||||||
|
newTag: 2.7.2
|
||||||
|
|
||||||
|
# Specify a custom namespace in which to install AWX
|
||||||
|
namespace: awx
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the following to apply the yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
kubectl apply -k .
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Create a file called `awx-cr.yaml` with the following contents and any configuration changes you may wish to add.
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
apiVersion: awx.ansible.com/v1beta1
|
||||||
|
kind: AWX
|
||||||
|
metadata:
|
||||||
|
name: awx-demo
|
||||||
|
spec:
|
||||||
|
service_type: nodeport
|
||||||
|
nodeport_port: 32000
|
||||||
|
```
|
||||||
|
|
||||||
|
Create your AWX CR
|
||||||
|
|
||||||
|
```
|
||||||
|
oc create -f awx-cr.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Your AWX instance should now be reacheable at http://localhost:32000/
|
||||||
|
|
||||||
|
> If you configured a custom nodeport_port, you can find it by running `kubectl -n awx get svc awx-demo-service`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Cleanup
|
||||||
|
|
||||||
|
When you are done, you can delete all of this by running
|
||||||
|
|
||||||
|
```
|
||||||
|
kind delete cluster
|
||||||
|
```
|
||||||
@@ -41,7 +41,7 @@ stringData:
|
|||||||
type: Opaque
|
type: Opaque
|
||||||
```
|
```
|
||||||
|
|
||||||
> For `host`, a URL resolvable by the cluster could look something like `postgresql.<namespace>.svc.cluster.local`, where `<namespace>` is filled in with the namespace of the AWX deployment you are migrating data from.
|
> For `host`, a URL resolvable by the cluster could look something like `postgresql.<namespace>.svc.<cluster domain>`, where `<namespace>` is filled in with the namespace of the AWX deployment you are migrating data from, and `<cluster domain>` is filled in with the internal kubernretes cluster domain (In most cases it's `cluster.local`).
|
||||||
|
|
||||||
If your AWX deployment is already using an external database server or its database is otherwise not managed
|
If your AWX deployment is already using an external database server or its database is otherwise not managed
|
||||||
by the AWX deployment, you can instead create the same secret as above but omit the `-old-` from the `name`.
|
by the AWX deployment, you can instead create the same secret as above but omit the `-old-` from the `name`.
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
### Upgrading
|
### Upgrading
|
||||||
|
|
||||||
To upgrade AWX, it is recommended to upgrade the awx-operator to the version that maps to the desired version of AWX. To find the version of AWX that will be installed by the awx-operator by default, check the version specified in the `image_version` variable in `roles/installer/defaults/main.yml` for that particular release.
|
To upgrade AWX, it is recommended to upgrade the awx-operator to the version that maps to the desired version of AWX. To find the version of AWX that will be installed by the awx-operator by default, check the version specified in the `DEFAULT_AWX_VERSION` variable for that particular release. You can do so by running the following command
|
||||||
|
```shell
|
||||||
|
AWX_OPERATOR_VERSION=2.8.0
|
||||||
|
docker run --entrypoint="" quay.io/ansible/awx-operator:$AWX_OPERATOR_VERSION bash -c "env | grep DEFAULT_AWX_VERSION"
|
||||||
|
```
|
||||||
|
|
||||||
Apply the awx-operator.yml for that release to upgrade the operator, and in turn also upgrade your AWX deployment.
|
Apply the awx-operator.yml for that release to upgrade the operator, and in turn also upgrade your AWX deployment.
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
- name: Set full resolvable host name for postgres pod
|
- name: Set full resolvable host name for postgres pod
|
||||||
set_fact:
|
set_fact:
|
||||||
resolvable_db_host: '{{ (awx_postgres_type == "managed") | ternary(awx_postgres_host + "." + ansible_operator_meta.namespace + ".svc.cluster.local", awx_postgres_host) }}' # yamllint disable-line rule:line-length
|
resolvable_db_host: '{{ (awx_postgres_type == "managed") | ternary(awx_postgres_host + "." + ansible_operator_meta.namespace + ".svc", awx_postgres_host) }}' # yamllint disable-line rule:line-length
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
|
|
||||||
- name: Get the current resource task pod information.
|
- name: Get the current resource task pod information.
|
||||||
|
|||||||
@@ -233,6 +233,12 @@ ee_pull_credentials_secret: ''
|
|||||||
# emptyDir: {}
|
# emptyDir: {}
|
||||||
extra_volumes: ''
|
extra_volumes: ''
|
||||||
|
|
||||||
|
# Add extra volumes to the Postgres pod. Specify as literal block. E.g.:
|
||||||
|
# postgres_extra_volumes: |
|
||||||
|
# - name: my-volume
|
||||||
|
# emptyDir: {}
|
||||||
|
postgres_extra_volumes: ''
|
||||||
|
|
||||||
# Use these image versions for Ansible AWX.
|
# Use these image versions for Ansible AWX.
|
||||||
|
|
||||||
_image: quay.io/ansible/awx
|
_image: quay.io/ansible/awx
|
||||||
@@ -340,13 +346,14 @@ ee_extra_env: ''
|
|||||||
|
|
||||||
# Mount extra volumes on the AWX task/web containers. Specify as literal block.
|
# Mount extra volumes on the AWX task/web containers. Specify as literal block.
|
||||||
# E.g.:
|
# E.g.:
|
||||||
# task_extra_volume_mounts: ''
|
# task_extra_volume_mounts: |
|
||||||
# - name: my-volume
|
# - name: my-volume
|
||||||
# mountPath: /some/path
|
# mountPath: /some/path
|
||||||
task_extra_volume_mounts: ''
|
task_extra_volume_mounts: ''
|
||||||
web_extra_volume_mounts: ''
|
web_extra_volume_mounts: ''
|
||||||
rsyslog_extra_volume_mounts: ''
|
rsyslog_extra_volume_mounts: ''
|
||||||
ee_extra_volume_mounts: ''
|
ee_extra_volume_mounts: ''
|
||||||
|
postgres_extra_volume_mounts: ''
|
||||||
|
|
||||||
# Add a nodeSelector for the Postgres pods.
|
# Add a nodeSelector for the Postgres pods.
|
||||||
# It must match a node's labels for the pod to be scheduled on that node.
|
# It must match a node's labels for the pod to be scheduled on that node.
|
||||||
|
|||||||
@@ -77,6 +77,20 @@
|
|||||||
- ingress_type | lower == 'route'
|
- ingress_type | lower == 'route'
|
||||||
- route_tls_secret != ''
|
- route_tls_secret != ''
|
||||||
|
|
||||||
|
- name: Wait for {{ deployment_type }}restore to complete
|
||||||
|
kubernetes.core.k8s_info:
|
||||||
|
api_version: "{{ api_version }}"
|
||||||
|
kind: "{{ deployment_type }}restore"
|
||||||
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
|
register: restore_status_check
|
||||||
|
until:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
- (restore_status_check.resources | length == 0) or (restore_status_check.resources | selectattr('spec.deployment_name', 'equalto', ansible_operator_meta.name) | map(attribute='status') | selectattr('restoreComplete', 'defined') | map(attribute='restoreComplete') | list | length > 0)
|
||||||
|
delay: 10
|
||||||
|
retries: 8640
|
||||||
|
ignore_errors: yes
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Include resources configuration tasks
|
- name: Include resources configuration tasks
|
||||||
include_tasks: resources_configuration.yml
|
include_tasks: resources_configuration.yml
|
||||||
|
|
||||||
@@ -91,7 +105,7 @@
|
|||||||
when: awx_task_pod_name != ''
|
when: awx_task_pod_name != ''
|
||||||
register: database_check
|
register: database_check
|
||||||
|
|
||||||
- name: Migrate the database if the K8s resources were updated. # noqa 305
|
- name: Migrate the database if the K8s resources were updated # noqa 305
|
||||||
k8s_exec:
|
k8s_exec:
|
||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
pod: "{{ awx_task_pod_name }}"
|
pod: "{{ awx_task_pod_name }}"
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ data:
|
|||||||
|
|
||||||
INTERNAL_API_URL = 'http://127.0.0.1:8052'
|
INTERNAL_API_URL = 'http://127.0.0.1:8052'
|
||||||
|
|
||||||
# Sets Ansible Collection path
|
|
||||||
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
|
|
||||||
|
|
||||||
# Container environments don't like chroots
|
# Container environments don't like chroots
|
||||||
AWX_PROOT_ENABLED = False
|
AWX_PROOT_ENABLED = False
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ spec:
|
|||||||
type: NodePort
|
type: NodePort
|
||||||
{% elif service_type | lower == "loadbalancer" %}
|
{% elif service_type | lower == "loadbalancer" %}
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
{% if loadbalancer_ip is defined and loadbalancer_ip|length %}
|
{% if loadbalancer_ip is defined and loadbalancer_ip | length %}
|
||||||
loadbalancerip: '{{ loadbalancer_ip }}'
|
loadbalancerip: '{{ loadbalancer_ip }}'
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ spec:
|
|||||||
app.kubernetes.io/instance: 'postgres-{{ supported_pg_version }}-{{ ansible_operator_meta.name }}'
|
app.kubernetes.io/instance: 'postgres-{{ supported_pg_version }}-{{ ansible_operator_meta.name }}'
|
||||||
app.kubernetes.io/component: 'database'
|
app.kubernetes.io/component: 'database'
|
||||||
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
||||||
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
||||||
spec:
|
spec:
|
||||||
{% if image_pull_secret is defined %}
|
{% if image_pull_secret is defined %}
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
@@ -112,6 +112,9 @@ spec:
|
|||||||
- name: postgres-{{ supported_pg_version }}
|
- name: postgres-{{ supported_pg_version }}
|
||||||
mountPath: '{{ postgres_data_path | dirname }}'
|
mountPath: '{{ postgres_data_path | dirname }}'
|
||||||
subPath: '{{ postgres_data_path | dirname | basename }}'
|
subPath: '{{ postgres_data_path | dirname | basename }}'
|
||||||
|
{% if postgres_extra_volume_mounts -%}
|
||||||
|
{{ postgres_extra_volume_mounts | indent(width=12, first=True) }}
|
||||||
|
{% endif %}
|
||||||
resources: {{ postgres_resource_requirements }}
|
resources: {{ postgres_resource_requirements }}
|
||||||
{% if postgres_selector %}
|
{% if postgres_selector %}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
@@ -120,6 +123,10 @@ spec:
|
|||||||
{% if postgres_tolerations %}
|
{% if postgres_tolerations %}
|
||||||
tolerations:
|
tolerations:
|
||||||
{{ postgres_tolerations | indent(width=8) }}
|
{{ postgres_tolerations | indent(width=8) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if postgres_extra_volumes %}
|
||||||
|
volumes:
|
||||||
|
{{ postgres_extra_volumes | indent(width=8, first=False) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
volumeClaimTemplates:
|
volumeClaimTemplates:
|
||||||
- metadata:
|
- metadata:
|
||||||
@@ -130,7 +137,15 @@ spec:
|
|||||||
{% if postgres_storage_class is defined %}
|
{% if postgres_storage_class is defined %}
|
||||||
storageClassName: '{{ postgres_storage_class }}'
|
storageClassName: '{{ postgres_storage_class }}'
|
||||||
{% endif %}
|
{% endif %}
|
||||||
resources: {{ postgres_storage_requirements }}
|
resources:
|
||||||
|
{% if postgres_storage_requirements.limits.storage | default("", true) %}
|
||||||
|
limits:
|
||||||
|
storage: {{ postgres_storage_requirements.limits.storage }}
|
||||||
|
{% endif %}
|
||||||
|
{% if postgres_storage_requirements.requests.storage | default("", true) %}
|
||||||
|
requests:
|
||||||
|
storage: {{ postgres_storage_requirements.requests.storage }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Postgres Service.
|
# Postgres Service.
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
backup_pvc: "{{ this_backup['resources'][0]['status']['backupClaim'] }}"
|
backup_pvc: "{{ this_backup['resources'][0]['status']['backupClaim'] }}"
|
||||||
backup_dir: "{{ this_backup['resources'][0]['status']['backupDirectory'] }}"
|
backup_dir: "{{ this_backup['resources'][0]['status']['backupDirectory'] }}"
|
||||||
when:
|
when:
|
||||||
- backup_name != '' or backup_name is defined
|
- backup_name is defined and backup_name != ''
|
||||||
|
|
||||||
# Check to make sure provided pvc exists, error loudly if not. Otherwise, the management pod will just stay in pending state forever.
|
# Check to make sure provided pvc exists, error loudly if not. Otherwise, the management pod will just stay in pending state forever.
|
||||||
- name: Check provided PVC exists
|
- name: Check provided PVC exists
|
||||||
|
|||||||
@@ -82,6 +82,26 @@
|
|||||||
-p {{ awx_postgres_port }}
|
-p {{ awx_postgres_port }}
|
||||||
no_log: "{{ no_log }}"
|
no_log: "{{ no_log }}"
|
||||||
|
|
||||||
|
- name: Set drop db command
|
||||||
|
set_fact:
|
||||||
|
pg_drop_db: >-
|
||||||
|
echo 'DROP DATABASE {{ awx_postgres_database }} WITH (FORCE);' | PGPASSWORD='{{ awx_postgres_pass }}' psql
|
||||||
|
-U {{ awx_postgres_user }}
|
||||||
|
-h {{ resolvable_db_host }}
|
||||||
|
-d postgres
|
||||||
|
-p {{ awx_postgres_port }}
|
||||||
|
no_log: "{{ no_log }}"
|
||||||
|
|
||||||
|
- name: Set create db command
|
||||||
|
set_fact:
|
||||||
|
pg_create_db: >-
|
||||||
|
echo 'CREATE DATABASE {{ awx_postgres_database }} WITH OWNER = {{ awx_postgres_user }};' | PGPASSWORD='{{ awx_postgres_pass }}' psql
|
||||||
|
-U {{ awx_postgres_user }}
|
||||||
|
-h {{ resolvable_db_host }}
|
||||||
|
-d postgres
|
||||||
|
-p {{ awx_postgres_port }}
|
||||||
|
no_log: "{{ no_log }}"
|
||||||
|
|
||||||
- name: Restore database dump to the new postgresql container
|
- name: Restore database dump to the new postgresql container
|
||||||
k8s_exec:
|
k8s_exec:
|
||||||
namespace: "{{ backup_pvc_namespace }}"
|
namespace: "{{ backup_pvc_namespace }}"
|
||||||
@@ -104,6 +124,10 @@
|
|||||||
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
||||||
echo keepalive_pid: $keepalive_pid
|
echo keepalive_pid: $keepalive_pid
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
if {{ force_drop_db }}; then
|
||||||
|
{{ pg_drop_db }}
|
||||||
|
{{ pg_create_db }}
|
||||||
|
fi
|
||||||
cat {{ backup_dir }}/tower.db | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
cat {{ backup_dir }}/tower.db | PGPASSWORD='{{ awx_postgres_pass }}' {{ pg_restore }}
|
||||||
set +e +o pipefail
|
set +e +o pipefail
|
||||||
echo 'Successful'
|
echo 'Successful'
|
||||||
|
|||||||
Reference in New Issue
Block a user