Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_clustermasters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
resources:
description: resource requirements for the pod containers
properties:
Expand Down
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_indexerclusters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
replicas:
Comment on lines +878 to 915
Copy link
Contributor

@sgontla sgontla Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this for IDXC? What will be the net effect, if somebody configures this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a discussion with Kriti:

  1. Good to have the MC ref as part of the MC CR, in case if we introduce the Global MC in the future.
  2. SHC (even if we have a separate CR in the future) needs the MC reference, as the logic expects both for the Deployer and SHs.
  3. IDXC case, each site-specific CR having MC reference can lead to confusion, as different sites can't go to different MCs. The best way is if we can pull this info from the CM CR, by reading it from the API server(?). If that is not feasible, an alternative can be using the configMap(CM writes it, and the site-specific CRs read and use it).

With the above understanding, we can continue using it in the current form(having the MC reference), but the implementation can ignore when dealing with the IDXC, and use it from the CM CR or through a configMap.

description: Number of search head pods; a search head cluster will
be created if > 1
Expand Down
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_licensemasters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
resources:
description: resource requirements for the pod containers
properties:
Expand Down
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_monitoringconsoles_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
resources:
description: resource requirements for the pod containers
properties:
Expand Down
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_searchheadclusters_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
replicas:
description: Number of search head pods; a search head cluster will
be created if > 1
Expand Down
37 changes: 37 additions & 0 deletions deploy/crds/enterprise.splunk.com_standalones_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,43 @@ spec:
licenseUrl:
description: Full path or URL for a Splunk Enterprise license file
type: string
monitoringConsoleRef:
description: MonitoringConsoleRef refers to a Splunk Enterprise monitoring
console managed by the operator within Kubernetes
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
replicas:
description: Number of standalone pods
format: int32
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/enterprise/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ type CommonSplunkSpec struct {
// ClusterMasterRef refers to a Splunk Enterprise indexer cluster managed by the operator within Kubernetes
ClusterMasterRef corev1.ObjectReference `json:"clusterMasterRef"`

// MonitoringConsoleRef refers to a Splunk Enterprise monitoring console managed by the operator within Kubernetes
MonitoringConsoleRef corev1.ObjectReference `json:"monitoringConsoleRef"`

// Mock to differentiate between UTs and actual reconcile
Mock bool `json:"Mock"`

Expand Down
1 change: 1 addition & 0 deletions pkg/apis/enterprise/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controller/add_monitoringconsole.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (ctrl MonitoringConsoleController) GetInstance() splcommon.MetaObject {

// GetWatchTypes returns a list of types owned by the controller that it would like to receive watch events for
func (ctrl MonitoringConsoleController) GetWatchTypes() []runtime.Object {
return []runtime.Object{&appsv1.StatefulSet{}, &corev1.Secret{}}
return []runtime.Object{&appsv1.StatefulSet{}, &corev1.Secret{}, &corev1.ConfigMap{}}
}

// Reconcile is used to perform an idempotent reconciliation of the custom resource managed by this controller
Expand Down
12 changes: 12 additions & 0 deletions pkg/splunk/enterprise/licensemaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func ApplyLicenseMaster(client splcommon.ControllerClient, cr *enterprisev1.Lice

// check if deletion has been requested
if cr.ObjectMeta.DeletionTimestamp != nil {
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseMasterURL(cr, &cr.Spec.CommonSplunkSpec), false)
if err != nil {
return result, err
}
}
DeleteOwnerReferencesForResources(client, cr, nil)
terminating, err := splctrl.CheckForDeletion(cr, client)
if terminating && err != nil { // don't bother if no error, since it will just be removed immmediately after
Expand Down Expand Up @@ -94,6 +100,12 @@ func ApplyLicenseMaster(client splcommon.ControllerClient, cr *enterprisev1.Lice
if err != nil {
scopedLog.Error(err, "Error in deleting automated monitoring console resource")
}
if cr.Spec.MonitoringConsoleRef.Name != "" {
_, err = ApplyMonitoringConsoleEnvConfigMap(client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, getLicenseMasterURL(cr, &cr.Spec.CommonSplunkSpec), true)
if err != nil {
return result, err
}
}
result.Requeue = false
}
return result, nil
Expand Down
Loading