// Copyright (c) 2023 Volvo Car Corporation
// SPDX-License-Identifier: Apache-2.0

// Code generated by lingon. EDIT AS MUCH AS YOU LIKE.

package promstack

import (
	appsv1 "k8s.io/api/apps/v1"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/intstr"
)

var KubePromtheusStackGrafanaDeploy = &appsv1.Deployment{
	ObjectMeta: metav1.ObjectMeta{
		Labels: map[string]string{
			"app.kubernetes.io/instance":   "kube-promtheus-stack",
			"app.kubernetes.io/managed-by": "Helm",
			"app.kubernetes.io/name":       "grafana",
			"app.kubernetes.io/version":    "9.5.3",
			"helm.sh/chart":                "grafana-6.57.3",
		},
		Name:      "kube-promtheus-stack-grafana",
		Namespace: "monitoring",
	},
	Spec: appsv1.DeploymentSpec{
		Replicas:             P(int32(1)),
		RevisionHistoryLimit: P(int32(10)),
		Selector: &metav1.LabelSelector{
			MatchLabels: map[string]string{
				"app.kubernetes.io/instance": "kube-promtheus-stack",
				"app.kubernetes.io/name":     "grafana",
			},
		},
		Strategy: appsv1.DeploymentStrategy{Type: appsv1.DeploymentStrategyType("RollingUpdate")},
		Template: corev1.PodTemplateSpec{
			ObjectMeta: metav1.ObjectMeta{
				Annotations: map[string]string{
					"checksum/config":                         "0bb0136ef860605a7b0baf9d0d9052238264a318b6b15f3b8aa8eb33ac29585f",
					"checksum/dashboards-json-config":         "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
					"checksum/sc-dashboard-provider-config":   "5b9c2cf3c94bfe204cd8121c6ad413f9aa2217b1aba9b90432f799804bf4a3df",
					"checksum/secret":                         "afc5925db4631da14cc6e0ec3a3bcf0741d58d6615593db4e25a814e9f299742",
					"kubectl.kubernetes.io/default-container": "grafana",
				},
				Labels: map[string]string{
					"app.kubernetes.io/instance": "kube-promtheus-stack",
					"app.kubernetes.io/name":     "grafana",
				},
			},
			Spec: corev1.PodSpec{
				AutomountServiceAccountToken: P(true),
				Containers: []corev1.Container{
					{
						Env: []corev1.EnvVar{
							{
								Name:  "METHOD",
								Value: "WATCH",
							}, {
								Name:  "LABEL",
								Value: "grafana_dashboard",
							}, {
								Name:  "LABEL_VALUE",
								Value: "1",
							}, {
								Name:  "FOLDER",
								Value: "/tmp/dashboards",
							}, {
								Name:  "RESOURCE",
								Value: "both",
							}, {
								Name:  "NAMESPACE",
								Value: "ALL",
							}, {
								Name: "REQ_USERNAME",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-user",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name: "REQ_PASSWORD",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-password",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name:  "REQ_URL",
								Value: "http://localhost:3000/api/admin/provisioning/dashboards/reload",
							}, {
								Name:  "REQ_METHOD",
								Value: "POST",
							},
						},
						Image:           "quay.io/kiwigrid/k8s-sidecar:1.24.3",
						ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
						Name:            "grafana-sc-dashboard",
						SecurityContext: &corev1.SecurityContext{
							Capabilities:   &corev1.Capabilities{Drop: []corev1.Capability{corev1.Capability("ALL")}},
							SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileType("RuntimeDefault")},
						},
						VolumeMounts: []corev1.VolumeMount{
							{
								MountPath: "/tmp/dashboards",
								Name:      "sc-dashboard-volume",
							},
						},
					}, {
						Env: []corev1.EnvVar{
							{
								Name:  "METHOD",
								Value: "WATCH",
							}, {
								Name:  "LABEL",
								Value: "grafana_datasource",
							}, {
								Name:  "LABEL_VALUE",
								Value: "1",
							}, {
								Name:  "FOLDER",
								Value: "/etc/grafana/provisioning/datasources",
							}, {
								Name:  "RESOURCE",
								Value: "both",
							}, {
								Name: "REQ_USERNAME",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-user",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name: "REQ_PASSWORD",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-password",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name:  "REQ_URL",
								Value: "http://localhost:3000/api/admin/provisioning/datasources/reload",
							}, {
								Name:  "REQ_METHOD",
								Value: "POST",
							},
						},
						Image:           "quay.io/kiwigrid/k8s-sidecar:1.24.3",
						ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
						Name:            "grafana-sc-datasources",
						SecurityContext: &corev1.SecurityContext{
							Capabilities:   &corev1.Capabilities{Drop: []corev1.Capability{corev1.Capability("ALL")}},
							SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileType("RuntimeDefault")},
						},
						VolumeMounts: []corev1.VolumeMount{
							{
								MountPath: "/etc/grafana/provisioning/datasources",
								Name:      "sc-datasources-volume",
							},
						},
					}, {
						Env: []corev1.EnvVar{
							{
								Name:      "POD_IP",
								ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"}},
							}, {
								Name: "GF_SECURITY_ADMIN_USER",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-user",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name: "GF_SECURITY_ADMIN_PASSWORD",
								ValueFrom: &corev1.EnvVarSource{
									SecretKeyRef: &corev1.SecretKeySelector{
										Key:                  "admin-password",
										LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"},
									},
								},
							}, {
								Name:  "GF_PATHS_DATA",
								Value: "/var/lib/grafana/",
							}, {
								Name:  "GF_PATHS_LOGS",
								Value: "/var/log/grafana",
							}, {
								Name:  "GF_PATHS_PLUGINS",
								Value: "/var/lib/grafana/plugins",
							}, {
								Name:  "GF_PATHS_PROVISIONING",
								Value: "/etc/grafana/provisioning",
							},
						},
						Image:           "docker.io/grafana/grafana:9.5.3",
						ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
						LivenessProbe: &corev1.Probe{
							FailureThreshold:    int32(10),
							InitialDelaySeconds: int32(60),
							ProbeHandler: corev1.ProbeHandler{
								HTTPGet: &corev1.HTTPGetAction{
									Path: "/api/health",
									Port: intstr.IntOrString{IntVal: int32(3000)},
								},
							},
							TimeoutSeconds: int32(30),
						},
						Name: "grafana",
						Ports: []corev1.ContainerPort{
							{
								ContainerPort: int32(3000),
								Name:          "grafana",
								Protocol:      corev1.Protocol("TCP"),
							}, {
								ContainerPort: int32(9094),
								Name:          "gossip-tcp",
								Protocol:      corev1.Protocol("TCP"),
							}, {
								ContainerPort: int32(9094),
								Name:          "gossip-udp",
								Protocol:      corev1.Protocol("UDP"),
							},
						},
						ReadinessProbe: &corev1.Probe{
							ProbeHandler: corev1.ProbeHandler{
								HTTPGet: &corev1.HTTPGetAction{
									Path: "/api/health",
									Port: intstr.IntOrString{IntVal: int32(3000)},
								},
							},
						},
						SecurityContext: &corev1.SecurityContext{
							Capabilities:   &corev1.Capabilities{Drop: []corev1.Capability{corev1.Capability("ALL")}},
							SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileType("RuntimeDefault")},
						},
						VolumeMounts: []corev1.VolumeMount{
							{
								MountPath: "/etc/grafana/grafana.ini",
								Name:      "config",
								SubPath:   "grafana.ini",
							}, {
								MountPath: "/var/lib/grafana",
								Name:      "storage",
							}, {
								MountPath: "/tmp/dashboards",
								Name:      "sc-dashboard-volume",
							}, {
								MountPath: "/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml",
								Name:      "sc-dashboard-provider",
								SubPath:   "provider.yaml",
							}, {
								MountPath: "/etc/grafana/provisioning/datasources",
								Name:      "sc-datasources-volume",
							},
						},
					},
				},
				EnableServiceLinks: P(true),
				SecurityContext: &corev1.PodSecurityContext{
					FSGroup:      P(int64(472)),
					RunAsGroup:   P(int64(472)),
					RunAsNonRoot: P(true),
					RunAsUser:    P(int64(472)),
				},
				ServiceAccountName: "kube-promtheus-stack-grafana",
				Volumes: []corev1.Volume{
					{
						Name:         "config",
						VolumeSource: corev1.VolumeSource{ConfigMap: &corev1.ConfigMapVolumeSource{LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana"}}},
					}, {
						Name:         "storage",
						VolumeSource: corev1.VolumeSource{},
					}, {
						Name:         "sc-dashboard-volume",
						VolumeSource: corev1.VolumeSource{},
					}, {
						Name:         "sc-dashboard-provider",
						VolumeSource: corev1.VolumeSource{ConfigMap: &corev1.ConfigMapVolumeSource{LocalObjectReference: corev1.LocalObjectReference{Name: "kube-promtheus-stack-grafana-config-dashboards"}}},
					}, {
						Name:         "sc-datasources-volume",
						VolumeSource: corev1.VolumeSource{},
					},
				},
			},
		},
	},
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apps/v1",
		Kind:       "Deployment",
	},
}

