A Kubernetes operator that integrates Red Hat Advanced Cluster Management (ACM) with krkn-operator for chaos engineering workflows.
The krkn-operator-acm is designed to automatically discover and configure access to managed clusters in a Red Hat ACM environment. When a KrknTargetRequest custom resource is created, the operator:
- Queries ACM for all managed clusters
- Retrieves authentication credentials from cluster namespaces
- Generates kubeconfig files for each managed cluster
- Stores all cluster access information in a Kubernetes secret
- Updates the request status with cluster metadata
This automation simplifies the process of targeting multiple clusters for chaos engineering scenarios, eliminating the need for manual credential management and configuration.
┌─────────────────────┐
│ Create │
│ KrknTargetRequest │
│ (status: pending) │
└──────────┬──────────┘
│
v
┌─────────────────────┐
│ Operator watches │
│ for pending │
│ requests │
└──────────┬──────────┘
│
v
┌─────────────────────┐
│ Query ACM API for │
│ managed clusters │
└──────────┬──────────┘
│
v
┌─────────────────────┐
│ For each cluster: │
│ - Get secrets │
│ - Generate config │
└──────────┬──────────┘
│
v
┌─────────────────────┐
│ Create secret with │
│ UUID as name │
└──────────┬──────────┘
│
v
┌─────────────────────┐
│ Update request │
│ status: Completed │
└─────────────────────┘
- Create a KrknTargetRequest:
apiVersion: krkn.krkn-chaos.dev/v1alpha1
kind: KrknTargetRequest
metadata:
name: chaos-test-1
spec:
uuid: "chaos-test-uuid-001"
status:
status: "pending"-
Operator processes the request and creates a secret named
chaos-test-uuid-001 -
Check the results:
# View the updated request
kubectl get krkntargetrequest chaos-test-1 -o yaml
# Example output (multi-operator):
# status:
# status: Completed
# created: "2025-12-01T10:00:00Z"
# completed: "2025-12-01T10:01:30Z"
# targetData:
# krkn-operator-acm:
# - cluster-name: local-cluster
# cluster-api-url: https://api.acm-hub-krkn.aws.rhperfscale.org:6443
# - cluster-name: managed-cluster-krkn
# cluster-api-url: https://api.acm-managed-krkn.aws.rhperfscale.org:6443
# Retrieve the secret
kubectl get secret chaos-test-uuid-001 -o jsonpath='{.data.managed-clusters}' | base64 -d | jq .- Use the kubeconfigs for chaos testing:
# Extract a specific cluster's kubeconfig from multi-operator format
kubectl get secret chaos-test-uuid-001 -o jsonpath='{.data.managed-clusters}' | \
base64 -d | jq -r '.["krkn-operator-acm"]["local-cluster"].kubeconfig' | base64 -d > local-cluster.kubeconfig
# Test access
KUBECONFIG=local-cluster.kubeconfig kubectl get nodesThe krkn-operator-acm supports running multiple operator instances simultaneously, each targeting different cluster management systems (ACM, Hypershift, etc.). This architecture allows for:
- Horizontal Scalability: Multiple operators can process the same KrknTargetRequest
- Provider Diversity: Different operators can contribute cluster data from different sources
- Dynamic Completion: Requests only complete when all active providers have contributed
- KrknOperatorTargetProvider CRD: Registers each operator instance and tracks its active state
- ConfigMap-based Configuration: Each operator reads its configuration from a ConfigMap
- Coordinated Completion: Requests complete only when data from all active providers is collected
┌─────────────────────┐ ┌─────────────────────┐
│ Operator 1 (ACM) │ │ Operator 2 (HCP) │
│ Registers as │ │ Registers as │
│ "krkn-operator-acm" │ │ "krkn-operator-hcp" │
└──────────┬──────────┘ └──────────┬──────────┘
│ │
v v
┌────────────────────────────────────┐
│ KrknOperatorTargetProvider CRDs │
│ - krkn-operator-acm (active: true) │
│ - krkn-operator-hcp (active: true) │
└────────────────┬───────────────────┘
│
v
┌────────────────────┐
│ KrknTargetRequest │
│ (status: pending) │
└───────┬────────────┘
│
┌────────────┴────────────┐
v v
┌──────────┐ ┌──────────┐
│ Op1 adds │ │ Op2 adds │
│ ACM data │ │ HCP data │
└────┬─────┘ └─────┬────┘
│ │
└────────────┬───────────┘
v
┌─────────────────────┐
│ targetData: │
│ krkn-operator-acm: │
│ - cluster1 │
│ krkn-operator-hcp: │
│ - cluster2 │
└──────────┬──────────┘
v
┌─────────────────────┐
│ status: Completed │
│ (2/2 providers) │
└─────────────────────┘
KrknTargetRequest (krkn.krkn-chaos.dev/v1alpha1):
- Spec:
uuid(string): Unique identifier for the request
- Status:
status(string): Current state - "pending" or "Completed"created(timestamp): When the request was createdcompleted(timestamp): When all providers finished processingtargetData(map[string][]ClusterTarget): Cluster data organized by operator name- Key: operator-name (e.g., "krkn-operator-acm")
- Value: Array of cluster targets from that operator
KrknOperatorTargetProvider (krkn.krkn-chaos.dev/v1alpha1):
- Spec:
operatorName(string): Unique identifier for this operator instanceactive(bool): Whether this provider should be counted for completion logictimestamp(timestamp): Last heartbeat/registration time
Each operator instance requires a ConfigMap for configuration:
apiVersion: v1
kind: ConfigMap
metadata:
name: krkn-operator-config
namespace: default
data:
operator-name: "krkn-operator-acm"
operator-namespace: "default"Configuration Fields:
operator-name: Unique identifier used in targetData keys and provider registrationoperator-namespace: Namespace where the operator manages resources
The operator creates a secret with multi-operator support:
{
"krkn-operator-acm": {
"cluster1": {
"cluster-name": "local-cluster",
"cluster-api": "https://api.example.com:6443",
"kubeconfig": "<base64-encoded-kubeconfig>"
}
},
"krkn-operator-hcp": {
"cluster2": {
"cluster-name": "hcp-cluster",
"cluster-api": "https://api.hcp.example.com:6443",
"kubeconfig": "<base64-encoded-kubeconfig>"
}
}
}The operator requires:
- Read access to ACM ManagedCluster resources
- Read access to application-manager secrets in cluster namespaces
- Create/update access to secrets in the operator namespace
- Full access to KrknTargetRequest CRs
- Full access to KrknOperatorTargetProvider CRs
- Read access to ConfigMaps in the operator namespace
- go version v1.24.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/krkn-operator-acm:tagNOTE: This image ought to be published in the personal registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don’t work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/krkn-operator-acm:tagNOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.
Create instances of your solution You can apply the samples (examples) from the config/sample:
kubectl apply -k config/samples/NOTE: Ensure that the samples has default values to test it out.
Delete the instances (CRs) from the cluster:
kubectl delete -k config/samples/Delete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeployFollowing the options to release and provide this solution to the users.
- Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/krkn-operator-acm:tagNOTE: The makefile target mentioned above generates an 'install.yaml' file in the dist directory. This file contains all the resources built with Kustomize, which are necessary to install this project without its dependencies.
- Using the installer
Users can just run 'kubectl apply -f ' to install the project, i.e.:
kubectl apply -f https://raw.githubusercontent.com/<org>/krkn-operator-acm/<tag or branch>/dist/install.yaml- Build the chart using the optional helm plugin
operator-sdk edit --plugins=helm/v1-alpha- See that a chart was generated under 'dist/chart', and users can obtain this solution from there.
NOTE: If you change the project, you need to update the Helm Chart using the same command above to sync the latest changes. Furthermore, if you create webhooks, you need to use the above command with the '--force' flag and manually ensure that any custom configuration previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml' is manually re-applied afterwards.
// TODO(user): Add detailed information on how you would like others to contribute to this project
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
Copyright 2025.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.