Skip to content
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

feat: kubernetes aws connection #1195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ tidy:
# Generate OpenAPI schema
.PHONY: gen-schemas
gen-schemas:
cp go.mod hack/generate-schemas && \
# cp go.mod hack/generate-schemas && \
cd hack/generate-schemas && \
go mod edit -module=github.com/flanksource/config-db/hack/generate-schemas && \
go mod edit -require=github.com/flanksource/[email protected] && \
go mod edit -replace=github.com/flanksource/config-db=../../ && \
go mod tidy && \
# go mod edit -module=github.com/flanksource/config-db/hack/generate-schemas && \
# go mod edit -require=github.com/flanksource/[email protected] && \
# go mod edit -replace=github.com/flanksource/config-db=../../ && \
# go mod tidy && \
go run ./main.go


Expand Down
24 changes: 13 additions & 11 deletions api/v1/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/flanksource/commons/collections"
"github.com/flanksource/duty"
"github.com/flanksource/duty/connection"
"github.com/flanksource/duty/types"
coreV1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -211,17 +212,18 @@ func AddEventResourceToWatch(watches []KubernetesResourceToWatch) []KubernetesRe
}

type Kubernetes struct {
BaseScraper `json:",inline"`
ClusterName string `json:"clusterName"`
Namespace string `json:"namespace,omitempty"`
UseCache bool `json:"useCache,omitempty"`
AllowIncomplete bool `json:"allowIncomplete,omitempty"`
Scope string `json:"scope,omitempty"`
Since string `json:"since,omitempty"`
Selector string `json:"selector,omitempty"`
FieldSelector string `json:"fieldSelector,omitempty"`
MaxInflight int64 `json:"maxInflight,omitempty"`
Kubeconfig *types.EnvVar `json:"kubeconfig,omitempty"`
BaseScraper `json:",inline"`
connection.KubernetesConnection `json:",inline"`

ClusterName string `json:"clusterName"`
Namespace string `json:"namespace,omitempty"`
UseCache bool `json:"useCache,omitempty"`
AllowIncomplete bool `json:"allowIncomplete,omitempty"`
Scope string `json:"scope,omitempty"`
Since string `json:"since,omitempty"`
Selector string `json:"selector,omitempty"`
FieldSelector string `json:"fieldSelector,omitempty"`
MaxInflight int64 `json:"maxInflight,omitempty"`

// Watch specifies which Kubernetes resources should be watched.
// This allows for near real-time updates of the config items
Expand Down
6 changes: 1 addition & 5 deletions api/v1/zz_generated.deepcopy.go

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

294 changes: 294 additions & 0 deletions chart/crds/configs.flanksource.com_scrapeconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3455,6 +3455,86 @@ spec:
type: string
clusterName:
type: string
cnrm:
properties:
clusterResource:
type: string
clusterResourceNamespace:
type: string
gke:
properties:
cluster:
type: string
connection:
description: ConnectionName of the connection. It'll
be used to populate the endpoint and credentials.
type: string
credentials:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
helmRef:
properties:
key:
description: Key is a JSONPath expression
used to fetch the key from the merged
JSON.
type: string
name:
type: string
required:
- key
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
serviceAccount:
description: ServiceAccount specifies the service
account whose token should be fetched
type: string
type: object
type: object
endpoint:
type: string
projectID:
type: string
skipTLSVerify:
description: Skip TLS verify
type: boolean
zone:
type: string
required:
- cluster
- projectID
- zone
type: object
required:
- clusterResource
- clusterResourceNamespace
- gke
type: object
connection:
description: Connection name to populate kubeconfig
type: string
createFields:
description: |-
CreateFields is a list of JSONPath expression used to identify the created time of the config.
Expand All @@ -3473,6 +3553,155 @@ spec:
description: A static value or JSONPath expression to use as
the description for the resource.
type: string
eks:
properties:
accessKey:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
helmRef:
properties:
key:
description: Key is a JSONPath expression used
to fetch the key from the merged JSON.
type: string
name:
type: string
required:
- key
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
serviceAccount:
description: ServiceAccount specifies the service
account whose token should be fetched
type: string
type: object
type: object
assumeRole:
type: string
cluster:
type: string
connection:
description: ConnectionName of the connection. It'll be
used to populate the endpoint, accessKey and secretKey.
type: string
endpoint:
type: string
region:
type: string
secretKey:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
helmRef:
properties:
key:
description: Key is a JSONPath expression used
to fetch the key from the merged JSON.
type: string
name:
type: string
required:
- key
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
serviceAccount:
description: ServiceAccount specifies the service
account whose token should be fetched
type: string
type: object
type: object
sessionToken:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
helmRef:
properties:
key:
description: Key is a JSONPath expression used
to fetch the key from the merged JSON.
type: string
name:
type: string
required:
- key
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
serviceAccount:
description: ServiceAccount specifies the service
account whose token should be fetched
type: string
type: object
type: object
skipTLSVerify:
description: Skip TLS verify when connecting to aws
type: boolean
required:
- cluster
type: object
event:
description: Event specifies how the Kubernetes event should
be handled.
Expand Down Expand Up @@ -3536,6 +3765,71 @@ spec:
description: Format of config item, defaults to JSON, available
options are JSON, properties
type: string
gke:
properties:
cluster:
type: string
connection:
description: ConnectionName of the connection. It'll be
used to populate the endpoint and credentials.
type: string
credentials:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
helmRef:
properties:
key:
description: Key is a JSONPath expression used
to fetch the key from the merged JSON.
type: string
name:
type: string
required:
- key
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
required:
- key
type: object
serviceAccount:
description: ServiceAccount specifies the service
account whose token should be fetched
type: string
type: object
type: object
endpoint:
type: string
projectID:
type: string
skipTLSVerify:
description: Skip TLS verify
type: boolean
zone:
type: string
required:
- cluster
- projectID
- zone
type: object
health:
description: A static value or JSONPath expression to use as
the health of the config item
Expand Down
Loading
Loading