SKD version = 1.25.2
make deploy OPERATOR_REPLICAS=0
make run
The run command executes with the local GO environment the main.go file
KUBECONFIG env var)Under the Carbon Black Container Cluster CR:
spec:
apiGatewaySpec:
adapter: {MY-ADAPTER-NAME}
Change {MY-ADAPTER-NAME} to your control plane adapter name.
The default value is containers
Under cbcontainers/state/hardening/objects
for enforcer_deployment.go or state_reporter_deployment.go
You can change the values on the top of the file to suite your needs.
One of the new features in apiextensions/v1 version of CustomResourceDefinitions is defaults in the OpenAPISchema. These are supported by kubebuilder via tags - e.g. kubebuilder:default=something
For backwards compatibility reasons, all defaults should also be implemented and set in the controllers to ensure they work on clusters v1.15 and below.
One issue with defaults is that kubebuilder does not support empty object as default value - see related issue. The issue is about maps but the same code causes problems with objects.
What this means is that the following spec will not apply the default for foo unless the user specifies bar.
spec:
properties:
bar:
properties:
foo:
default: 10
type: integer
So applying this YAML will lead to empty object for bar being saved:
spec: {}
Instead, applying
spec: { bar: {} }
would work as expected and save the following object:
spec: { bar: { foo: 10 }}
This would work as expected when adding an empty object default to the example as below:
spec:
properties:
bar:
default: {}
properties:
foo:
default: 10
type: integer
Unfortunately kubebuilder cannot produce that output today.
Therefore, a special make target works around this by replacing all instance of <> with {} so using kubebuilder:default=<> will produce the correct output.
Defaulting is not supported by v1beta1 versions of CRDs so warnings are expected when generating those since kubebuilder.
To debug locally, run make run-delve which will build and start a delve debugger in headless mode.
Then use your editor to start a remote session and connect to the delve instance.
For goland, the built-in go remote configuration works fine.