Skip to content

Commit d94b9b9

Browse files
committed
Add conditions to the Function CRD status
In order to show when a secret etc is missing, or when the reconciliation is complete from Function to Deployment/Service conditions are added to the status of the Function. Stalled = unable to fully reconcile Ready = reconciled Healthy = Pod available for a request Also adds functions/status to the RBAC for the operator. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent 23e66ca commit d94b9b9

File tree

14 files changed

+437
-853
lines changed

14 files changed

+437
-853
lines changed

artifacts/crds/iam.openfaas.com_jwtissuers.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.11.3
6+
creationTimestamp: null
67
name: jwtissuers.iam.openfaas.com
78
spec:
89
group: iam.openfaas.com
@@ -32,19 +33,10 @@ spec:
3233
- spec
3334
properties:
3435
apiVersion:
35-
description: |-
36-
APIVersion defines the versioned schema of this representation of an object.
37-
Servers should convert recognized schemas to the latest internal value, and
38-
may reject unrecognized values.
39-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
36+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
4037
type: string
4138
kind:
42-
description: |-
43-
Kind is a string value representing the REST resource this object represents.
44-
Servers may infer this from the endpoint the client submits requests to.
45-
Cannot be updated.
46-
In CamelCase.
47-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
39+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4840
type: string
4941
metadata:
5042
type: object
@@ -56,19 +48,15 @@ spec:
5648
- iss
5749
properties:
5850
aud:
59-
description: |-
60-
Audience is the intended audience of the JWT, at times, like with Auth0 this is the
61-
client ID of the app, and not our validating server
51+
description: Audience is the intended audience of the JWT, at times, like with Auth0 this is the client ID of the app, and not our validating server
6252
type: array
6353
items:
6454
type: string
6555
iss:
6656
description: Issuer is the issuer of the JWT
6757
type: string
6858
issInternal:
69-
description: |-
70-
IssuerInternal provides an alternative URL to use to download the public key
71-
for this issuer. It's useful for the system issuer.
59+
description: IssuerInternal provides an alternative URL to use to download the public key for this issuer. It's useful for the system issuer.
7260
type: string
7361
tokenExpiry:
7462
type: string

artifacts/crds/iam.openfaas.com_policies.yaml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.11.3
6+
creationTimestamp: null
67
name: policies.iam.openfaas.com
78
spec:
89
group: iam.openfaas.com
@@ -26,19 +27,10 @@ spec:
2627
- spec
2728
properties:
2829
apiVersion:
29-
description: |-
30-
APIVersion defines the versioned schema of this representation of an object.
31-
Servers should convert recognized schemas to the latest internal value, and
32-
may reject unrecognized values.
33-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
30+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3431
type: string
3532
kind:
36-
description: |-
37-
Kind is a string value representing the REST resource this object represents.
38-
Servers may infer this from the endpoint the client submits requests to.
39-
Cannot be updated.
40-
In CamelCase.
41-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
33+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4234
type: string
4335
metadata:
4436
type: object
@@ -63,16 +55,7 @@ spec:
6355
items:
6456
type: string
6557
condition:
66-
description: |-
67-
Condition is a set of conditions that the policy applies to
68-
{
69-
"StringLike": {
70-
"jwt:https://my-identity-provider.com#sub-id": [
71-
"1234567890",
72-
"0987654321"
73-
],
74-
}
75-
}
58+
description: 'Condition is a set of conditions that the policy applies to { "StringLike": { "jwt:https://my-identity-provider.com#sub-id": [ "1234567890", "0987654321" ], } }'
7659
type: object
7760
additionalProperties:
7861
type: object
@@ -84,9 +67,7 @@ spec:
8467
description: Effect is the effect of the policy - only Allow is supported
8568
type: string
8669
resource:
87-
description: |-
88-
Resource is a set of resources that the policy applies to - only namespaces are supported at
89-
present
70+
description: Resource is a set of resources that the policy applies to - only namespaces are supported at present
9071
type: array
9172
items:
9273
type: string

