Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cpu autoscaling #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

vitorguidi
Copy link
Owner

@vitorguidi vitorguidi commented Jan 14, 2024

Motivation

Placeholder PR so I can iterate with @cezarguimaraes

Caveats

cass-operator depends on go/v4-alpha, so we need to use operator sdk 1.32

Setting up boilerplate

operator-sdk create api --group cassandra.datastax.com --version v1beta1 --kind CassandraDataCenterAutoscaler --resource --controller

this creates things on places different than the standard project structure for this repo, but does not matter for now. will fix iff the community is interested in the feature, for now it is just an exercise

Testing

Comment out webhook setup with manager in cmd/main.go

/*
		if !operConfig.DisableWebhooks {
			if err = (&api.CassandraDatacenter{}).SetupWebhookWithManager(mgr); err != nil {
				setupLog.Error(err, "unable to create webhook", "webhook", "CassandraDatacenter")
				os.Exit(1)
			}
		}
	*/

make generate
make install
make run
k apply -f config/samples/cassandra.datastax.com_v1beta1_cassandradatacenterautoscaler.yaml

if all goes well, we should see the logs in the operator when the reconcile happens:

2024-01-14T14:03:46.449-0300    INFO    Bem vindo ao maravilhoso mundo de autoscaling. Recebi o evento do recurso %s    {"controller": "cassandradatacenterautoscaler", "controllerGroup": "cassandra.datastax.com.cassandra.datastax.com", "controllerKind": "CassandraDataCenterAutoscaler", "CassandraDataCenterAutoscaler": {"name":"cassandradatacenterautoscaler-sample","namespace":"cassandra"}, "namespace": "cassandra", "name": "cassandradatacenterautoscaler-sample", "reconcileID": "8caf7afd-6c72-4d36-8ff3-6430ab443ed1", "resource name": {"namespace": "cassandra", "name": "cassandradatacenterautoscaler-sample"}}
2024-01-14T14:03:46.449-0300    INFO    Datacenter Ref = cassandra      {"controller": "cassandradatacenterautoscaler", "controllerGroup": "cassandra.datastax.com.cassandra.datastax.com", "controllerKind": "CassandraDataCenterAutoscaler", "CassandraDataCenterAutoscaler": {"name":"cassandradatacenterautoscaler-sample","namespace":"cassandra"}, "namespace": "cassandra", "name": "cassandradatacenterautoscaler-sample", "reconcileID": "8caf7afd-6c72-4d36-8ff3-6430ab443ed1"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant