1
0
mirror of synced 2026-03-02 11:36:56 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Max Jonas Werner
a01e6a6c3b wip 2023-08-08 17:09:01 +02:00
Stefan Prodan
12efb1967e Merge pull request #4131 from mraerino/fix/diff-with-multiobj
Fix selection of kustomization resource from multi doc yaml
2023-08-07 14:04:32 +03:00
Marcus Weiner
56b1e80758 Fix selection of kustomization resource from multi doc yaml
Signed-off-by: Marcus Weiner <marcus.weiner@gmail.com>
2023-08-07 12:05:29 +02:00
Stefan Prodan
baf874ea67 Merge pull request #4126 from fluxcd/min-kube-1.25
Set Kubernetes min version to 1.25
2023-08-03 13:39:24 +03:00
Stefan Prodan
28262f59d3 Set Kubernetes min version to 1.25
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-02 14:17:30 +03:00
14 changed files with 222 additions and 494 deletions

View File

@@ -57,7 +57,7 @@ type checkFlags struct {
} }
var kubernetesConstraints = []string{ var kubernetesConstraints = []string{
">=1.24.0-0", ">=1.25.0-0",
} }
var checkArgs checkFlags var checkArgs checkFlags

View File

@@ -101,7 +101,7 @@ func createImageRepositoryRun(cmd *cobra.Command, args []string) error {
var repo = imagev1.ImageRepository{ var repo = imagev1.ImageRepository{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: objectName, Name: objectName,
Namespace: *kubeconfigArgs.Namespace, Namespace: GetDesiredNamespace(kubeconfigArgs),
Labels: labels, Labels: labels,
}, },
Spec: imagev1.ImageRepositorySpec{ Spec: imagev1.ImageRepositorySpec{

View File

@@ -91,6 +91,12 @@ func TestDiffKustomization(t *testing.T) {
objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml", objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml",
assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"), assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"),
}, },
{
name: "diff where kustomization file has multiple objects with the same name",
args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false --kustomization-file ./testdata/diff-kustomization/flux-kustomization-multiobj.yaml",
objectFile: "",
assert: assertGoldenFile("./testdata/diff-kustomization/nothing-is-deployed.golden"),
},
} }
tmpl := map[string]string{ tmpl := map[string]string{

View File

@@ -146,9 +146,11 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
return err return err
} }
ns := GetDesiredNamespace(kubeconfigArgs)
var listOpts []client.ListOption var listOpts []client.ListOption
if !getArgs.allNamespaces { if !getArgs.allNamespaces {
listOpts = append(listOpts, client.InNamespace(*kubeconfigArgs.Namespace)) listOpts = append(listOpts, client.InNamespace(ns))
} }
if len(args) > 0 { if len(args) > 0 {
@@ -190,12 +192,12 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
logger.Failuref("%s object '%s' not found in %s namespace", logger.Failuref("%s object '%s' not found in %s namespace",
get.kind, get.kind,
args[0], args[0],
namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace), namespaceNameOrAny(getArgs.allNamespaces, ns),
) )
} else if !getAll { } else if !getAll {
logger.Failuref("no %s objects found in %s namespace", logger.Failuref("no %s objects found in %s namespace",
get.kind, get.kind,
namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace), namespaceNameOrAny(getArgs.allNamespaces, ns),
) )
} }
return nil return nil

View File

