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

Add support for fetching sensitive parts of actions from secrets #816

Merged
merged 29 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
99c9486
Set initial TODOs.
fanicia Apr 11, 2023
229d150
Remove clear text apitoken.
fanicia Apr 21, 2023
f2a622f
Start implementing a secretMap.
fanicia Apr 21, 2023
a43fb2c
Non-working commit.
fanicia Apr 21, 2023
bc6ed0b
Almost removed cleartext token.
fanicia Apr 21, 2023
fdf185f
Fix resolveSecrets.
fanicia Apr 21, 2023
494b27a
Fix OpsGenie and HumioActionRepository.
fanicia Apr 21, 2023
e4014b8
Change TODO.
fanicia Apr 21, 2023
b0cee1d
Remove constants.
fanicia Apr 23, 2023
d910434
update examples and crd.
fanicia Apr 23, 2023
ba96107
Include namespace in lookup key.
fanicia Apr 23, 2023
4be716d
Make keyRefs required.
fanicia Apr 23, 2023
69c3a41
Merge branch 'humio:master' into ha-improve-secrets
fanicia Oct 5, 2023
04bd900
Implement non-breaking solution.
fanicia Jan 29, 2024
2663647
Improve secret helpers.
fanicia Jan 30, 2024
efbc8df
Minor improvement.
fanicia Jan 31, 2024
3372f01
Rebase to fix conflicts.
fanicia Jan 31, 2024
872f00e
Merge branch 'master' into HEAD
SaaldjorMike Jun 17, 2024
64817b1
Add secretRef to PagerDutyProperties
RayeEvtuchM1 Apr 19, 2023
50b9347
wip
SaaldjorMike Jun 25, 2024
7c36b9c
wip2
SaaldjorMike Jun 25, 2024
c2094dd
wip3
SaaldjorMike Jun 26, 2024
1fa4c3a
now it may work
SaaldjorMike Jun 26, 2024
2881825
Merge branch 'master' into mike/fanicia/ha-improve-secrets
SaaldjorMike Jun 26, 2024
36a294e
wip
SaaldjorMike Jun 27, 2024
6a9e88b
wip
SaaldjorMike Jun 27, 2024
9bd6937
wip
SaaldjorMike Jun 27, 2024
aa6c982
Update api/v1alpha1/humioaction_types.go
SaaldjorMike Jul 3, 2024
6df6132
make manifests
SaaldjorMike Jul 3, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif
eval \$$($(GOBIN)/setup-envtest use -p env ${TEST_K8S_VERSION}); \
export USE_CERTMANAGER=false; \
export TEST_USE_EXISTING_CLUSTER=false; \
$(GINKGO) -vv --procs 3 -output-dir=${PWD} --output-interceptor-mode=none -keep-separate-reports --junit-report=test-results-junit.xml --randomize-suites --randomize-all -timeout 10m ./... -covermode=count -coverprofile cover.out \
$(GINKGO) -vv --no-color --procs 3 -output-dir=${PWD} --output-interceptor-mode=none -keep-separate-reports --junit-report=test-results-junit.xml --randomize-suites --randomize-all -timeout 10m ./... -covermode=count -coverprofile cover.out \
"

