Skip to content

Commit 25d2274

Browse files
adityathebemoshloop
authored andcommitted
feat: support kubernetes connection
1 parent 0c28734 commit 25d2274

File tree

6 files changed

+425
-22
lines changed

6 files changed

+425
-22
lines changed

api/v1/kubernetes.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/flanksource/commons/collections"
99
"github.com/flanksource/duty"
1010
"github.com/flanksource/duty/connection"
11-
"github.com/flanksource/duty/types"
1211
coreV1 "k8s.io/api/core/v1"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1413
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -269,11 +268,12 @@ func (t *Kubernetes) Hash() string {
269268
}
270269

271270
type KubernetesFile struct {
272-
BaseScraper `json:",inline"`
273-
Kubeconfig *types.EnvVar `json:"kubeconfig,omitempty"`
274-
Selector ResourceSelector `json:"selector" yaml:"selector"`
275-
Container string `json:"container,omitempty" yaml:"container,omitempty"`
276-
Files []PodFile `json:"files,omitempty" yaml:"files,omitempty"`
271+
BaseScraper `json:",inline"`
272+
connection.KubernetesConnection `json:",inline"`
273+
274+
Selector ResourceSelector `json:"selector" yaml:"selector"`
275+
Container string `json:"container,omitempty" yaml:"container,omitempty"`
276+
Files []PodFile `json:"files,omitempty" yaml:"files,omitempty"`
277277
}
278278

