Skip to content

Commit

Permalink
Update faas-provider and populate secrets list in fnc status
Browse files Browse the repository at this point in the history
**What**
- Update faas-provider to v0.16.1
- When listing or reading the function status, populate the configured
  secrets list. This will happen in both the HTTP handler and the
  operator handlers.

  The `FunctionStatus` instance is now constructed via the
  `k8s.AsFunctionStatus` in the handlers and this should now be
  consistently used anywhere that a `FunctionStaus` was being
  constructed before.

  For the operator, there is now a private utility method
  `toFunctionStatus` that can parse the `Function` CRD type into
  the `FunctionStatus`. This will parse all possible values that
  overlap between the two types and is now used anywhere that a
  `FunctionStatus` was being constructed from the `Function` type.

- Add test to confirm that the parse function can correctly read the
  results from the ConfigureSecrets method.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
  • Loading branch information
LucasRoesler authored and alexellis committed Feb 6, 2021
1 parent 7b95916 commit 8d6b0e3
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 39 deletions.
11 changes: 0 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand All @@ -301,7 +300,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
Expand All @@ -315,15 +313,13 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
Expand Down Expand Up @@ -389,7 +385,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down Expand Up @@ -420,7 +415,6 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
Expand Down Expand Up @@ -452,7 +446,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7 h1:HmbHVPwrPEKPGLAcHSrMe6+hqSUlvZU0rab6x5EXfGU=
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -468,7 +461,6 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand All @@ -489,12 +481,10 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11 h1:Yq9t9jnGoR+dBuitxdo9l6Q7xh/zOyNnYUtDKaQ3x0E=
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 h1:DnSr2mCsxyCE6ZgIkmcWUQY2R5cH/6wL7eIxEmQOMSE=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -549,7 +539,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
1 change: 1 addition & 0 deletions pkg/k8s/function_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func AsFunctionStatus(item appsv1.Deployment) *types.FunctionStatus {
Labels: &labels,
Annotations: &item.Spec.Template.Annotations,
Namespace: item.Namespace,
Secrets: ReadFunctionSecretsSpec(item),
}

for _, v := range functionContainer.Env {
Expand Down
34 changes: 34 additions & 0 deletions pkg/k8s/function_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package k8s

import (
"fmt"
"reflect"
"testing"

Expand All @@ -22,6 +23,7 @@ func Test_AsFunctionStatus(t *testing.T) {
annotations := map[string]string{"data": "datavalue"}
namespace := "func-namespace"
envProcess := "process string here"
secrets := []string{"0-imagepullsecret", "1-genericsecret", "2-genericsecret"}

deploy := appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -37,6 +39,9 @@ func Test_AsFunctionStatus(t *testing.T) {
Labels: labels,
},
Spec: corev1.PodSpec{
ImagePullSecrets: []corev1.LocalObjectReference{
{Name: "0-imagepullsecret"},
},
Containers: []corev1.Container{
{
Name: name,
Expand All @@ -47,6 +52,31 @@ func Test_AsFunctionStatus(t *testing.T) {
},
},
},
Volumes: []corev1.Volume{
{
Name: fmt.Sprintf(secretsProjectVolumeNameTmpl, name),
VolumeSource: corev1.VolumeSource{
Projected: &corev1.ProjectedVolumeSource{
Sources: []corev1.VolumeProjection{
{
Secret: &corev1.SecretProjection{
LocalObjectReference: corev1.LocalObjectReference{
Name: "2-genericsecret",
},
},
},
{
Secret: &corev1.SecretProjection{
LocalObjectReference: corev1.LocalObjectReference{
Name: "1-genericsecret",
},
},
},
},
},
},
},
},
},
},
},
Expand Down Expand Up @@ -88,4 +118,8 @@ func Test_AsFunctionStatus(t *testing.T) {
t.Errorf("incorrect EnvProcess: expected %s, got %s", envProcess, status.EnvProcess)
}

if !reflect.DeepEqual(status.Secrets, secrets) {
t.Errorf("incorrect Secrets: expected %v, got : %v", secrets, status.Secrets)
}

}
40 changes: 35 additions & 5 deletions pkg/k8s/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"log"
"sort"
"strings"

types "github.com/openfaas/faas-provider/types"
Expand All @@ -19,9 +20,10 @@ import (
)

const (
secretsMountPath = "/var/openfaas/secrets"
secretLabel = "app.kubernetes.io/managed-by"
secretLabelValue = "openfaas"
secretsMountPath = "/var/openfaas/secrets"
secretLabel = "app.kubernetes.io/managed-by"
secretLabelValue = "openfaas"
secretsProjectVolumeNameTmpl = "%s-projected-secrets"
)

// SecretsClient exposes the standardized CRUD behaviors for Kubernetes secrets. These methods
Expand All @@ -44,7 +46,7 @@ type SecretsClient interface {
GetSecrets(namespace string, secretNames []string) (map[string]*apiv1.Secret, error)
}

// SecretsInterfacer exposes the SecretInterface getter for the k8s client.
// SecretInterfacer exposes the SecretInterface getter for the k8s client.
// This is implemented by the CoreV1Interface() interface in the Kubernetes client.
// The SecretsClient only needs this one interface, but needs to be able to set the
// namespaces when the interface is instantiated, meaning, we need the Getter and not the
Expand Down Expand Up @@ -219,7 +221,7 @@ func (f *FunctionFactory) ConfigureSecrets(request types.FunctionDeployment, dep
}
}

