Skip to content

Commit dc9554b

Browse files
authored
fixes issue with credentials (#33)
* fixes issue with credentials * ignored the kustomisation
1 parent 6531813 commit dc9554b

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
config/manager/kustomization.yaml
12
.vscode
23
open-feature-operator
34
of-agent

apis/core/v1alpha1/featureflagconfiguration_types.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,18 @@ type FeatureFlagConfigurationSpec struct {
3030
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3131
// Important: Run "make" to regenerate code after modifying this file
3232
// +optional
33+
// +nullable
3334
Provider *FeatureFlagProvider `json:"provider"`
3435
// FeatureFlagSpec is the json representation of the feature flag
3536
FeatureFlagSpec string `json:"featureFlagSpec,omitempty"`
3637
}
3738

3839
type FeatureFlagProvider struct {
3940
// +kubebuilder:validation:Enum=flagD
40-
Name string `json:"name"`
41-
Credentials corev1.ObjectReference `json:"credentials"`
41+
Name string `json:"name"`
42+
// +optional
43+
// +nullable
44+
Credentials *corev1.ObjectReference `json:"credentials"`
4245
}
4346

4447
// FeatureFlagConfigurationStatus defines the observed state of FeatureFlagConfiguration

apis/core/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/core.openfeature.dev_featureflagconfigurations.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
provider:
4545
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
4646
Important: Run "make" to regenerate code after modifying this file'
47+
nullable: true
4748
properties:
4849
credentials:
4950
description: 'ObjectReference contains enough information to let
@@ -71,6 +72,7 @@ spec:
7172
that is well-focused on your reference. For example, ServiceReferences
7273
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
7374
.'
75+
nullable: true
7476
properties:
7577
apiVersion:
7678
description: API version of the referent.
@@ -110,7 +112,6 @@ spec:
110112
- flagD
111113
type: string
112114
required:
113-
- credentials
114115
- name
115116
type: object
116117
type: object

config/manager/kustomization.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
resources:
2-
- manager.yaml
2+
- manager.yaml
33

44
generatorOptions:
55
disableNameSuffixHash: true
66

77
configMapGenerator:
8-
- files:
9-
- controller_manager_config.yaml
10-
name: manager-config
8+
- files:
9+
- controller_manager_config.yaml
10+
name: manager-config
1111
apiVersion: kustomize.config.k8s.io/v1beta1
1212
kind: Kustomization
1313
images:
14-
- name: controller
15-
newName: controller
16-
newTag: latest
14+
- name: controller
15+
newName: controller
16+
newTag: latest

webhooks/featureflagconfiguration_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (m *FeatureFlagConfigurationValidator) Handle(ctx context.Context, req admi
4848
}
4949
}
5050

51-
if config.Spec.Provider.Credentials.Name != "" {
51+
if config.Spec.Provider != nil && config.Spec.Provider.Credentials != nil {
5252
// Check the provider and whether it has an existing secret
5353
providerKeySecret := corev1.Secret{}
5454
if err := m.Client.Get(ctx, client.ObjectKey{Name: config.Spec.Provider.Credentials.Name,

0 commit comments

Comments
 (0)