Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 2f202ff

Browse files
authored
Changed API namespace and CRD (#67)
o11y.splunk.com:SplunkOtelAgent > otel.splunk.com:Agent
1 parent cfecce4 commit 2f202ff

File tree

70 files changed

+412
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+412
-468
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ensure-generate-is-noop: set-image-controller generate bundle
5757
@# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check
5858
@git restore config/manager/kustomization.yaml
5959
# TODO(splunk): Check if resources are in sync another way, this only checks if the resources are in sync from the last commit.
60-
@git diff --exit-code apis/o11y/v1alpha1/zz_generated.*.go || (echo "Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1)
60+
@git diff --exit-code apis/otel/v1alpha1/zz_generated.*.go || (echo "Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1)
6161
@git diff --exit-code bundle config || (echo "Build failed: the bundle, config files has been changed but the generated bundle, config files aren't up to date. Run 'make bundle' and update your PR." && exit 1)
6262

6363

PROJECT

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ resources:
1212
namespaced: true
1313
controller: true
1414
domain: splunk.com
15-
group: o11y
16-
kind: SplunkOtelAgent
17-
path: github.com/signalfx/splunk-otel-collector-operator/apis/o11y/v1alpha1
15+
group: otel
16+
kind: Agent
17+
path: github.com/signalfx/splunk-otel-collector-operator/apis/otel/v1alpha1
1818
version: v1alpha1
1919
webhooks:
2020
defaulting: true

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Once the `splunk-otel--operator` deployment is ready, create an Splunk OpenTelem
3939

4040
```console
4141
$ kubectl apply -f - <<EOF
42-
apiVersion: o11y.splunk.com/v1alpha1
43-
kind: SplunkOtelAgent
42+
apiVersion: otel.splunk.com/v1alpha1
43+
kind: Agent
4444
metadata:
4545
name: splunk-otel
4646
namespace: splunk-otel-operator-system
@@ -72,7 +72,7 @@ spec:
7272
image: my-java-app:latest
7373
```
7474
75-
Then you can automatically instrument it by add `o11y.splunk.com/inject-java: "true"` to the Pod spec (not the deployment) so that it would look like the following:
75+
Then you can automatically instrument it by add `otel.splunk.com/inject-java: "true"` to the Pod spec (not the deployment) so that it would look like the following:
7676

7777
```yaml
7878
apiVersion: apps/v1
@@ -83,7 +83,7 @@ spec:
8383
template:
8484
metadata:
8585
annotations:
86-
o11y.splunk.com/inject-java: "true"
86+
otel.splunk.com/inject-java: "true"
8787
spec:
8888
containers:
8989
- name: my-java-app
@@ -94,11 +94,11 @@ This will automatically inject [Splunk OpenTelemetry Java Agent](github.com/sign
9494

9595
Right now the following annotations are supported:
9696

97-
### o11y.splunk.com/inject-java
97+
### otel.splunk.com/inject-java
9898

9999
When this instrumentation is set to `"true"` on a pod, the operator automatically instruments the pod with the Splunk OpenTelemetry Java agent and configures it to send all telemetry data to the OpenTelemetry agents managed by the operator.
100100

101-
### o11y.splunk.com/inject-config
101+
### otel.splunk.com/inject-config
102102

103103
When this instrumentation is set to `"true"` on a pod, the operator only configures the pod to send all telemetry data to the OpenTelemetry agents managed by the operator. Pods are not instrumented in this case and that is left to the user.
104104

File renamed without changes.

apis/o11y/v1alpha1/groupversion_info.go renamed to apis/otel/v1alpha1/groupversion_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Package v1 contains API Schema definitions for the o11y v1 API group
15+
// Package v1 contains API Schema definitions for the otel v1 API group
1616
//+kubebuilder:object:generate=true
17-
//+groupName=o11y.splunk.com
17+
//+groupName=otel.splunk.com
1818
package v1alpha1
1919

2020
import (
@@ -24,7 +24,7 @@ import (
2424

2525
var (
2626
// GroupVersion is group version used to register these objects.
27-
GroupVersion = schema.GroupVersion{Group: "o11y.splunk.com", Version: "v1alpha1"}
27+
GroupVersion = schema.GroupVersion{Group: "otel.splunk.com", Version: "v1alpha1"}
2828

2929
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3030
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

apis/o11y/v1alpha1/splunkotelagent_types.go renamed to apis/otel/v1alpha1/splunkotelagent_types.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2323
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2424

25-
type SplunkCollectorSpec struct {
25+
type CollectorSpec struct {
2626
// Disabled determines whether this spec will be depoyed or not.
2727
// +kubebuilder:validation:Optional
2828
// +operator-sdk:csv:customresourcedefinitions:type=spec
@@ -127,8 +127,8 @@ type AutoInstrumentation struct {
127127
Image string `json:"image,omitempty"`
128128
}
129129

130-
// SplunkOtelAgentSpec defines the desired state of SplunkOtelAgent.
131-
type SplunkOtelAgentSpec struct {
130+
// AgentSpec defines the desired state of SplunkOtelAgent.
131+
type AgentSpec struct {
132132
// ClusterName is the name of the Kubernetes cluster. This will be used to identify this cluster in Splunk dashboards.
133133
// +required
134134
// +kubebuilder:validation:Required
@@ -149,21 +149,21 @@ type SplunkOtelAgentSpec struct {
149149
// Agent is a Splunk OpenTelemetry Collector instance deployed as an agent on every node.
150150
// +kubebuilder:validation:Optional
151151
// +operator-sdk:csv:customresourcedefinitions:type=spec
152-
Agent SplunkCollectorSpec `json:"agent,omitempty"`
152+
Agent CollectorSpec `json:"agent,omitempty"`
153153

154154
// ClusterReceiver is a single instance Splunk OpenTelemetry Collector deployement used to monitor the entire cluster.
155155
// +kubebuilder:validation:Optional
156156
// +operator-sdk:csv:customresourcedefinitions:type=spec
157-
ClusterReceiver SplunkCollectorSpec `json:"clusterReceiver,omitempty"`
157+
ClusterReceiver CollectorSpec `json:"clusterReceiver,omitempty"`
158158

159159
// ClusterReceiver is a Splunk OpenTelemetry Collector deployement used to export data to Splunk APM.
160160
// +kubebuilder:validation:Optional
161161
// +operator-sdk:csv:customresourcedefinitions:type=spec
162-
Gateway SplunkCollectorSpec `json:"gateway,omitempty"`
162+
Gateway CollectorSpec `json:"gateway,omitempty"`
163163
}
164164

165-
// SplunkOtelAgentStatus defines the observed state of SplunkOtelAgent.
166-
type SplunkOtelAgentStatus struct {
165+
// AgentStatus defines the observed state of SplunkOtelAgent.
166+
type AgentStatus struct {
167167
// Version of the managed OpenTelemetry Collector (operand).
168168
Version string `json:"version,omitempty"`
169169

@@ -178,24 +178,24 @@ type SplunkOtelAgentStatus struct {
178178
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="Splunk OpenTelemetry Operator Version"
179179
// +operator-sdk:csv:customresourcedefinitions:displayName="Splunk OpenTelemetry Collector"
180180

181-
// SplunkOtelAgent is the Schema for the splunkotelagents API.
182-
type SplunkOtelAgent struct {
181+
// Agent is the Schema for the agents API.
182+
type Agent struct {
183183
metav1.TypeMeta `json:",inline"`
184184
metav1.ObjectMeta `json:"metadata,omitempty"`
185185

186-
Spec SplunkOtelAgentSpec `json:"spec,omitempty"`
187-
Status SplunkOtelAgentStatus `json:"status,omitempty"`
186+
Spec AgentSpec `json:"spec,omitempty"`
187+
Status AgentStatus `json:"status,omitempty"`
188188
}
189189

190190
//+kubebuilder:object:root=true
191191

192-
// SplunkOtelAgentList contains a list of SplunkOtelAgent.
193-
type SplunkOtelAgentList struct {
192+
// AgentList contains a list of SplunkOtelAgent.
193+
type AgentList struct {
194194
metav1.TypeMeta `json:",inline"`
195195
metav1.ListMeta `json:"metadata,omitempty"`
196-
Items []SplunkOtelAgent `json:"items"`
196+
Items []Agent `json:"items"`
197197
}
198198

199199
func init() {
200-
SchemeBuilder.Register(&SplunkOtelAgent{}, &SplunkOtelAgentList{})
200+
SchemeBuilder.Register(&Agent{}, &AgentList{})
201201
}

apis/o11y/v1alpha1/splunkotelagent_webhook.go renamed to apis/otel/v1alpha1/splunkotelagent_webhook.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ const (
3232
)
3333

3434
// log is for logging in this package.
35-
var splunkotelagentlog = logf.Log.WithName("splunkotelagent-resource")
35+
var agentlog = logf.Log.WithName("agent-resource")
3636

3737
var detectedDistro autodetect.Distro = autodetect.UnknownDistro
3838

39-
func (r *SplunkOtelAgent) SetupWebhookWithManager(mgr ctrl.Manager, distro autodetect.Distro) error {
39+
func (r *Agent) SetupWebhookWithManager(mgr ctrl.Manager, distro autodetect.Distro) error {
4040
detectedDistro = distro
4141
return ctrl.NewWebhookManagedBy(mgr).
4242
For(r).
@@ -45,13 +45,13 @@ func (r *SplunkOtelAgent) SetupWebhookWithManager(mgr ctrl.Manager, distro autod
4545

4646
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
4747

48-
//+kubebuilder:webhook:path=/mutate-o11y-splunk-com-v1alpha1-splunkotelagent,mutating=true,failurePolicy=fail,sideEffects=None,groups=o11y.splunk.com,resources=splunkotelagents,verbs=create;update,versions=v1alpha1,name=msplunkotelagent.kb.io,admissionReviewVersions={v1,v1beta1}
48+
//+kubebuilder:webhook:path=/mutate-otel-splunk-com-v1alpha1-agent,mutating=true,failurePolicy=fail,sideEffects=None,groups=otel.splunk.com,resources=agents,verbs=create;update,versions=v1alpha1,name=magent.kb.io,admissionReviewVersions={v1,v1beta1}
4949

50-
var _ webhook.Defaulter = &SplunkOtelAgent{}
50+
var _ webhook.Defaulter = &Agent{}
5151

5252
// Default implements webhook.Defaulter so a webhook will be registered for the type.
53-
func (r *SplunkOtelAgent) Default() {
54-
splunkotelagentlog.Info("default", "name", r.Name)
53+
func (r *Agent) Default() {
54+
agentlog.Info("default", "name", r.Name)
5555

5656
if r.Labels == nil {
5757
r.Labels = map[string]string{}
@@ -67,29 +67,29 @@ func (r *SplunkOtelAgent) Default() {
6767
}
6868

6969
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
70-
//+kubebuilder:webhook:path=/validate-o11y-splunk-com-v1alpha1-splunkotelagent,mutating=false,failurePolicy=fail,sideEffects=None,groups=o11y.splunk.com,resources=splunkotelagents,verbs=create;update,versions=v1alpha1,name=vsplunkotelagent.kb.io,admissionReviewVersions={v1,v1beta1}
70+
//+kubebuilder:webhook:path=/validate-otel-splunk-com-v1alpha1-agent,mutating=false,failurePolicy=fail,sideEffects=None,groups=otel.splunk.com,resources=agents,verbs=create;update,versions=v1alpha1,name=vagent.kb.io,admissionReviewVersions={v1,v1beta1}
7171

72-
var _ webhook.Validator = &SplunkOtelAgent{}
72+
var _ webhook.Validator = &Agent{}
7373

7474
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
75-
func (r *SplunkOtelAgent) ValidateCreate() error {
76-
splunkotelagentlog.Info("validate create", "name", r.Name)
75+
func (r *Agent) ValidateCreate() error {
76+
agentlog.Info("validate create", "name", r.Name)
7777
return r.validateCRDSpec()
7878
}
7979

8080
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
81-
func (r *SplunkOtelAgent) ValidateUpdate(old runtime.Object) error {
82-
splunkotelagentlog.Info("validate update", "name", r.Name)
81+
func (r *Agent) ValidateUpdate(old runtime.Object) error {
82+
agentlog.Info("validate update", "name", r.Name)
8383
return r.validateCRDSpec()
8484
}
8585

8686
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
87-
func (r *SplunkOtelAgent) ValidateDelete() error {
88-
splunkotelagentlog.Info("validate delete", "name", r.Name)
87+
func (r *Agent) ValidateDelete() error {
88+
agentlog.Info("validate delete", "name", r.Name)
8989
return nil
9090
}
9191

92-
func (r *SplunkOtelAgent) validateCRDSpec() error {
92+
func (r *Agent) validateCRDSpec() error {
9393
var errs []string
9494

9595
if err := r.validateInstrumentation(); err != nil {
@@ -113,11 +113,11 @@ func (r *SplunkOtelAgent) validateCRDSpec() error {
113113
return nil
114114
}
115115

116-
func (r *SplunkOtelAgent) validateInstrumentation() error {
116+
func (r *Agent) validateInstrumentation() error {
117117
return nil
118118
}
119119

120-
func (r *SplunkOtelAgent) validateCRDAgentSpec() error {
120+
func (r *Agent) validateCRDAgentSpec() error {
121121
spec := r.Spec.Agent
122122

123123
if spec.Replicas != nil {
@@ -127,7 +127,7 @@ func (r *SplunkOtelAgent) validateCRDAgentSpec() error {
127127
return nil
128128
}
129129

130-
func (r *SplunkOtelAgent) validateCRDClusterReceiverSpec() error {
130+
func (r *Agent) validateCRDClusterReceiverSpec() error {
131131
spec := r.Spec.ClusterReceiver
132132

133133
if spec.Replicas != nil {
@@ -141,7 +141,7 @@ func (r *SplunkOtelAgent) validateCRDClusterReceiverSpec() error {
141141
return nil
142142
}
143143

144-
func (r *SplunkOtelAgent) validateCRDGatewaySpec() error {
144+
func (r *Agent) validateCRDGatewaySpec() error {
145145
spec := r.Spec.Gateway
146146

147147
if !r.Spec.Gateway.Disabled {
@@ -155,13 +155,13 @@ func (r *SplunkOtelAgent) validateCRDGatewaySpec() error {
155155
return nil
156156
}
157157

158-
func (r *SplunkOtelAgent) defaultInstrumentation() {
158+
func (r *Agent) defaultInstrumentation() {
159159
if r.Spec.Instrumentation.Java.Image == "" {
160160
r.Spec.Instrumentation.Java.Image = defaultJavaAgentImage
161161
}
162162
}
163163

164-
func (r *SplunkOtelAgent) defaultAgent() {
164+
func (r *Agent) defaultAgent() {
165165
realm := r.Spec.Realm
166166
clusterName := r.Spec.ClusterName
167167

@@ -251,7 +251,7 @@ func (r *SplunkOtelAgent) defaultAgent() {
251251
}
252252
}
253253

254-
func (r *SplunkOtelAgent) defaultClusterReceiver() {
254+
func (r *Agent) defaultClusterReceiver() {
255255
realm := r.Spec.Realm
256256
clusterName := r.Spec.ClusterName
257257

@@ -296,7 +296,7 @@ func (r *SplunkOtelAgent) defaultClusterReceiver() {
296296
}
297297
}
298298

299-
func (r *SplunkOtelAgent) defaultGateway() {
299+
func (r *Agent) defaultGateway() {
300300
spec := &r.Spec.Gateway
301301
// TODO(splunk): forcibly disable gateway until we add support for it.
302302
spec.Disabled = true

0 commit comments

Comments
 (0)