volumeName := fmt.Sprintf("%s-projected-secrets", request.Service)
volumeName := fmt.Sprintf(secretsProjectVolumeNameTmpl, request.Service)
projectedSecrets := apiv1.Volume{
Name: volumeName,
VolumeSource: apiv1.VolumeSource{
Expand Down Expand Up @@ -259,3 +261,31 @@ func (f *FunctionFactory) ConfigureSecrets(request types.FunctionDeployment, dep

return nil
}

// ReadFunctionSecretsSpec parses the name of the required function secrets. This is the inverse of ConfigureSecrets.
func ReadFunctionSecretsSpec(item appsv1.Deployment) []string {
secrets := []string{}

for _, s := range item.Spec.Template.Spec.ImagePullSecrets {
secrets = append(secrets, s.Name)
}

volumeName := fmt.Sprintf(secretsProjectVolumeNameTmpl, item.Name)
var sourceSecrets []apiv1.VolumeProjection
for _, v := range item.Spec.Template.Spec.Volumes {
if v.Name == volumeName {
sourceSecrets = v.Projected.Sources
break
}
}

for _, s := range sourceSecrets {
if s.Secret == nil {
continue
}
secrets = append(secrets, s.Secret.Name)
}

sort.Strings(secrets)
return secrets
}
90 changes: 88 additions & 2 deletions pkg/k8s/secrets_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,99 @@ import (
types "github.com/openfaas/faas-provider/types"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func Test_ReadFunctionSecretsSpec(t *testing.T) {

f := mockFactory()
existingSecrets := map[string]*apiv1.Secret{
"pullsecret": {Type: apiv1.SecretTypeDockercfg},
"testsecret": {Type: apiv1.SecretTypeOpaque, Data: map[string][]byte{"filename": []byte("contents")}},
}
functionDep := appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{Name: "testfunc"},
Spec: appsv1.DeploymentSpec{
Template: apiv1.PodTemplateSpec{
Spec: apiv1.PodSpec{
Containers: []apiv1.Container{
{Name: "testfunc", Image: "alpine:latest"},
},
},
},
},
}

cases := []struct {
name string
req types.FunctionDeployment
deployment appsv1.Deployment
expected []string
}{
{
name: "empty secrets, returns empty slice",
req: types.FunctionDeployment{
Service: "testfunc",
Secrets: []string{},
},
deployment: functionDep,
expected: []string{},
},
{
name: "detects and extracts image pull secret",
req: types.FunctionDeployment{
Service: "testfunc",
Secrets: []string{"pullsecret"},
},
deployment: functionDep,
expected: []string{"pullsecret"},
},
{
name: "detects and extracts projected generic secret",
req: types.FunctionDeployment{
Service: "testfunc",
Secrets: []string{"testsecret"},
},
deployment: functionDep,
expected: []string{"testsecret"},
},
{
name: "detects and extracts both pull secrets and projected generic secret, result is sorted",
req: types.FunctionDeployment{
Service: "testfunc",
Secrets: []string{"testsecret", "pullsecret"},
},
deployment: functionDep,
expected: []string{"pullsecret", "testsecret"},
},
}

for _, tc := range cases {
err := f.ConfigureSecrets(tc.req, &tc.deployment, existingSecrets)
if err != nil {
t.Fatalf("unexpected error result: got %q", err)
}

parsedSecrets := ReadFunctionSecretsSpec(tc.deployment)
if len(tc.expected) != len(parsedSecrets) {
t.Fatalf("incorrect secret count, expected: %v, got: %v", tc.expected, parsedSecrets)
}

for idx, expected := range tc.expected {
value := parsedSecrets[idx]
if expected != value {
t.Fatalf("incorrect secret in idx %d, expected: %q, got: %q", idx, expected, value)
}
}
}

}

func Test_FunctionFactory_ConfigureSecrets(t *testing.T) {
f := mockFactory()
existingSecrets := map[string]*apiv1.Secret{
"pullsecret": &apiv1.Secret{Type: apiv1.SecretTypeDockercfg},
"testsecret": &apiv1.Secret{Type: apiv1.SecretTypeOpaque, Data: map[string][]byte{"filename": []byte("contents")}},
"pullsecret": {Type: apiv1.SecretTypeDockercfg},
"testsecret": {Type: apiv1.SecretTypeOpaque, Data: map[string][]byte{"filename": []byte("contents")}},
}

basicDeployment := appsv1.Deployment{
Expand Down
13 changes: 3 additions & 10 deletions pkg/server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,9 @@ func makeListHandler(defaultNamespace string,
if err != nil {
glog.Warningf("Function listing getReplicas error: %v", err)
}

function := types.FunctionStatus{
Name: item.Spec.Name,
Replicas: desiredReplicas,
AvailableReplicas: availableReplicas,
Image: item.Spec.Image,
Labels: item.Spec.Labels,
Annotations: item.Spec.Annotations,
Namespace: lookupNamespace,
}
function := toFunctionStatus(item)
function.AvailableReplicas = availableReplicas
function.Replicas = desiredReplicas

functions = append(functions, function)
}
Expand Down

0 comments on commit 8d6b0e3

Please sign in to comment.