Skip to content

Commit 87dce81

Browse files
authored
Merge pull request #80 from replicatedhq/additional-ports
Add port mapping to application crd
2 parents 5a22747 + 4e16520 commit 87dce81

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

kotskinds/apis/kots/v1beta1/application_types.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

23+
type ApplicationPort struct {
24+
ServiceName string `json:"serviceName"`
25+
ServicePort int `json:"servicePort"`
26+
LocalPort int `json:"localPort,omitempty"`
27+
ApplicationURL string `json:"applicationUrl,omitempty"`
28+
}
29+
2330
// ApplicationSpec defines the desired state of ApplicationSpec
2431
type ApplicationSpec struct {
25-
Title string `json:"title"`
26-
Icon string `json:"icon,omitempty"`
32+
Title string `json:"title"`
33+
Icon string `json:"icon,omitempty"`
34+
ApplicationPorts []ApplicationPort `json:"ports,omitempty"`
2735
}
2836

2937
// ApplicationStatus defines the observed state of Application

kotskinds/apis/kots/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (in *Application) DeepCopyInto(out *Application) {
2929
*out = *in
3030
out.TypeMeta = in.TypeMeta
3131
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
32-
out.Spec = in.Spec
32+
in.Spec.DeepCopyInto(&out.Spec)
3333
out.Status = in.Status
3434
}
3535

@@ -83,9 +83,29 @@ func (in *ApplicationList) DeepCopyObject() runtime.Object {
8383
return nil
8484
}
8585

86+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
87+
func (in *ApplicationPort) DeepCopyInto(out *ApplicationPort) {
88+
*out = *in
89+
}
90+
91+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationPort.
92+
func (in *ApplicationPort) DeepCopy() *ApplicationPort {
93+
if in == nil {
94+
return nil
95+
}
96+
out := new(ApplicationPort)
97+
in.DeepCopyInto(out)
98+
return out
99+
}
100+
86101
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
87102
func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
88103
*out = *in
104+
if in.ApplicationPorts != nil {
105+
in, out := &in.ApplicationPorts, &out.ApplicationPorts
106+
*out = make([]ApplicationPort, len(*in))
107+
copy(*out, *in)
108+
}
89109
}
90110

91111
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationSpec.

pkg/base/base.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ func (f BaseFile) ShouldBeIncludedInBaseKustomization(excludeKotsKinds bool) boo
3939
if o.APIVersion == "troubleshoot.replicated.com/v1beta1" {
4040
return false
4141
}
42+
43+
// In addition to kotskinds, we exclude the application crd for now
44+
if o.APIVersion == "app.k8s.io/v1beta1" {
45+
return false
46+
}
4247
}
4348

4449
return true
@@ -65,6 +70,10 @@ func (f BaseFile) ShouldBeIncludedInBaseFilesystem(excludeKotsKinds bool) bool {
6570
if o.APIVersion == "troubleshoot.replicated.com/v1beta1" {
6671
return false
6772
}
73+
74+
if o.APIVersion == "app.k8s.io/v1beta1" {
75+
return false
76+
}
6877
}
6978

7079
return true

pkg/upstream/replicated.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import (
2828
const DefaultMetadata = `apiVersion: kots.io/v1beta1
2929
kind: Application
3030
metadata:
31-
name: "Application"
31+
name: "default-application"
3232
spec:
33-
title: "Application"
34-
icon: https://cdn1.iconfinder.com/data/icons/ninja-things-1/1772/ninja-simple-512.png`
33+
title: "the application"
34+
icon: https://cdn2.iconfinder.com/data/icons/mixd/512/16_kubernetes-512.png`
3535

3636
type ReplicatedUpstream struct {
3737
Channel *string

0 commit comments

Comments
 (0)