artifacts/crds/iam.openfaas.com_roles.yaml

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.11.3
6+
creationTimestamp: null
67
name: roles.iam.openfaas.com
78
spec:
89
group: iam.openfaas.com
@@ -32,40 +33,19 @@ spec:
3233
- spec
3334
properties:
3435
apiVersion:
35-
description: |-
36-
APIVersion defines the versioned schema of this representation of an object.
37-
Servers should convert recognized schemas to the latest internal value, and
38-
may reject unrecognized values.
39-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
36+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
4037
type: string
4138
kind:
42-
description: |-
43-
Kind is a string value representing the REST resource this object represents.
44-
Servers may infer this from the endpoint the client submits requests to.
45-
Cannot be updated.
46-
In CamelCase.
47-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
39+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4840
type: string
4941
metadata:
5042
type: object
5143
spec:
52-
description: |-
53-
RoleSpec maps a number of principals or attributes within a JWT to
54-
a set of policies.
44+
description: RoleSpec maps a number of principals or attributes within a JWT to a set of policies.
5545
type: object
5646
properties:
5747
condition:
58-
description: |-
59-
Condition is a set of conditions that can be used instead of a principal
60-
to match against claims within a JWT
61-
{
62-
"StringLike": {
63-
"jwt:https://my-identity-provider.com#sub-id": [
64-
"1234567890",
65-
"0987654321"
66-
],
67-
}
68-
}
48+
description: 'Condition is a set of conditions that can be used instead of a principal to match against claims within a JWT { "StringLike": { "jwt:https://my-identity-provider.com#sub-id": [ "1234567890", "0987654321" ], } }'
6949
type: object
7050
additionalProperties:
7151
type: object
@@ -79,11 +59,7 @@ spec:
7959
items:
8060
type: string
8161
principal:
82-
description: |-
83-
Principal is the principal that the role applies to i.e.
84-
{
85-
"jwt:sub":["repo:alexellis/minty:ref:refs/heads/master"]
86-
}
62+
description: Principal is the principal that the role applies to i.e. { "jwt:sub":["repo:alexellis/minty:ref:refs/heads/master"] }
8763
type: object
8864
additionalProperties:
8965
type: array

artifacts/crds/openfaas.com_functions.yaml

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.14.0
5+
controller-gen.kubebuilder.io/version: v0.11.3
6+
creationTimestamp: null
67
name: functions.openfaas.com
78
spec:
89
group: openfaas.com
@@ -17,6 +18,18 @@ spec:
1718
- jsonPath: .spec.image
1819
name: Image
1920
type: string
21+
- jsonPath: .status.conditions[?(@.type == "Ready")].status
22+
name: Ready
23+
type: string
24+
- jsonPath: .status.conditions[?(@.type == "Healthy")].status
25+
name: Healthy
26+
type: string
27+
- jsonPath: .status.replicas
28+
name: Replicas
29+
type: string
30+
- jsonPath: .status.availableReplicas
31+
name: Available
32+
type: string
2033
name: v1
2134
schema:
2235
openAPIV3Schema:
@@ -26,19 +39,10 @@ spec:
2639
- spec
2740
properties:
2841
apiVersion:
29-
description: |-
30-
APIVersion defines the versioned schema of this representation of an object.
31-
Servers should convert recognized schemas to the latest internal value, and
32-
may reject unrecognized values.
33-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
42+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3443
type: string
3544
kind:
36-
description: |-
37-
Kind is a string value representing the REST resource this object represents.
38-
Servers may infer this from the endpoint the client submits requests to.
39-
Cannot be updated.
40-
In CamelCase.
41-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
45+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
4246
type: string
4347
metadata:
4448
type: object
@@ -93,6 +97,60 @@ spec:
9397
type: array
9498
items:
9599
type: string
100+
status:
101+
type: object
102+
properties:
103+
availableReplicas:
104+
type: integer
105+
format: int32
106+
conditions:
107+
description: Conditions contains observations of the resource's state.
108+
type: array
109+
items:
110+
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
111+
type: object
112+
required:
113+
- lastTransitionTime
114+
- message
115+
- reason
116+
- status
117+
- type
118+
properties:
119+
lastTransitionTime:
120+
description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
121+
type: string
122+
format: date-time
123+
message:
124+
description: message is a human readable message indicating details about the transition. This may be an empty string.
125+
type: string
126+
maxLength: 32768
127+
observedGeneration:
128+
description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
129+
type: integer
130+
format: int64
131+
minimum: 0
132+
reason:
133+
description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
134+
type: string
135+
maxLength: 1024
136+
minLength: 1
137+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
138+
status:
139+
description: status of the condition, one of True, False, Unknown.
140+
type: string
141+
enum:
142+
- "True"
143+
- "False"
144+
- Unknown
145+
type:
146+
description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
147+
type: string
148+
maxLength: 316
149+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
150+
replicas:
151+
type: integer
152+
format: int32
96153
served: true
97154
storage: true
98-
subresources: {}
155+
subresources:
156+
status: {}

0 commit comments

Comments
 (0)