-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
operator: Add support for custom S3 CA (#6198)
- Loading branch information
Showing
23 changed files
with
811 additions
and
347 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
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
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,9 @@ | ||
package storage | ||
|
||
import corev1 "k8s.io/api/core/v1" | ||
|
||
// IsValidCAConfigMap checks if the given CA configMap has an | ||
// non-empty entry for key `service-ca.crt` | ||
func IsValidCAConfigMap(cm *corev1.ConfigMap) bool { | ||
return cm.Data["service-ca.crt"] != "" | ||
} |
49 changes: 49 additions & 0 deletions
49
operator/internal/handlers/internal/storage/ca_configmap_test.go
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,49 @@ | ||
package storage_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/grafana/loki/operator/internal/handlers/internal/storage" | ||
"github.com/stretchr/testify/require" | ||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
func TestIsValidConfigMap(t *testing.T) { | ||
type test struct { | ||
name string | ||
cm *corev1.ConfigMap | ||
valid bool | ||
} | ||
table := []test{ | ||
{ | ||
name: "valid CA configmap", | ||
cm: &corev1.ConfigMap{ | ||
Data: map[string]string{ | ||
"service-ca.crt": "has-some-data", | ||
}, | ||
}, | ||
valid: true, | ||
}, | ||
{ | ||
name: "missing `service-ca.crt` key", | ||
cm: &corev1.ConfigMap{}, | ||
}, | ||
{ | ||
name: "missing CA content", | ||
cm: &corev1.ConfigMap{ | ||
Data: map[string]string{ | ||
"service-ca.crt": "", | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tst := range table { | ||
tst := tst | ||
t.Run(tst.name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
ok := storage.IsValidCAConfigMap(tst.cm) | ||
require.Equal(t, tst.valid, ok) | ||
}) | ||
} | ||
} |
Oops, something went wrong.