-
Notifications
You must be signed in to change notification settings - Fork 488
fix: return full status object from the info endpoint #923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,19 @@ func AsFunctionStatus(item appsv1.Deployment) *types.FunctionStatus { | |
|
||
labels := item.Spec.Template.Labels | ||
function := types.FunctionStatus{ | ||
Name: item.Name, | ||
Replicas: replicas, | ||
Image: functionContainer.Image, | ||
AvailableReplicas: uint64(item.Status.AvailableReplicas), | ||
InvocationCount: 0, | ||
Labels: &labels, | ||
Annotations: &item.Spec.Template.Annotations, | ||
Namespace: item.Namespace, | ||
Secrets: ReadFunctionSecretsSpec(item), | ||
CreatedAt: item.CreationTimestamp.Time, | ||
Name: item.Name, | ||
Replicas: replicas, | ||
Image: functionContainer.Image, | ||
AvailableReplicas: uint64(item.Status.AvailableReplicas), | ||
InvocationCount: 0, | ||
Labels: &labels, | ||
Annotations: &item.Spec.Template.Annotations, | ||
Namespace: item.Namespace, | ||
Secrets: ReadFunctionSecretsSpec(item), | ||
CreatedAt: item.CreationTimestamp.Time, | ||
Constraints: nodeSelectorToConstraint(item), | ||
ReadOnlyRootFilesystem: hasReadOnlyRootFilesystem(item), | ||
EnvVars: map[string]string{}, | ||
} | ||
|
||
req := &types.FunctionResources{Memory: functionContainer.Resources.Requests.Memory().String(), CPU: functionContainer.Resources.Requests.Cpu().String()} | ||
|
@@ -48,8 +51,32 @@ func AsFunctionStatus(item appsv1.Deployment) *types.FunctionStatus { | |
for _, v := range functionContainer.Env { | ||
if EnvProcessName == v.Name { | ||
function.EnvProcess = v.Value | ||
continue | ||
} | ||
function.EnvVars[v.Name] = v.Value | ||
} | ||
|
||
return &function | ||
} | ||
|
||
func nodeSelectorToConstraint(deploy appsv1.Deployment) []string { | ||
nodeSelector := deploy.Spec.Template.Spec.NodeSelector | ||
constraints := []string{} | ||
for k, v := range nodeSelector { | ||
constraints = append(constraints, k+"="+v) | ||
} | ||
return constraints | ||
} | ||
|
||
func hasReadOnlyRootFilesystem(function appsv1.Deployment) bool { | ||
securityContext := function.Spec.Template.Spec.Containers[0].SecurityContext | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a chance that the Istio sidecar could take position 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could it be indexed upon some kind of property or name in a range loop? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could SecurityContext ever be nil? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it can be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. regarding the position of the container: Both the As a side note, it would be really nice if we could refactor the an unify the generation of the Deployment, the function Factory doesn't actually generate it, both the controller and the handler have different code for the construction of the Deployment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexellis i have updated the code and replaced all instances of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you |
||
if securityContext == nil { | ||
return false | ||
} | ||
|
||
if securityContext.ReadOnlyRootFilesystem == nil { | ||
return false | ||
} | ||
|
||
return *securityContext.ReadOnlyRootFilesystem | ||
} |
Uh oh!
There was an error while loading. Please reload this page.