var KubePromtheusStackKubeOperatorDeploy = &appsv1.Deployment{
	ObjectMeta: metav1.ObjectMeta{
		Labels: map[string]string{
			"app":                          "kube-prometheus-stack-operator",
			"app.kubernetes.io/instance":   "kube-promtheus-stack",
			"app.kubernetes.io/managed-by": "Helm",
			"app.kubernetes.io/part-of":    "kube-prometheus-stack",
			"app.kubernetes.io/version":    "47.0.0",
			"chart":                        "kube-prometheus-stack-47.0.0",
			"heritage":                     "Helm",
			"release":                      "kube-promtheus-stack",
		},
		Name:      "kube-promtheus-stack-kube-operator",
		Namespace: "monitoring",
	},
	Spec: appsv1.DeploymentSpec{
		Replicas: P(int32(1)),
		Selector: &metav1.LabelSelector{
			MatchLabels: map[string]string{
				"app":     "kube-prometheus-stack-operator",
				"release": "kube-promtheus-stack",
			},
		},
		Template: corev1.PodTemplateSpec{
			ObjectMeta: metav1.ObjectMeta{
				Labels: map[string]string{
					"app":                          "kube-prometheus-stack-operator",
					"app.kubernetes.io/instance":   "kube-promtheus-stack",
					"app.kubernetes.io/managed-by": "Helm",
					"app.kubernetes.io/part-of":    "kube-prometheus-stack",
					"app.kubernetes.io/version":    "47.0.0",
					"chart":                        "kube-prometheus-stack-47.0.0",
					"heritage":                     "Helm",
					"release":                      "kube-promtheus-stack",
				},
			},
			Spec: corev1.PodSpec{
				Containers: []corev1.Container{
					{
						Args: []string{
							"--kubelet-service=kube-system/kube-promtheus-stack-kube-kubelet",
							"--localhost=127.0.0.1",
							"--prometheus-config-reloader=quay.io/prometheus-operator/prometheus-config-reloader:v0.66.0",
							"--config-reloader-cpu-request=200m",
							"--config-reloader-cpu-limit=200m",
							"--config-reloader-memory-request=50Mi",
							"--config-reloader-memory-limit=50Mi",
							"--thanos-default-base-image=quay.io/thanos/thanos:v0.31.0",
							"--secret-field-selector=type!=kubernetes.io/dockercfg,type!=kubernetes.io/service-account-token,type!=helm.sh/release.v1",
							"--web.enable-tls=true",
							"--web.cert-file=/cert/cert",
							"--web.key-file=/cert/key",
							"--web.listen-address=:10250",
							"--web.tls-min-version=VersionTLS13",
						},
						Image:           "quay.io/prometheus-operator/prometheus-operator:v0.66.0",
						ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
						Name:            "kube-prometheus-stack",
						Ports: []corev1.ContainerPort{
							{
								ContainerPort: int32(10250),
								Name:          "https",
							},
						},
						SecurityContext: &corev1.SecurityContext{
							Capabilities:           &corev1.Capabilities{Drop: []corev1.Capability{corev1.Capability("ALL")}},
							ReadOnlyRootFilesystem: P(true),
						},
						VolumeMounts: []corev1.VolumeMount{
							{
								MountPath: "/cert",
								Name:      "tls-secret",
								ReadOnly:  true,
							},
						},
					},
				},
				SecurityContext: &corev1.PodSecurityContext{
					FSGroup:        P(int64(65534)),
					RunAsGroup:     P(int64(65534)),
					RunAsNonRoot:   P(true),
					RunAsUser:      P(int64(65534)),
					SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileType("RuntimeDefault")},
				},
				ServiceAccountName: "kube-promtheus-stack-kube-operator",
				Volumes: []corev1.Volume{
					{
						Name: "tls-secret",
						VolumeSource: corev1.VolumeSource{
							Secret: &corev1.SecretVolumeSource{
								DefaultMode: P(int32(420)),
								SecretName:  "kube-promtheus-stack-kube-admission",
							},
						},
					},
				},
			},
		},
	},
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apps/v1",
		Kind:       "Deployment",
	},
}

