This project is a Kubernetes Operator for managing GitHub repositories, built using the Ansible Operator SDK. It enables you to declaratively create, update, and delete GitHub repositories directly from your Kubernetes cluster by defining custom resources.
This project is for educational purposes only and should not be used in production environments.
It is designed to demonstrate Kubernetes operator development concepts and GitHub API integration patterns.
For production use cases, consider using established solutions like crossplane provider-upjet-github
.
- Declarative management of GitHub repositories via Kubernetes Custom Resources
- Automated repository creation, updates, and deletion
- Leverages Ansible playbooks for GitHub API interactions
- Kubernetes cluster (v1.31+ recommended)
- Operator SDK
- Ansible
- GitHub personal access token with repo permissions
- Clone this repository:
git clone https://github.com/thatmlopsguy/github-repo-operator-ansible.git
cd github-repo-operator-ansible
- Build and deploy the operator to your Kubernetes cluster:
make install
make deploy
- Set your GitHub credentials as Kubernetes secrets or environment variables as required by the operator.
Create a GitHubRepo
custom resource to manage a repository. Example:
apiVersion: github.thatmlopsguy.com/v1alpha1
kind: GitHubRepo
metadata:
name: example-repo
spec:
name: example-repo
description: "Managed by Kubernetes!"
private: true
Apply the resource:
kubectl apply -k config/samples
The operator will reconcile the state and ensure the repository exists in your GitHub account.
To set up this project from scratch, follow these steps:
- Install Operator SDK
Use the provided script to install the latest operator-sdk binary
bash scripts/install-operator-sdk.sh
- Initialize the Operator Project
Run the following command to bootstrap the operator-sdk project with the Ansible plugin:
operator-sdk init --domain=thatmlopsguy.com --plugins=ansible --project-version=3
This will scaffold the necessary files and directories for an Ansible-based Kubernetes operator.
Contributions are welcome! Please open issues or pull requests for improvements and bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.