279279
type PodFile struct {

api/v1/zz_generated.deepcopy.go

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chart/crds/configs.flanksource.com_scrapeconfigs.yaml

Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7025,6 +7025,88 @@ spec:
70257025
description: A static value or JSONPath expression to use as
70267026
the class for the resource.
70277027
type: string
7028+
cnrm:
7029+
properties:
7030+
clusterResource:
7031+
type: string
7032+
clusterResourceNamespace:
7033+
type: string
7034+
gke:
7035+
properties:
7036+
cluster:
7037+
type: string
7038+
connection:
7039+
description: ConnectionName of the connection. It'll
7040+
be used to populate the endpoint and credentials.
7041+
type: string
7042+
credentials:
7043+
properties:
7044+
name:
7045+
type: string
7046+
value:
7047+
type: string
7048+
valueFrom:
7049+
properties:
7050+
configMapKeyRef:
7051+
properties:
7052+
key:
7053+
type: string
7054+
name:
7055+
type: string
7056+
required:
7057+
- key
7058+
type: object
7059+
helmRef:
7060+
properties:
7061+
key:
7062+
description: Key is a JSONPath expression
7063+
used to fetch the key from the merged
7064+
JSON.
7065+
type: string
7066+
name:
7067+
type: string
7068+
required:
7069+
- key
7070+
type: object
7071+
secretKeyRef:
7072+
properties:
7073+
key:
7074+
type: string
7075+
name:
7076+
type: string
7077+
required:
7078+
- key
7079+
type: object
7080+
serviceAccount:
7081+
description: ServiceAccount specifies the service
7082+
account whose token should be fetched
7083+
type: string
7084+
type: object
7085+
type: object
7086+
endpoint:
7087+
type: string
7088+
project:
7089+
type: string
7090+
projectID:
7091+
type: string
7092+
skipTLSVerify:
7093+
description: Skip TLS verify
7094+
type: boolean
7095+
zone:
7096+
type: string
7097+
required:
7098+
- cluster
7099+
- projectID
7100+
- zone
7101+
type: object
7102+
required:
7103+
- clusterResource
7104+
- clusterResourceNamespace
7105+
- gke
7106+
type: object
7107+
connection:
7108+
description: Connection name to populate kubeconfig
7109+
type: string
70287110
container:
70297111
type: string
70307112
createFields:
@@ -7045,6 +7127,155 @@ spec:
70457127
description: A static value or JSONPath expression to use as
70467128
the description for the resource.
70477129
type: string
7130+
eks:
7131+
properties:
7132+
accessKey:
7133+
properties:
7134+
name:
7135+
type: string
7136+
value:
7137+
type: string
7138+
valueFrom:
7139+
properties:
7140+
configMapKeyRef:
7141+
properties:
7142+
key:
7143+
type: string
7144+
name:
7145+
type: string
7146+
required:
7147+
- key
7148+
type: object
7149+
helmRef:
7150+
properties:
7151+
key:
7152+
description: Key is a JSONPath expression used
7153+
to fetch the key from the merged JSON.
7154+
type: string
7155+
name:
7156+
type: string
7157+
required:
7158+
- key
7159+
type: object
7160+
secretKeyRef:
7161+
properties:
7162+
key:
7163+
type: string
7164+
name:
7165+
type: string
7166+
required:
7167+
- key
7168+
type: object
7169+
serviceAccount:
7170+
description: ServiceAccount specifies the service
7171+
account whose token should be fetched
7172+
type: string
7173+
type: object
7174+
type: object
7175+
assumeRole:
7176+
type: string
7177+
cluster:
7178+
type: string
7179+
connection:
7180+
description: ConnectionName of the connection. It'll be
7181+
used to populate the endpoint, accessKey and secretKey.
7182+
type: string
7183+
endpoint:
7184+
type: string
7185+
region:
7186+
type: string
7187+
secretKey:
7188+
properties:
7189+
name:
7190+
type: string
7191+
value:
7192+
type: string
7193+
valueFrom:
7194+
properties:
7195+
configMapKeyRef:
7196+
properties:
7197+
key:
7198+
type: string
7199+
name:
7200+
type: string
7201+
required:
7202+
- key
7203+
type: object
7204+
helmRef:
7205+
properties:
7206+
key:
7207+
description: Key is a JSONPath expression used
7208+
to fetch the key from the merged JSON.
7209+
type: string
7210+
name:
7211+
type: string
7212+
required:
7213+
- key
7214+
type: object
7215+
secretKeyRef:
7216+
properties:
7217+
key:
7218+
type: string
7219+
name:
7220+
type: string
7221+
required:
7222+
- key
7223+
type: object
7224+
serviceAccount:
7225+
description: ServiceAccount specifies the service
7226+
account whose token should be fetched
7227+
type: string
7228+
type: object
7229+
type: object
7230+
sessionToken:
7231+
properties:
7232+
name:
7233+
type: string
7234+
value:
7235+
type: string
7236+
valueFrom:
7237+
properties:
7238+
configMapKeyRef:
7239+
properties:
7240+
key:
7241+
type: string
7242+
name:
7243+
type: string
7244+
required:
7245+
- key
7246+
type: object
7247+
helmRef:
7248+
properties:
7249+
key:
7250+
description: Key is a JSONPath expression used
7251+
to fetch the key from the merged JSON.
7252+
type: string
7253+
name:
7254+
type: string
7255+
required:
7256+
- key
7257+
type: object
7258+
secretKeyRef:
7259+
properties:
7260+
key:
7261+
type: string
7262+
name:
7263+
type: string
7264+
required:
7265+
- key
7266+
type: object
7267+
serviceAccount:
7268+
description: ServiceAccount specifies the service
7269+
account whose token should be fetched
7270+
type: string
7271+
type: object
7272+
type: object
7273+
skipTLSVerify:
7274+
description: Skip TLS verify when connecting to aws
7275+
type: boolean
7276+
required:
7277+
- cluster
7278+
type: object
70487279
files:
70497280
items:
70507281
properties:
@@ -7060,6 +7291,73 @@ spec:
70607291
description: Format of config item, defaults to JSON, available
70617292
options are JSON, properties
70627293
type: string
7294+
gke:
7295+
properties:
7296+
cluster:
7297+
type: string
7298+
connection:
7299+
description: ConnectionName of the connection. It'll be
7300+
used to populate the endpoint and credentials.
7301+
type: string
7302+
credentials:
7303+
properties:
7304+
name:
7305+
type: string
7306+
value:
7307+
type: string
7308+
valueFrom:
7309+
properties:
7310+
configMapKeyRef:
7311+
properties:
7312+
key:
7313+
type: string
7314+
name:
7315+
type: string
7316+
required:
7317+
- key
7318+
type: object
7319+
helmRef:
7320+
properties:
7321+
key:
7322+
description: Key is a JSONPath expression used
7323+
to fetch the key from the merged JSON.
7324+
type: string
7325+
name:
7326+
type: string
7327+
required:
7328+
- key
7329+
type: object
7330+
secretKeyRef:
7331+
properties:
7332+
key:
7333+
type: string
7334+
name:
7335+
type: string
7336+
required:
7337+
- key
7338+
type: object
7339+
serviceAccount:
7340+
description: ServiceAccount specifies the service
7341+
account whose token should be fetched
7342+
type: string
7343+
type: object
7344+
type: object
7345+
endpoint:
7346+
type: string
7347+
project:
7348+
type: string
7349+
projectID:
7350+
type: string
7351+
skipTLSVerify:
7352+
description: Skip TLS verify
7353+
type: boolean
7354+
zone:
7355+
type: string
7356+
required:
7357+
- cluster
7358+
- projectID
7359+
- zone
7360+
type: object
70637361
health:
70647362
description: A static value or JSONPath expression to use as
70657363
the health of the config item

0 commit comments

Comments
 (0)