Concierge controllers add labels to all created resources

This commit is contained in:
Ryan Richard
2020-10-15 10:14:23 -07:00
parent c05bdb58ac
commit 94f20e57b1
28 changed files with 220 additions and 54 deletions
+1
View File
@@ -9,6 +9,7 @@ type Config struct {
APIConfig APIConfigSpec `json:"api"`
NamesConfig NamesConfigSpec `json:"names"`
KubeCertAgentConfig KubeCertAgentSpec `json:"kubeCertAgent"`
Labels map[string]string `json:"labels"`
}
// DiscoveryInfoSpec contains configuration knobs specific to
+4
View File
@@ -50,6 +50,10 @@ func FromPath(path string) (*api.Config, error) {
return nil, fmt.Errorf("validate names: %w", err)
}
if config.Labels == nil {
config.Labels = make(map[string]string)
}
return &config, nil
}
+8
View File
@@ -36,6 +36,9 @@ func TestFromPath(t *testing.T) {
credentialIssuerConfig: pinniped-config
apiService: pinniped-api
kubeCertAgentPrefix: kube-cert-agent-prefix
labels:
myLabelKey1: myLabelValue1
myLabelKey2: myLabelValue2
KubeCertAgent:
namePrefix: kube-cert-agent-name-prefix-
image: kube-cert-agent-image
@@ -56,6 +59,10 @@ func TestFromPath(t *testing.T) {
CredentialIssuerConfig: "pinniped-config",
APIService: "pinniped-api",
},
Labels: map[string]string{
"myLabelKey1": "myLabelValue1",
"myLabelKey2": "myLabelValue2",
},
KubeCertAgentConfig: api.KubeCertAgentSpec{
NamePrefix: stringPtr("kube-cert-agent-name-prefix-"),
Image: stringPtr("kube-cert-agent-image"),
@@ -87,6 +94,7 @@ func TestFromPath(t *testing.T) {
CredentialIssuerConfig: "pinniped-config",
APIService: "pinniped-api",
},
Labels: map[string]string{},
KubeCertAgentConfig: api.KubeCertAgentSpec{
NamePrefix: stringPtr("pinniped-kube-cert-agent-"),
Image: stringPtr("debian:latest"),