var KubePromtheusStackKubeStateMetricsDeploy = &appsv1.Deployment{
	ObjectMeta: metav1.ObjectMeta{
		Labels: map[string]string{
			"app.kubernetes.io/component":  "metrics",
			"app.kubernetes.io/instance":   "kube-promtheus-stack",
			"app.kubernetes.io/managed-by": "Helm",
			"app.kubernetes.io/name":       "kube-state-metrics",
			"app.kubernetes.io/part-of":    "kube-state-metrics",
			"app.kubernetes.io/version":    "2.9.2",
			"helm.sh/chart":                "kube-state-metrics-5.7.0",
			"release":                      "kube-promtheus-stack",
		},
		Name:      "kube-promtheus-stack-kube-state-metrics",
		Namespace: "monitoring",
	},
	Spec: appsv1.DeploymentSpec{
		Replicas: P(int32(1)),
		Selector: &metav1.LabelSelector{
			MatchLabels: map[string]string{
				"app.kubernetes.io/instance": "kube-promtheus-stack",
				"app.kubernetes.io/name":     "kube-state-metrics",
			},
		},
		Template: corev1.PodTemplateSpec{
			ObjectMeta: metav1.ObjectMeta{
				Labels: map[string]string{
					"app.kubernetes.io/component":  "metrics",
					"app.kubernetes.io/instance":   "kube-promtheus-stack",
					"app.kubernetes.io/managed-by": "Helm",
					"app.kubernetes.io/name":       "kube-state-metrics",
					"app.kubernetes.io/part-of":    "kube-state-metrics",
					"app.kubernetes.io/version":    "2.9.2",
					"helm.sh/chart":                "kube-state-metrics-5.7.0",
					"release":                      "kube-promtheus-stack",
				},
			},
			Spec: corev1.PodSpec{
				Containers: []corev1.Container{
					{
						Args: []string{
							"--port=8080",
							"--resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments",
						},
						Image:           "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.9.2",
						ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
						LivenessProbe: &corev1.Probe{
							InitialDelaySeconds: int32(5),
							ProbeHandler: corev1.ProbeHandler{
								HTTPGet: &corev1.HTTPGetAction{
									Path: "/healthz",
									Port: intstr.IntOrString{IntVal: int32(8080)},
								},
							},
							TimeoutSeconds: int32(5),
						},
						Name: "kube-state-metrics",
						Ports: []corev1.ContainerPort{
							{
								ContainerPort: int32(8080),
								Name:          "http",
							},
						},
						ReadinessProbe: &corev1.Probe{
							InitialDelaySeconds: int32(5),
							ProbeHandler: corev1.ProbeHandler{
								HTTPGet: &corev1.HTTPGetAction{
									Path: "/",
									Port: intstr.IntOrString{IntVal: int32(8080)},
								},
							},
							TimeoutSeconds: int32(5),
						},
						SecurityContext: &corev1.SecurityContext{Capabilities: &corev1.Capabilities{Drop: []corev1.Capability{corev1.Capability("ALL")}}},
					},
				},
				SecurityContext: &corev1.PodSecurityContext{
					FSGroup:        P(int64(65534)),
					RunAsGroup:     P(int64(65534)),
					RunAsNonRoot:   P(true),
					RunAsUser:      P(int64(65534)),
					SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileType("RuntimeDefault")},
				},
				ServiceAccountName: "kube-promtheus-stack-kube-state-metrics",
			},
		},
	},
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apps/v1",
		Kind:       "Deployment",
	},
}
