-
Notifications
You must be signed in to change notification settings - Fork 1
adding kuttl test case #73
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,52 @@ | ||
| # ============================================================================ | ||
| # Dependency Management | ||
| # ============================================================================ | ||
| # These operators are required by the Splunk AI Operator and are installed | ||
| # automatically as dependencies. Set to false if already installed in your cluster. | ||
|
|
||
| # cert-manager - Required for webhook certificates and mTLS | ||
| cert-manager: | ||
| enabled: true | ||
| crds: | ||
| enabled: true | ||
|
|
||
| # KubeRay Operator - Required for Ray cluster management | ||
| kuberay-operator: | ||
| enabled: true | ||
|
|
||
| # OpenTelemetry Operator - Required for observability sidecars | ||
| opentelemetry-operator: | ||
| enabled: true | ||
| manager: | ||
| collectorImage: | ||
| repository: "otel/opentelemetry-collector-k8s" | ||
| tag: "0.102.1" | ||
|
|
||
| # Kube Prometheus Stack - Required for Prometheus monitoring | ||
| kube-prometheus-stack: | ||
| enabled: true | ||
| prometheus: | ||
| enabled: true | ||
| grafana: | ||
| enabled: false # Minimal installation | ||
| alertmanager: | ||
| enabled: false # Minimal installation | ||
|
|
||
| # Splunk Operator - Required for managing Splunk Enterprise instances | ||
| splunk-operator: | ||
| enabled: true | ||
| image: | ||
| repository: docker.io/splunk/splunk-operator | ||
| tag: 3.0.0 | ||
| # Environment variables for splunk-operator | ||
| env: | ||
| - name: SPLUNK_GENERAL_TERMS | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot add this in the helm chart. The user has to manually add this to accept the terms after reading the SGT. Can you set the value to be empty and add a comment to view the SOK readme for the appropriate value? |
||
| value: "--accept-sgt-current-at-splunk-com" | ||
|
|
||
| # ============================================================================ | ||
| # Splunk AI Operator Configuration | ||
| # ============================================================================ | ||
|
|
||
| # Metadata overrides: | ||
| # Override the Splunk AI Operator helm chart name | ||
| nameOverride: "" | ||
|
|
@@ -44,6 +93,9 @@ weaviateImage: "docker.io/semitechnologies/weaviate:stable-v1.28-007846a" | |
| saiaApiImage: "docker.io/splunk/saia-api:1.1.0" | ||
| saiaSchemaImage: "docker.io/splunk/saia-data-loader:1.1.0" | ||
|
|
||
| # OpenTelemetry Collector image for observability sidecars | ||
| otelCollectorImage: "otel/opentelemetry-collector-contrib:0.122.1" | ||
|
|
||
| # Set security context for Splunk Operator pod | ||
| # reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#podsecuritycontext-v1-core | ||
| securityContext: | ||
|
|
@@ -53,10 +105,10 @@ securityContext: | |
|
|
||
| # Splunk AI Operator image and pull policy | ||
| # reference: https://github.com/splunk/splunk-ai-operator | ||
| # Default uses GitHub Container Registry (ghcr.io) for official releases | ||
| # You can also use Docker Hub: docker.io/splunk/splunk-ai-operator | ||
| # Default uses Docker Hub for public releases | ||
| # You can also use GitHub Container Registry: ghcr.io/splunk/splunk-ai-operator | ||
| image: | ||
| repository: ghcr.io/splunk/splunk-ai-operator | ||
| repository: docker.io/splunk/splunk-ai-operator | ||
| tag: "v0.1.0" | ||
| pullPolicy: IfNotPresent | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,10 +135,16 @@ func (s *Builder) reconcileOpenTelemetryCollector(ctx context.Context, p *aiApi. | |
| return fmt.Errorf("json unmarshal: %w", err) | ||
| } | ||
|
|
||
| // Get OTEL collector image from environment variable | ||
| otelImage := os.Getenv("RELATED_IMAGE_OTEL_COLLECTOR") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these changes were added as part of #75. Should we cancel that PR in favor of the changes here? |
||
| if otelImage == "" { | ||
| otelImage = "otel/opentelemetry-collector-contrib:0.122.1" // fallback default | ||
| } | ||
|
|
||
| // construct spec | ||
| specMap := map[string]interface{}{ | ||
| "mode": "sidecar", | ||
| "image": "otel/opentelemetry-collector-contrib:0.122.1", | ||
| "image": otelImage, | ||
| "env": []map[string]interface{}{ | ||
| {"name": "SPLUNK_ACCESS_TOKEN", "valueFrom": map[string]interface{}{"secretKeyRef": map[string]interface{}{"name": s.ai.Spec.SplunkConfiguration.SecretRef.Name, "key": "hec_token"}}}, | ||
| {"name": "POD_NAME", "valueFrom": map[string]interface{}{"fieldRef": map[string]interface{}{"fieldPath": "metadata.name"}}}, | ||
|
|
@@ -183,7 +189,10 @@ func (s *Builder) reconcileOtelConfigMap(ctx context.Context, p *aiApi.AIPlatfor | |
| cm.Data = map[string]string{} | ||
| } | ||
| if _, exists := cm.Data["otel-config.yaml"]; !exists { | ||
| content := s.renderOtelConf(ctx, p) | ||
| content, err := s.renderOtelConf(ctx, p) | ||
| if err != nil { | ||
| return fmt.Errorf("rendering otel config: %w", err) | ||
| } | ||
| yamlBytes, err := syaml.Marshal(content) | ||
| if err != nil { | ||
| return fmt.Errorf("marshaling otel config: %w", err) | ||
|
|
@@ -199,16 +208,23 @@ func (s *Builder) reconcileOtelConfigMap(ctx context.Context, p *aiApi.AIPlatfor | |
| } | ||
|
|
||
| // renderOtelConf builds the OpenTelemetry Collector config map data. | ||
| func (s *Builder) renderOtelConf(ctx context.Context, cr *aiApi.AIPlatform) map[string]interface{} { | ||
| // Returns the config and an error if validation fails. | ||
| func (s *Builder) renderOtelConf(ctx context.Context, cr *aiApi.AIPlatform) (map[string]interface{}, error) { | ||
| // Validate that the secret reference is provided | ||
| if cr.Spec.SplunkConfiguration.SecretRef.Name == "" { | ||
| return nil, fmt.Errorf("SplunkConfiguration.SecretRef.Name is required for OTEL sidecar") | ||
| } | ||
|
|
||
| // Validate that the secret exists | ||
| secret := &corev1.Secret{} | ||
| key := types.NamespacedName{Name: cr.Spec.SplunkConfiguration.SecretRef.Name, Namespace: cr.Namespace} | ||
| if err := s.Client.Get(ctx, key, secret); err != nil { | ||
| return map[string]interface{}{"error": fmt.Sprintf("loading secret %q: %v", key.Name, err)} | ||
| return nil, fmt.Errorf("failed to validate secret %q: %w", key.Name, err) | ||
| } | ||
|
|
||
| token, ok := secret.Data["hec_token"] | ||
| if !ok { | ||
| return map[string]interface{}{"error": "hec_token field not found in secret"} | ||
| // Verify the secret has the required key | ||
| if _, ok := secret.Data["hec_token"]; !ok { | ||
| return nil, fmt.Errorf("secret %q does not contain required key 'hec_token'", key.Name) | ||
| } | ||
|
|
||
| endpoint := fmt.Sprintf("%s/services/collector", cr.Spec.SplunkConfiguration.Endpoint) | ||
|
|
@@ -219,7 +235,9 @@ func (s *Builder) renderOtelConf(ctx context.Context, cr *aiApi.AIPlatform) map[ | |
| return map[string]interface{}{ | ||
| "exporters": map[string]interface{}{ | ||
| "splunk_hec": map[string]interface{}{ | ||
| "token": string(token), | ||
| // Use environment variable reference instead of embedding the token | ||
| // The SPLUNK_ACCESS_TOKEN env var is injected by the OpenTelemetryCollector CR | ||
| "token": "${SPLUNK_ACCESS_TOKEN}", | ||
| "endpoint": endpoint, | ||
| "source": "otel", | ||
| "sourcetype": "otel", | ||
|
|
@@ -275,7 +293,7 @@ func (s *Builder) renderOtelConf(ctx context.Context, cr *aiApi.AIPlatform) map[ | |
| }, | ||
| }, | ||
| }, | ||
| } | ||
| }, nil | ||
| } | ||
|
|
||
| // renderEnvoyConf generates the Envoy configuration for the given AIPlatform. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we have to add these chart .tgz files to the charts/ directory to avoid errors during helm installation.