-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sink interface, Slack sink (#84)
* feat: add Slack sink Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * docs: add sink section to README Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * docs: add images to README.md Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> --------- Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
- Loading branch information
1 parent
3b5168e
commit dac2c3a
Showing
28 changed files
with
529 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func TestHash(t *testing.T) { | ||
cs := []struct { | ||
name string | ||
validationResult ValidationResult | ||
expectedHash string | ||
}{ | ||
{ | ||
name: "Pass", | ||
validationResult: ValidationResult{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
UID: "1", | ||
}, | ||
Spec: ValidationResultSpec{ | ||
Plugin: "AWS", | ||
}, | ||
Status: ValidationResultStatus{ | ||
State: ValidationSucceeded, | ||
SinkState: SinkEmitSucceeded, | ||
Conditions: []ValidationCondition{ | ||
{ | ||
ValidationType: "foo", | ||
ValidationRule: "bar", | ||
Message: "baz", | ||
Details: []string{"detail"}, | ||
Failures: []string{"failure"}, | ||
Status: corev1.ConditionTrue, | ||
LastValidationTime: metav1.Now(), | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedHash: "mCyJwAeP5yOG82mDw8Yy1Q==", | ||
}, | ||
} | ||
for _, c := range cs { | ||
hash := c.validationResult.Hash() | ||
if !reflect.DeepEqual(hash, c.expectedHash) { | ||
t.Errorf("expected (%s), got (%s)", c.expectedHash, hash) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if and .Values.sink .Values.sink.createSecret }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ required ".Values.sink.secretName is required!" .Values.sink.secretName }} | ||
stringData: | ||
{{- if eq .Values.sink.type "slack" }} | ||
apiToken: {{ required ".Values.sink.apiToken is required!" .Values.sink.apiToken }} | ||
channelId: {{ required ".Values.sink.channelId is required!" .Values.sink.channelId }} | ||
{{- end }} | ||
{{- end }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: validation.spectrocloud.labs/v1alpha1 | ||
kind: ValidatorConfig | ||
metadata: | ||
name: validator-config | ||
spec: | ||
plugins: | ||
{{ toYaml .Values.plugins | indent 2 }} | ||
{{- if .Values.sink }} | ||
sink: | ||
type: {{ required ".Values.sink.type is required!" .Values.sink.type }} | ||
secretName: {{ required ".Values.sink.secretName is required!" .Values.sink.secretName }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.