Skip to content

Commit

Permalink
Merge pull request kubeflow#494 from kkasravi/add_apps13
Browse files Browse the repository at this point in the history
add application overlay for spartakus
  • Loading branch information
richardsliu authored Oct 14, 2019
2 parents 9744780 + f23d579 commit ab162cc
Show file tree
Hide file tree
Showing 13 changed files with 393 additions and 135 deletions.
33 changes: 33 additions & 0 deletions common/spartakus/overlays/application/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: spartakus
spec:
selector:
matchLabels:
app.kubernetes.io/name: spartakus
app.kubernetes.io/instance: spartakus-v0.7.0
app.kubernetes.io/managed-by: kfctl
app.kubernetes.io/component: spartakus
app.kubernetes.io/part-of: kubeflow
app.kubernetes.io/version: v0.7.0
componentKinds:
- group: core
kind: ConfigMap
- group: apps
kind: Deployment
- group: core
kind: ServiceAccount
descriptor:
type: spartakus
version: v1beta1
description: ""
maintainers: []
owners: []
keywords:
- spartakus
- kubeflow
links:
- description: About
url: ""
addOwnerRef: true
13 changes: 13 additions & 0 deletions common/spartakus/overlays/application/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
resources:
- application.yaml
commonLabels:
app.kubernetes.io/name: spartakus
app.kubernetes.io/instance: spartakus-v0.7.0
app.kubernetes.io/managed-by: kfctl
app.kubernetes.io/component: spartakus
app.kubernetes.io/part-of: kubeflow
app.kubernetes.io/version: v0.7.0
2 changes: 2 additions & 0 deletions kfdef/kfctl_anthos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ spec:
path: kfserving/kfserving-install
name: kfserving-install
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ spec:
path: pytorch-job/pytorch-operator
name: pytorch-operator
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_aws_cognito.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ spec:
path: pytorch-job/pytorch-operator
name: pytorch-operator
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_existing_arrikto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ spec:
path: pytorch-job/pytorch-operator
name: pytorch-operator
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_gcp_basic_auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ spec:
path: kfserving/kfserving-install
name: kfserving-install
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_gcp_iap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ spec:
path: kfserving/kfserving-install
name: kfserving-install
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
2 changes: 2 additions & 0 deletions kfdef/kfctl_k8s_istio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ spec:
path: kfserving/kfserving-install
name: kfserving-install
- kustomizeConfig:
overlays:
- application
parameters:
- initRequired: true
name: usageId
Expand Down
92 changes: 46 additions & 46 deletions tests/aws-alb-ingress-controller-overlays-application_test.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package tests_test

import (
"sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct"
"sigs.k8s.io/kustomize/v3/k8sdeps/transformer"
"sigs.k8s.io/kustomize/v3/pkg/fs"
"sigs.k8s.io/kustomize/v3/pkg/loader"
"sigs.k8s.io/kustomize/v3/pkg/plugins"
"sigs.k8s.io/kustomize/v3/pkg/resmap"
"sigs.k8s.io/kustomize/v3/pkg/resource"
"sigs.k8s.io/kustomize/v3/pkg/target"
"sigs.k8s.io/kustomize/v3/pkg/validators"
"testing"
"sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct"
"sigs.k8s.io/kustomize/v3/k8sdeps/transformer"
"sigs.k8s.io/kustomize/v3/pkg/fs"
"sigs.k8s.io/kustomize/v3/pkg/loader"
"sigs.k8s.io/kustomize/v3/pkg/plugins"
"sigs.k8s.io/kustomize/v3/pkg/resmap"
"sigs.k8s.io/kustomize/v3/pkg/resource"
"sigs.k8s.io/kustomize/v3/pkg/target"
"sigs.k8s.io/kustomize/v3/pkg/validators"
"testing"
)

func writeAwsAlbIngressControllerOverlaysApplication(th *KustTestHarness) {
th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/application/application.yaml", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/application/application.yaml", `
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
Expand Down Expand Up @@ -50,7 +50,7 @@ spec:
addOwnerRef: true
`)
th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/application", `
th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/application", `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
Expand All @@ -66,7 +66,7 @@ commonLabels:
app.kubernetes.io/version: v0.6.2
`)
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", `
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down Expand Up @@ -104,7 +104,7 @@ rules:
- list
- watch
`)
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", `
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand All @@ -117,7 +117,7 @@ subjects:
- kind: ServiceAccount
name: alb-ingress-controller
`)
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", `
# Application Load Balancer (ALB) Ingress Controller Deployment Manifest.
# This manifest details sensible defaults for deploying an ALB Ingress Controller.
# GitHub: https://github.com/kubernetes-sigs/aws-alb-ingress-controller
Expand Down Expand Up @@ -170,16 +170,16 @@ spec:
imagePullPolicy: Always
serviceAccountName: alb-ingress-controller
`)
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", `
apiVersion: v1
kind: ServiceAccount
metadata:
name: alb-ingress-controller
`)
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", `
th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", `
clusterName=
`)
th.writeK("/manifests/aws/aws-alb-ingress-controller/base", `
th.writeK("/manifests/aws/aws-alb-ingress-controller/base", `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kubeflow
Expand Down Expand Up @@ -211,32 +211,32 @@ vars:
}

func TestAwsAlbIngressControllerOverlaysApplication(t *testing.T) {
th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/application")
writeAwsAlbIngressControllerOverlaysApplication(th)
m, err := th.makeKustTarget().MakeCustomizedResMap()
if err != nil {
t.Fatalf("Err: %v", err)
}
expected, err := m.AsYaml()
if err != nil {
t.Fatalf("Err: %v", err)
}
targetPath := "../aws/aws-alb-ingress-controller/overlays/application"
fsys := fs.MakeRealFS()
lrc := loader.RestrictionRootOnly
_loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys)
if loaderErr != nil {
t.Fatalf("could not load kustomize loader: %v", loaderErr)
}
rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl())
pc := plugins.DefaultPluginConfig()
kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf))
if err != nil {
th.t.Fatalf("Unexpected construction error %v", err)
}
actual, err := kt.MakeCustomizedResMap()
if err != nil {
t.Fatalf("Err: %v", err)
}
th.assertActualEqualsExpected(actual, string(expected))
th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/application")
writeAwsAlbIngressControllerOverlaysApplication(th)
m, err := th.makeKustTarget().MakeCustomizedResMap()
if err != nil {
t.Fatalf("Err: %v", err)
}
expected, err := m.AsYaml()
if err != nil {
t.Fatalf("Err: %v", err)
}
targetPath := "../aws/aws-alb-ingress-controller/overlays/application"
fsys := fs.MakeRealFS()
lrc := loader.RestrictionRootOnly
_loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys)
if loaderErr != nil {
t.Fatalf("could not load kustomize loader: %v", loaderErr)
}
rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl())
pc := plugins.DefaultPluginConfig()
kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf))
if err != nil {
th.t.Fatalf("Unexpected construction error %v", err)
}
actual, err := kt.MakeCustomizedResMap()
if err != nil {
t.Fatalf("Err: %v", err)
}
th.assertActualEqualsExpected(actual, string(expected))
}
Loading

0 comments on commit ab162cc

Please sign in to comment.