Skip to content
Open
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ed1bdb1
wip
naemono Oct 7, 2025
b439a1b
Adding skeleton
naemono Dec 1, 2025
a24a3c6
renaming crds
naemono Dec 1, 2025
8716505
skeleton of controller logic.
naemono Dec 1, 2025
193a0de
Adding reconciliation logic.
naemono Dec 1, 2025
f32b643
Update config parsing
naemono Dec 1, 2025
8fc5d45
Adding unit tests
naemono Dec 1, 2025
5c81c1a
Optimization
naemono Dec 1, 2025
1d0456a
Nearly functional without ssl verification
naemono Dec 1, 2025
99c90f0
Fixing indentation
naemono Dec 2, 2025
2b925b3
Cleanup. deploys in same ns as policy.
naemono Dec 2, 2025
6cb9347
functional autoops using file-realm users
naemono Dec 3, 2025
4c8c1ba
Functional api keys autoops integration
naemono Dec 4, 2025
a52095f
Cleanup. Adding additional unit tests
naemono Dec 4, 2025
75e717f
Merge branch 'main' into ccm-integration
naemono Dec 4, 2025
d77a53b
make generate
naemono Dec 4, 2025
edadd1c
Better handle the state/status.
naemono Dec 4, 2025
db9cb3b
cleanup
naemono Dec 4, 2025
578c3a9
More cleanup
naemono Dec 4, 2025
275e1a1
lowercase
naemono Dec 4, 2025
a7e3620
cleanup
naemono Dec 4, 2025
335bc67
const for label name
naemono Dec 4, 2025
222589b
cleanup
naemono Dec 4, 2025
0c190d4
more cleanup
naemono Dec 4, 2025
68ca200
Skip api keys in remote cluster controller managed by autoops
naemono Dec 4, 2025
2204c47
Add helm charts
naemono Dec 4, 2025
7e75762
Re-enable license checks
naemono Dec 4, 2025
065f3d7
Changes from initial review.
naemono Dec 5, 2025
e687945
Cleanup some of the reconcile logic.
naemono Dec 5, 2025
8b9a871
Adjust to allow error counts to be calculated.
naemono Dec 5, 2025
f4e1734
Nolint
naemono Dec 5, 2025
25ff367
Lint issues
naemono Dec 5, 2025
6271eed
re-enable temp_resource_id, but generate it
naemono Dec 5, 2025
36b8fe5
remove temp resource id
naemono Dec 5, 2025
db322a5
adjust description of autoops crd
naemono Dec 8, 2025
0ba6849
ensuring deployment name max length isnt exceeded
naemono Dec 8, 2025
2e5ccd1
adjust naming to avoid long names
naemono Dec 8, 2025
83f31b5
update charts
naemono Dec 9, 2025
4110a01
review adjustments
naemono Dec 9, 2025
2e48e42
ensuring secrets are cleaned up when missing es
naemono Dec 9, 2025
86de699
fix comments
naemono Dec 9, 2025
82cb695
cleanup deployment code
naemono Dec 9, 2025
35da2a6
update helm charts adding additional options
naemono Dec 9, 2025
475348d
also watch the autoops ca secret
naemono Dec 9, 2025
a6b70ff
dont check ready status in called func
naemono Dec 9, 2025
e863ad6
adjust helm chart to allow existing secret
naemono Dec 9, 2025
6797418
also hash secret data
naemono Dec 9, 2025
7a0b47f
fix unit tests
naemono Dec 9, 2025
458cf32
fix helm tests for autoops
naemono Dec 9, 2025
70ca228
make generate
naemono Dec 9, 2025
c49cdc2
fix annotation size
naemono Dec 10, 2025
55c95cc
use create, not apply
naemono Dec 10, 2025
153b6c7
add patch for crd; revert create vs apply change
naemono Dec 10, 2025
8331edb
adding back additional hashing
naemono Dec 10, 2025
16d1e7a
using namers for all
naemono Dec 10, 2025
c71af79
reduce size of namer file name
naemono Dec 10, 2025
e196050
centralize autoops naming
naemono Dec 10, 2025
a08eda6
fix linting
naemono Dec 10, 2025
f6209d5
better control namer length
naemono Dec 10, 2025
7dc93ad
fix updatewithphase transitions
naemono Dec 10, 2025
f5d35fe
making the naming consistent for secrets
naemono Dec 10, 2025
f8e6e25
again; consistent naming
naemono Dec 10, 2025
d2a34e5
adding better error handling
naemono Dec 10, 2025
46eca6d
add event when not reconciled
naemono Dec 10, 2025
e982d40
use correct configmap name
naemono Dec 10, 2025
c4913a2
cleanup logger; pass back errors via result
naemono Dec 11, 2025
63b79df
make configref.secret required in helm chart
naemono Dec 11, 2025
e8b10f6
add config sample for autoops
naemono Dec 11, 2025
cbfdc0e
use extract nsn func
naemono Dec 11, 2025
9f0729f
fix linter, unit tests
naemono Dec 11, 2025
4e41ee8
try linter values file.
naemono Dec 11, 2025
ece73b5
Fix lint values
naemono Dec 11, 2025
5e51bbb
Revert config changes
naemono Dec 11, 2025
067dab3
Add back autoops policy
naemono Dec 11, 2025
5738efe
Remove unneeded file
naemono Dec 11, 2025
ffa255a
remove unneeded helm values
naemono Dec 11, 2025
f710577
remove unused var
naemono Dec 11, 2025
4219c51
Fix comment
naemono Dec 11, 2025
5b058aa
Fix linting issue
naemono Dec 11, 2025
3bf4607
Temp disable enterprise check
naemono Dec 11, 2025
c28db04
Review changes.
naemono Dec 12, 2025
f62cee3
Use the common funcs in common/apikey
naemono Dec 12, 2025
4384554
Move parseSecret -> validateSecret
naemono Dec 12, 2025
3a3c083
rename reconciler.
naemono Dec 12, 2025
17b69cf
Adjust cleanup on delete logic.
naemono Dec 12, 2025
f38db24
Adding unit tests for internal reconcile.
naemono Dec 12, 2025
4ab8be8
unexport newstate
naemono Dec 12, 2025
739bfdd
Update name of reconciler.
naemono Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
agentv1alpha1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/agent/v1alpha1"
apmv1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/apm/v1"
apmv1beta1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/apm/v1beta1"
autoopsv1alpha1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/autoops/v1alpha1"
beatv1beta1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/beat/v1beta1"
esv1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/elasticsearch/v1"
esv1beta1 "github.com/elastic/cloud-on-k8s/v3/pkg/apis/elasticsearch/v1beta1"
Expand All @@ -58,6 +59,7 @@ import (
"github.com/elastic/cloud-on-k8s/v3/pkg/controller/apmserver"
"github.com/elastic/cloud-on-k8s/v3/pkg/controller/association"
associationctl "github.com/elastic/cloud-on-k8s/v3/pkg/controller/association/controller"
"github.com/elastic/cloud-on-k8s/v3/pkg/controller/autoops"
"github.com/elastic/cloud-on-k8s/v3/pkg/controller/autoscaling"
esavalidation "github.com/elastic/cloud-on-k8s/v3/pkg/controller/autoscaling/elasticsearch/validation"
"github.com/elastic/cloud-on-k8s/v3/pkg/controller/beat"
Expand Down Expand Up @@ -915,6 +917,7 @@ func registerControllers(mgr manager.Manager, params operator.Parameters, access
{name: "Agent", registerFunc: agent.Add},
{name: "Maps", registerFunc: maps.Add},
{name: "StackConfigPolicy", registerFunc: stackconfigpolicy.Add},
{name: "AutoOpsAgentPolicy", registerFunc: autoops.Add},
{name: "Logstash", registerFunc: logstash.Add},
}

Expand Down Expand Up @@ -994,6 +997,7 @@ func garbageCollectSoftOwnedSecrets(ctx context.Context, k8sClient k8s.Client) {
agentv1alpha1.Kind: &agentv1alpha1.Agent{},
emsv1alpha1.Kind: &emsv1alpha1.ElasticMapsServer{},
policyv1alpha1.Kind: &policyv1alpha1.StackConfigPolicy{},
autoopsv1alpha1.Kind: &autoopsv1alpha1.AutoOpsAgentPolicy{},
logstashv1alpha1.Kind: &logstashv1alpha1.Logstash{},
}); err != nil {
log.Error(err, "Orphan secrets garbage collection failed, will be attempted again at next operator restart.")
Expand Down Expand Up @@ -1038,6 +1042,7 @@ func setupWebhook(
&kbv1beta1.Kibana{},
&emsv1alpha1.ElasticMapsServer{},
&policyv1alpha1.StackConfigPolicy{},
&autoopsv1alpha1.AutoOpsAgentPolicy{},
}
for _, obj := range webhookObjects {
commonwebhook.SetupValidatingWebhookWithConfig(&commonwebhook.Config{
Expand Down
167 changes: 167 additions & 0 deletions config/crds/v1/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,173 @@ spec:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
name: autoopsagentpolicies.autoops.k8s.elastic.co
spec:
group: autoops.k8s.elastic.co
names:
categories:
- elastic
kind: AutoOpsAgentPolicy
listKind: AutoOpsAgentPolicyList
plural: autoopsagentpolicies
shortNames:
- autoops
singular: autoopsagentpolicy
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: Ready resources
jsonPath: .status.ready
name: Ready
type: string
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: AutoOpsAgentPolicy represents an Elastic AutoOps Policy resource
in a Kubernetes cluster.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
properties:
config:
description: |-
Config holds the AutoOpsAgentPolicy configuration.
The contents of the referenced secret requires the following format:
kind: Secret
apiVersion: v1
metadata:
name: autoops-agent-policy-config
stringData:
ccmApiKey: aslkfjsldkjfslkdjflksdjfl
autoOpsOTelURL: https://otel.auto-ops.console.qa.cld.elstc.co
autoOpsToken: skdfjdskjf
properties:
secretName:
description: SecretName is the name of the secret.
type: string
type: object
image:
description: Image is the AutoOps Agent Docker image to deploy.
type: string
podTemplate:
description: PodTemplate provides customisation options (labels, annotations,
affinity rules, resource requests, and so on) for the Agent pods
type: object
x-kubernetes-preserve-unknown-fields: true
resourceSelector:
description: |-
ResourceSelector is a label selector for the resources to be configured.
Any Elasticsearch instances that match the selector will be configured to send data to AutoOps.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
revisionHistoryLimit:
description: RevisionHistoryLimit is the number of revisions to retain
to allow rollback in the underlying Deployment.
format: int32
type: integer
version:
description: Version of the AutoOpsAgentPolicy.
type: string
required:
- version
type: object
status:
properties:
errors:
description: Errors is the number of resources that are in an error
state.
type: integer
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this AutoOpsAgentPolicy.
format: int64
type: integer
phase:
description: Phase is the phase of the AutoOpsAgentPolicy.
type: string
ready:
description: Ready is the number of resources that are in a ready
state.
type: integer
resources:
description: Resources is the number of resources that match the ResourceSelector.
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
Expand Down
8 changes: 8 additions & 0 deletions config/crds/v1/patches/autoopsagentpolicy-patches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Using `kubectl apply` stores the complete CRD file as an annotation,
# which may be too big for the annotations size limit.
# One way to mitigate this problem is to remove the (huge) podTemplate properties from the CRD.
# It also avoids the problem of having any k8s-version specific field in the Pod schema,
# that would maybe not match the user's k8s version.
- op: remove
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/podTemplate/properties

9 changes: 8 additions & 1 deletion config/crds/v1/patches/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@ patches:
kind: CustomResourceDefinition
name: elasticmapsservers.maps.k8s.elastic.co
path: maps-patches.yaml
# custom patches for Logstash
# custom patches for Logstash
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: logstashes.logstash.k8s.elastic.co
path: logstash-patches.yaml
# custom patches for AutoOpsAgentPolicy
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: autoopsagentpolicies.autoops.k8s.elastic.co
path: autoopsagentpolicy-patches.yaml


Loading