@@ -146,7 +146,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
opts := install.Options{ opts := install.Options{
BaseURL: installArgs.manifestsPath, BaseURL: installArgs.manifestsPath,
Version: installArgs.version, Version: installArgs.version,
Namespace: *kubeconfigArgs.Namespace, Namespace: GetDesiredNamespace(kubeconfigArgs),
Components: components, Components: components,
Registry: installArgs.registry, Registry: installArgs.registry,
ImagePullSecret: installArgs.imagePullSecret, ImagePullSecret: installArgs.imagePullSecret,
@@ -181,7 +181,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
} }
logger.Successf("manifests build completed") logger.Successf("manifests build completed")
logger.Actionf("installing components in %s namespace", *kubeconfigArgs.Namespace) logger.Actionf("installing components in %s namespace", opts.Namespace)
applyOutput, err := utils.Apply(ctx, kubeconfigArgs, kubeclientOptions, tmpDir, filepath.Join(tmpDir, manifest.Path)) applyOutput, err := utils.Apply(ctx, kubeconfigArgs, kubeclientOptions, tmpDir, filepath.Join(tmpDir, manifest.Path))
if err != nil { if err != nil {

View File

@@ -105,6 +105,10 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way.`,
return fmt.Errorf("error getting namespace: %w", err) return fmt.Errorf("error getting namespace: %w", err)
} }
if ns == "" {
return nil
}
if e := validation.IsDNS1123Label(ns); len(e) > 0 { if e := validation.IsDNS1123Label(ns); len(e) > 0 {
return fmt.Errorf("namespace must be a valid DNS label: %q", ns) return fmt.Errorf("namespace must be a valid DNS label: %q", ns)
} }
@@ -140,7 +144,6 @@ func init() {
rootCmd.PersistentFlags().DurationVar(&rootArgs.timeout, "timeout", 5*time.Minute, "timeout for this operation") rootCmd.PersistentFlags().DurationVar(&rootArgs.timeout, "timeout", 5*time.Minute, "timeout for this operation")
rootCmd.PersistentFlags().BoolVar(&rootArgs.verbose, "verbose", false, "print generated objects") rootCmd.PersistentFlags().BoolVar(&rootArgs.verbose, "verbose", false, "print generated objects")
configureDefaultNamespace()
kubeconfigArgs.APIServer = nil // prevent AddFlags from configuring --server flag kubeconfigArgs.APIServer = nil // prevent AddFlags from configuring --server flag
kubeconfigArgs.Timeout = nil // prevent AddFlags from configuring --request-timeout flag, we have --timeout instead kubeconfigArgs.Timeout = nil // prevent AddFlags from configuring --request-timeout flag, we have --timeout instead
kubeconfigArgs.AddFlags(rootCmd.PersistentFlags()) kubeconfigArgs.AddFlags(rootCmd.PersistentFlags())
@@ -198,8 +201,10 @@ func main() {
} }
} }
func configureDefaultNamespace() { func GetDesiredNamespace(cfg *genericclioptions.ConfigFlags) string {
*kubeconfigArgs.Namespace = rootArgs.defaults.Namespace if *cfg.Namespace != "" {
return *cfg.Namespace
}
fromEnv := os.Getenv("FLUX_SYSTEM_NAMESPACE") fromEnv := os.Getenv("FLUX_SYSTEM_NAMESPACE")
if fromEnv != "" { if fromEnv != "" {
// namespace must be a valid DNS label. Assess against validation // namespace must be a valid DNS label. Assess against validation
@@ -207,11 +212,28 @@ func configureDefaultNamespace() {
// may not be actively provided by end-user. // may not be actively provided by end-user.
if e := validation.IsDNS1123Label(fromEnv); len(e) > 0 { if e := validation.IsDNS1123Label(fromEnv); len(e) > 0 {
logger.Warningf(" ignoring invalid FLUX_SYSTEM_NAMESPACE: %q", fromEnv) logger.Warningf(" ignoring invalid FLUX_SYSTEM_NAMESPACE: %q", fromEnv)
return } else {
return fromEnv
}
} }
kubeconfigArgs.Namespace = &fromEnv if _, has := os.LookupEnv("FLUX_NS_FOLLOW_KUBECONTEXT"); has {
rawCfg, err := cfg.ToRawKubeConfigLoader().RawConfig()
if err != nil {
logger.Warningf(" failed parsing kubeconfig, ignoring: %q", fromEnv)
} else {
ctx := *cfg.Context
if ctx == "" {
ctx = rawCfg.CurrentContext
} }
ns := rawCfg.Contexts[ctx].Namespace
if ns != "" {
return ns
}
}
}
return rootArgs.defaults.Namespace
} }
// readPasswordFromStdin reads a password from stdin and returns the input // readPasswordFromStdin reads a password from stdin and returns the input

View File

@@ -85,7 +85,7 @@ func buildComponentObjectRefs(components ...string) ([]object.ObjMetadata, error
var objRefs []object.ObjMetadata var objRefs []object.ObjMetadata
for _, deployment := range components { for _, deployment := range components {
objRefs = append(objRefs, object.ObjMetadata{ objRefs = append(objRefs, object.ObjMetadata{
Namespace: *kubeconfigArgs.Namespace, Namespace: GetDesiredNamespace(kubeconfigArgs),
Name: deployment, Name: deployment,
GroupKind: schema.GroupKind{Group: "apps", Kind: "Deployment"}, GroupKind: schema.GroupKind{Group: "apps", Kind: "Deployment"},
}) })

View File

@@ -1,3 +1,3 @@
► checking prerequisites ► checking prerequisites
✔ Kubernetes {{ .serverVersion }} >=1.24.0-0 ✔ Kubernetes {{ .serverVersion }} >=1.25.0-0
✔ prerequisites checks passed ✔ prerequisites checks passed

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Namespace
metadata:
name: podinfo
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: podinfo
spec:
interval: 5m0s
path: ./kustomize
force: true
prune: true
sourceRef:
kind: GitRepository
name: podinfo
targetNamespace: default

View File

@@ -333,7 +333,7 @@ func (b *Builder) unMarshallKustomization() (*kustomizev1.Kustomization, error)
k := &kustomizev1.Kustomization{} k := &kustomizev1.Kustomization{}
decoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewBuffer(data), len(data)) decoder := k8syaml.NewYAMLOrJSONDecoder(bytes.NewBuffer(data), len(data))
// check for kustomization in yaml with the same name and namespace // check for kustomization in yaml with the same name and namespace
for !(k.Name == b.name && (k.Namespace == b.namespace || k.Namespace == "")) { for {
err = decoder.Decode(k) err = decoder.Decode(k)
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {
@@ -343,6 +343,13 @@ func (b *Builder) unMarshallKustomization() (*kustomizev1.Kustomization, error)
return nil, fmt.Errorf("failed to unmarshall kustomization file %s: %w", b.kustomizationFile, err) return nil, fmt.Errorf("failed to unmarshall kustomization file %s: %w", b.kustomizationFile, err)
} }
} }
if strings.HasPrefix(k.APIVersion, kustomizev1.GroupVersion.Group+"/") &&
k.Kind == kustomizev1.KustomizationKind &&
k.Name == b.name &&
(k.Namespace == b.namespace || k.Namespace == "") {
break
}
} }
return k, nil return k, nil
} }

View File

@@ -189,6 +189,12 @@ func Test_unMarshallKustomization(t *testing.T) {
wantErr: true, wantErr: true,
errString: "failed find kustomization with name", errString: "failed find kustomization with name",
}, },
{
name: "yaml containing other resource with same name as kustomization",
localKsFile: "testdata/local-kustomization/invalid-resource.yaml",
wantErr: true,
errString: "failed find kustomization with name",
},
} }
b := &Builder{ b := &Builder{
@@ -324,7 +330,10 @@ func Test_ResolveKustomization(t *testing.T) {
}, },
} }
b := &Builder{} b := &Builder{
name: "podinfo",
namespace: "flux-system",
}
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
b.kustomizationFile = tt.localKsFile b.kustomizationFile = tt.localKsFile

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: podinfo

View File

@@ -6,7 +6,7 @@ spec:
interval: 5m interval: 5m
chart: chart:
spec: spec:
version: "48.x" version: "45.x"
chart: kube-prometheus-stack chart: kube-prometheus-stack
sourceRef: sourceRef:
kind: HelmRepository kind: HelmRepository
@@ -31,249 +31,6 @@ spec:
podMonitorSelector: podMonitorSelector:
matchLabels: matchLabels:
app.kubernetes.io/component: monitoring app.kubernetes.io/component: monitoring
grafana:
defaultDashboardsEnabled: false
kube-state-metrics:
collectors: []
extraArgs:
- --custom-resource-state-only=true
rbac:
extraRules:
- apiGroups:
- source.toolkit.fluxcd.io
- kustomize.toolkit.fluxcd.io
- helm.toolkit.fluxcd.io
- image.toolkit.fluxcd.io
- notification.toolkit.fluxcd.io
resources:
- gitrepositories
- buckets
- helmrepositories
- helmcharts
- ocirepositories
- kustomizations
- helmreleases
- imagerepositories
- imagepolicies
- imageupdateautomations
- alerts
- providers
- receivers
verbs: ["list", "watch"]
customResourceState:
enabled: true
config:
spec:
resources:
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1"
kind: GitRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: Bucket
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
type: [spec, type]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: HelmChart
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: source.toolkit.fluxcd.io
version: "v1beta2"
kind: OCIRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: kustomize.toolkit.fluxcd.io
version: "v1"
kind: Kustomization
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: helm.toolkit.fluxcd.io
version: "v2beta1"
kind: HelmRelease
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImageRepository
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta2"
kind: ImagePolicy
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: image.toolkit.fluxcd.io
version: "v1beta1"
kind: ImageUpdateAutomation
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Alert
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1beta2"
kind: Provider
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
- groupVersionKind:
group: notification.toolkit.fluxcd.io
version: "v1"
kind: Receiver
metricNamePrefix: gotk
metrics:
- name: "resource_info"
help: "The current state of a GitOps Toolkit resource."
each:
type: Info
info:
labelsFromPath:
name: [metadata, name]
labelsFromPath:
exported_namespace: [metadata, namespace]
ready: [status, conditions, "[type=Ready]", status]
postRenderers: postRenderers:
- kustomize: - kustomize:
patches: patches:

View File

@@ -30,23 +30,18 @@
] ]
}, },
"editable": true, "editable": true,
"fiscalYearStartMonth": 0, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 5, "iteration": 1652337714814,
"links": [], "links": [],
"liveNow": false,
"panels": [ "panels": [
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"decimals": 0, "decimals": 0,
"mappings": [], "mappings": [],
"noValue": "0",
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
@@ -86,37 +81,28 @@
"text": {}, "text": {},
"textMode": "value" "textMode": "value"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": { "exemplar": true,
"type": "prometheus", "expr": "count(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"True\",kind=~\"Kustomization|HelmRelease\"})\n-\nsum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"Deleted\",kind=~\"Kustomization|HelmRelease\"})",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\"})",
"instant": true,
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": false,
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Cluster Reconcilers", "title": "Cluster Reconcilers",
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"decimals": 0, "decimals": 0,
"mappings": [], "mappings": [],
"noValue": "0",
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
@@ -152,37 +138,28 @@
"text": {}, "text": {},
"textMode": "value" "textMode": "value"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": { "exemplar": true,
"type": "prometheus", "expr": "sum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"Kustomization|HelmRelease\"})",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\", ready=\"False\"})",
"instant": true,
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": false,
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Failing Reconcilers", "title": "Failing Reconcilers",
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"decimals": 0, "decimals": 0,
"mappings": [], "mappings": [],
"noValue": "0",
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
@@ -222,37 +199,28 @@
"text": {}, "text": {},
"textMode": "value" "textMode": "value"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": { "exemplar": true,
"type": "prometheus", "expr": "count(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"True\",kind=~\"GitRepository|HelmRepository|Bucket\"})\n-\nsum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"Deleted\",kind=~\"GitRepository|HelmRepository|Bucket\"})",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"})",
"instant": true,
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": false,
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Kubernetes Manifests Sources", "title": "Kubernetes Manifests Sources",
"type": "stat" "type": "stat"
}, },
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"decimals": 0, "decimals": 0,
"mappings": [], "mappings": [],
"noValue": "0",
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
@@ -288,23 +256,18 @@
"text": {}, "text": {},
"textMode": "value" "textMode": "value"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": { "exemplar": true,
"type": "prometheus", "expr": "sum(gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"GitRepository|HelmRepository|Bucket\"})",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\", ready=\"False\"})",
"instant": true,
"interval": "", "interval": "",
"legendFormat": "", "legendFormat": "",
"range": false,
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Failing Sources", "title": "Failing Sources",
"type": "stat" "type": "stat"
}, },
@@ -355,10 +318,9 @@
"values": false "values": false
}, },
"showUnfilled": true, "showUnfilled": true,
"text": {}, "text": {}
"valueMode": "color"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"exemplar": true, "exemplar": true,
@@ -368,6 +330,8 @@
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Reconciler ops avg. duration", "title": "Reconciler ops avg. duration",
"type": "bargauge" "type": "bargauge"
}, },
@@ -418,19 +382,20 @@
"values": false "values": false
}, },
"showUnfilled": true, "showUnfilled": true,
"text": {}, "text": {}
"valueMode": "color"
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"exemplar": true, "exemplar": true,
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind)", "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)",
"interval": "", "interval": "",
"legendFormat": "{{kind}}", "legendFormat": "{{kind}}",
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Source ops avg. duration", "title": "Source ops avg. duration",
"type": "bargauge" "type": "bargauge"
}, },
@@ -449,33 +414,23 @@
"type": "row" "type": "row"
}, },
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": { "custom": {
"align": "auto", "displayMode": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": true, "filterable": true,
"inspect": false "inspect": false
}, },
"mappings": [ "mappings": [
{ {
"options": { "options": {
"False": { "0": {
"color": "red",
"index": 1,
"text": "Not Ready"
},
"True": {
"color": "blue",
"index": 0,
"text": "Ready" "text": "Ready"
},
"1": {
"text": "Not Ready"
} }
}, },
"type": "value" "type": "value"
@@ -485,8 +440,16 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "transparent", "color": "blue",
"value": null "value": null
},
{
"color": "blue",
"value": 0
},
{
"color": "red",
"value": 1
} }
] ]
} }
@@ -494,16 +457,13 @@
"overrides": [ "overrides": [
{ {
"matcher": { "matcher": {
"id": "byType", "id": "byName",
"options": "string" "options": "Status"
}, },
"properties": [ "properties": [
{ {
"id": "custom.cellOptions", "id": "custom.displayMode",
"value": { "value": "color-background"
"mode": "basic",
"type": "color-background"
}
} }
] ]
} }
@@ -517,9 +477,7 @@
}, },
"id": 33, "id": 33,
"options": { "options": {
"cellHeight": "sm",
"footer": { "footer": {
"countRows": false,
"fields": "", "fields": "",
"reducer": [ "reducer": [
"sum" "sum"
@@ -534,16 +492,11 @@
} }
] ]
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": true, "exemplar": true,
"expr": "gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"Kustomization|HelmRelease\"}", "expr": "gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"Kustomization|HelmRelease\"}",
"format": "table", "format": "table",
"instant": true, "instant": true,
"interval": "", "interval": "",
@@ -551,6 +504,8 @@
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Cluster reconciliation readiness ", "title": "Cluster reconciliation readiness ",
"transformations": [ "transformations": [
{ {
@@ -558,16 +513,11 @@
"options": { "options": {
"excludeByName": { "excludeByName": {
"Time": true, "Time": true,
"Value": true,
"__name__": true, "__name__": true,
"app": true, "app": true,
"container": true, "container": true,
"customresource_group": true,
"customresource_kind": false,
"customresource_version": true,
"endpoint": true, "endpoint": true,
"exported_namespace": false, "exported_namespace": false,
"gotk_type": true,
"instance": true, "instance": true,
"job": true, "job": true,
"kubernetes_namespace": true, "kubernetes_namespace": true,
@@ -575,36 +525,16 @@
"namespace": true, "namespace": true,
"pod": true, "pod": true,
"pod_template_hash": true, "pod_template_hash": true,
"service": true,
"status": true, "status": true,
"type": true "type": true
}, },
"indexByName": { "indexByName": {},
"Time": 0,
"Value": 15,
"__name__": 1,
"container": 2,
"customresource_group": 4,
"customresource_kind": 5,
"customresource_version": 6,
"endpoint": 7,
"exported_namespace": 3,
"instance": 8,
"job": 9,
"name": 10,
"namespace": 11,
"pod": 12,
"ready": 13,
"service": 14
},
"renameByName": { "renameByName": {
"Value": "", "Value": "Status",
"customresource_kind": "Kind",
"exported_namespace": "Namespace", "exported_namespace": "Namespace",
"kind": "Kind", "kind": "Kind",
"name": "Name", "name": "Name",
"namespace": "Operator Namespace", "namespace": "Operator Namespace"
"ready": "Status"
} }
} }
} }
@@ -612,36 +542,23 @@
"type": "table" "type": "table"
}, },
{ {
"datasource": { "datasource": "${DS_PROMETHEUS}",
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": {
"mode": "thresholds"
},
"custom": { "custom": {
"align": "auto", "displayMode": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": true, "filterable": true,
"inspect": false "inspect": false
}, },
"mappings": [ "mappings": [
{ {
"options": { "options": {
"False": { "0": {
"color": "red",
"index": 1,
"text": "Not Ready"
},
"True": {
"color": "blue",
"index": 0,
"text": "Ready" "text": "Ready"
},
"1": {
"text": "Not Ready"
} }
}, },
"type": "value" "type": "value"
@@ -651,28 +568,21 @@
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ {
"color": "transparent", "color": "blue",
"value": null "value": null
},
{
"color": "blue",
"value": 0
},
{
"color": "red",
"value": 1
} }
] ]
} }
}, },
"overrides": [ "overrides": [
{
"matcher": {
"id": "byType",
"options": "string"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"mode": "basic",
"type": "color-background"
}
}
]
},
{ {
"matcher": { "matcher": {
"id": "byName", "id": "byName",
@@ -680,15 +590,8 @@
}, },
"properties": [ "properties": [
{ {
"id": "noValue", "id": "custom.displayMode",
"value": "Ready" "value": "color-background"
},
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
} }
] ]
} }
@@ -702,9 +605,7 @@
}, },
"id": 34, "id": 34,
"options": { "options": {
"cellHeight": "sm",
"footer": { "footer": {
"countRows": false,
"fields": "", "fields": "",
"reducer": [ "reducer": [
"sum" "sum"
@@ -719,16 +620,11 @@
} }
] ]
}, },
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"targets": [ "targets": [
{ {
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"exemplar": true, "exemplar": true,
"expr": "gotk_resource_info{exported_namespace=~\"$namespace\", customresource_kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}", "expr": "gotk_reconcile_condition{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",type=\"Ready\",status=\"False\",kind=~\"GitRepository|HelmRepository|Bucket\"}",
"format": "table", "format": "table",
"instant": true, "instant": true,
"interval": "", "interval": "",
@@ -736,6 +632,8 @@
"refId": "A" "refId": "A"
} }
], ],
"timeFrom": null,
"timeShift": null,
"title": "Source acquisition readiness ", "title": "Source acquisition readiness ",
"transformations": [ "transformations": [
{ {
@@ -743,16 +641,11 @@
"options": { "options": {
"excludeByName": { "excludeByName": {
"Time": true, "Time": true,
"Value": true,
"__name__": true, "__name__": true,
"app": true, "app": true,
"container": true, "container": true,
"customresource_group": true,
"customresource_kind": false,
"customresource_version": true,
"endpoint": true, "endpoint": true,
"exported_namespace": false, "exported_namespace": false,
"gotk_type": true,
"instance": true, "instance": true,
"job": true, "job": true,
"kubernetes_namespace": true, "kubernetes_namespace": true,
@@ -760,37 +653,16 @@
"namespace": true, "namespace": true,
"pod": true, "pod": true,
"pod_template_hash": true, "pod_template_hash": true,
"ready": false,
"service": true,
"status": true, "status": true,
"type": true "type": true
}, },
"indexByName": { "indexByName": {},
"Time": 0,
"Value": 15,
"__name__": 1,
"container": 2,
"customresource_group": 5,
"customresource_kind": 6,
"customresource_version": 7,
"endpoint": 8,
"exported_namespace": 4,
"instance": 9,
"job": 10,
"name": 11,
"namespace": 3,
"pod": 12,
"ready": 13,
"service": 14
},
"renameByName": { "renameByName": {
"Value": "", "Value": "Status",
"customresource_kind": "Kind",
"exported_namespace": "Namespace", "exported_namespace": "Namespace",
"kind": "Kind", "kind": "Kind",
"name": "Name", "name": "Name",
"namespace": "Operator Namespace", "namespace": "Operator Namespace"
"ready": "Status"
} }
} }
} }
@@ -818,6 +690,10 @@
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS}", "datasource": "${DS_PROMETHEUS}",
"description": "", "description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
@@ -848,7 +724,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -867,7 +743,9 @@
} }
], ],
"thresholds": [], "thresholds": [],
"timeFrom": null,
"timeRegions": [], "timeRegions": [],
"timeShift": null,
"title": "Cluster reconciliation duration", "title": "Cluster reconciliation duration",
"tooltip": { "tooltip": {
"shared": true, "shared": true,
@@ -876,24 +754,33 @@
}, },
"type": "graph", "type": "graph",
"xaxis": { "xaxis": {
"buckets": null,
"mode": "time", "mode": "time",
"name": null,
"show": true, "show": true,
"values": [] "values": []
}, },
"yaxes": [ "yaxes": [
{ {
"format": "s", "format": "s",
"label": null,
"logBase": 1, "logBase": 1,
"max": null,
"min": null,
"show": true "show": true
}, },
{ {
"format": "short", "format": "short",
"label": null,
"logBase": 1, "logBase": 1,
"max": null,
"min": null,
"show": true "show": true
} }
], ],
"yaxis": { "yaxis": {
"align": false "align": false,
"alignLevel": null
} }
}, },
{ {
@@ -903,6 +790,10 @@
"dashes": false, "dashes": false,
"datasource": "${DS_PROMETHEUS}", "datasource": "${DS_PROMETHEUS}",
"description": "", "description": "",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1, "fill": 1,
"fillGradient": 0, "fillGradient": 0,
"gridPos": { "gridPos": {
@@ -933,7 +824,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "10.0.2", "pluginVersion": "7.5.5",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -944,7 +835,7 @@
"targets": [ "targets": [
{ {
"exemplar": true, "exemplar": true,
"expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket|OCIRepository\"}[5m])) by (kind, name)", "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)",
"hide": false, "hide": false,
"interval": "", "interval": "",
"legendFormat": "{{kind}}/{{name}}", "legendFormat": "{{kind}}/{{name}}",
@@ -952,7 +843,9 @@
} }
], ],
"thresholds": [], "thresholds": [],
"timeFrom": null,
"timeRegions": [], "timeRegions": [],
"timeShift": null,
"title": "Source acquisition duration", "title": "Source acquisition duration",
"tooltip": { "tooltip": {
"shared": true, "shared": true,
@@ -961,29 +854,38 @@
}, },
"type": "graph", "type": "graph",
"xaxis": { "xaxis": {
"buckets": null,
"mode": "time", "mode": "time",
"name": null,
"show": true, "show": true,
"values": [] "values": []
}, },
"yaxes": [ "yaxes": [
{ {
"format": "s", "format": "s",
"label": null,
"logBase": 1, "logBase": 1,
"max": null,
"min": null,
"show": true "show": true
}, },
{ {
"format": "short", "format": "short",
"label": null,
"logBase": 1, "logBase": 1,
"max": null,
"min": null,
"show": true "show": true
} }
], ],
"yaxis": { "yaxis": {
"align": false "align": false,
"alignLevel": null
} }
} }
], ],
"refresh": "30s", "refresh": "30s",
"schemaVersion": 38, "schemaVersion": 36,
"style": "light", "style": "light",
"tags": [ "tags": [
"flux" "flux"
@@ -1001,13 +903,13 @@
"$__all" "$__all"
] ]
}, },
"datasource": { "datasource": "$DS_PROMETHEUS",
"type": "prometheus",
"uid": "$DS_PROMETHEUS"
},
"definition": "label_values(gotk_reconcile_condition, namespace)", "definition": "label_values(gotk_reconcile_condition, namespace)",
"description": null,
"error": null,
"hide": 0, "hide": 0,
"includeAll": true, "includeAll": true,
"label": null,
"multi": true, "multi": true,
"name": "operator_namespace", "name": "operator_namespace",
"options": [], "options": [],
@@ -1026,8 +928,10 @@
"useTags": false "useTags": false
}, },
{ {
"allValue": null,
"current": { "current": {
"selected": true, "selected": true,
"tags": [],
"text": [ "text": [
"All" "All"
], ],
@@ -1035,19 +939,19 @@
"$__all" "$__all"
] ]
}, },
"datasource": { "datasource": "$DS_PROMETHEUS",
"type": "prometheus", "definition": "label_values(gotk_reconcile_condition, exported_namespace)",
"uid": "$DS_PROMETHEUS" "description": null,
}, "error": null,
"definition": "label_values(gotk_resource_info,exported_namespace)",
"hide": 0, "hide": 0,
"includeAll": true, "includeAll": true,
"label": null,
"multi": true, "multi": true,
"name": "namespace", "name": "namespace",
"options": [], "options": [],
"query": { "query": {
"query": "label_values(gotk_resource_info,exported_namespace)", "query": "label_values(gotk_reconcile_condition, exported_namespace)",
"refId": "PrometheusVariableQueryEditor-VariableQuery" "refId": "StandardVariableQuery"
}, },
"refresh": 2, "refresh": 2,
"regex": "", "regex": "",
@@ -1096,9 +1000,7 @@
"1d" "1d"
] ]
}, },
"timezone": "",
"title": "Flux Cluster Stats", "title": "Flux Cluster Stats",
"uid": "flux-cluster", "uid": "flux-cluster",
"version": 4, "version": 3
"weekStart": ""
} }