##@ Build
Expand Down
89 changes: 68 additions & 21 deletions api/v1alpha1/humioaction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,30 @@ const (

// HumioActionWebhookProperties defines the desired state of HumioActionWebhookProperties
type HumioActionWebhookProperties struct {
BodyTemplate string `json:"bodyTemplate,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Method string `json:"method,omitempty"`
Url string `json:"url,omitempty"`
IgnoreSSL bool `json:"ignoreSSL,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
BodyTemplate string `json:"bodyTemplate,omitempty"`
// Headers specifies what HTTP headers to use.
// If both Headers and SecretHeaders are specified, they will be merged together.
Headers map[string]string `json:"headers,omitempty"`
// SecretHeaders specifies what HTTP headers to use and where to fetch the values from.
// If both Headers and SecretHeaders are specified, they will be merged together.
SecretHeaders []HeadersSource `json:"secretHeaders,omitempty"`
Method string `json:"method,omitempty"`
// Url specifies what URL to use
// If both Url and UrlSource are specified, Url will be used.
Url string `json:"url,omitempty"`
// UrlSource specifies where to fetch the URL from
// If both Url and UrlSource are specified, Url will be used.
UrlSource VarSource `json:"urlSource,omitempty"`
IgnoreSSL bool `json:"ignoreSSL,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

// HeadersSource defines a header and corresponding source for the value of it.
type HeadersSource struct {
// Name is the name of the header.
Name string `json:"name,omitempty"`
// ValueFrom defines where to fetch the value of the header from.
ValueFrom VarSource `json:"valueFrom,omitempty"`
}

// HumioActionEmailProperties defines the desired state of HumioActionEmailProperties
Expand All @@ -52,50 +70,79 @@ type HumioActionEmailProperties struct {

// HumioActionRepositoryProperties defines the desired state of HumioActionRepositoryProperties
type HumioActionRepositoryProperties struct {
IngestToken string `json:"ingestToken,omitempty"`
// IngestToken specifies what ingest token to use.
// If both IngestToken and IngestTokenSource are specified, IngestToken will be used.
IngestToken string `json:"ingestToken,omitempty"`
// IngestTokenSource specifies where to fetch the ingest token from.
// If both IngestToken and IngestTokenSource are specified, IngestToken will be used.
IngestTokenSource VarSource `json:"ingestTokenSource,omitempty"`
}

// HumioActionOpsGenieProperties defines the desired state of HumioActionOpsGenieProperties
type HumioActionOpsGenieProperties struct {
ApiUrl string `json:"apiUrl,omitempty"`
GenieKey string `json:"genieKey,omitempty"`
ApiUrl string `json:"apiUrl,omitempty"`
// GenieKey specifies what API key to use.
// If both GenieKey and GenieKeySource are specified, GenieKey will be used.
GenieKey string `json:"genieKey,omitempty"`
// GenieKeySource specifies where to fetch the API key from.
// If both GenieKey and GenieKeySource are specified, GenieKey will be used.
GenieKeySource VarSource `json:"genieKeySource,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

// HumioActionPagerDutyProperties defines the desired state of HumioActionPagerDutyProperties
type HumioActionPagerDutyProperties struct {
// RoutingKey specifies what API key to use.
// If both RoutingKey and RoutingKeySource are specified, RoutingKey will be used.
RoutingKey string `json:"routingKey,omitempty"`
Severity string `json:"severity,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
// RoutingKeySource specifies where to fetch the routing key from.
// If both RoutingKey and RoutingKeySource are specified, RoutingKey will be used.
RoutingKeySource VarSource `json:"routingKeySource,omitempty"`
Severity string `json:"severity,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

// HumioActionSlackProperties defines the desired state of HumioActionSlackProperties
type HumioActionSlackProperties struct {
Fields map[string]string `json:"fields,omitempty"`
Url string `json:"url,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
Fields map[string]string `json:"fields,omitempty"`
// Url specifies what URL to use.
// If both Url and UrlSource are specified, Url will be used.
Url string `json:"url,omitempty"`
// UrlSource specifies where to fetch the URL from.
// If both Url and UrlSource are specified, Url will be used.
UrlSource VarSource `json:"urlSource,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

// HumioActionSlackPostMessageProperties defines the desired state of HumioActionSlackPostMessageProperties
type HumioActionSlackPostMessageProperties struct {
ApiToken string `json:"apiToken,omitempty"`
// ApiToken specifies what API key to use.
// If both ApiToken and ApiTokenSource are specified, ApiToken will be used.
ApiToken string `json:"apiToken,omitempty"`
// ApiTokenSource specifies where to fetch the API key from.
// If both ApiToken and ApiTokenSource are specified, ApiToken will be used.
ApiTokenSource VarSource `json:"apiTokenSource,omitempty"`
Channels []string `json:"channels,omitempty"`
Fields map[string]string `json:"fields,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

type VarSource struct {
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

// HumioActionVictorOpsProperties defines the desired state of HumioActionVictorOpsProperties
type HumioActionVictorOpsProperties struct {
MessageType string `json:"messageType,omitempty"`
NotifyUrl string `json:"notifyUrl,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
// NotifyUrl specifies what URL to use.
// If both NotifyUrl and NotifyUrlSource are specified, NotifyUrl will be used.
NotifyUrl string `json:"notifyUrl,omitempty"`
// NotifyUrlSource specifies where to fetch the URL from.
// If both NotifyUrl and NotifyUrlSource are specified, NotifyUrl will be used.
NotifyUrlSource VarSource `json:"notifyUrlSource"`
UseProxy bool `json:"useProxy,omitempty"`
}

// VarSource is used to specify where a value should be pulled from
type VarSource struct {
// SecretKeyRef allows specifying which secret and what key in that secret holds the value we want to use
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

// HumioActionSpec defines the desired state of HumioAction
Expand Down
31 changes: 29 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading
Loading