Skip to content

Commit

Permalink
add ingress class name and annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Oct 24, 2022
1 parent 680ab61 commit 3fd102d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
15 changes: 15 additions & 0 deletions apis/dash/v1alpha1/dashapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ type Container struct {
}

type Ingress struct {
// +optional
// Annotations for ingress
Annotations map[string]string `json:"serviceAnnotations,omitempty"`
// IngressClassName is the name of an IngressClass cluster resource. Ingress
// controller implementations use this field to know whether they should be
// serving this Ingress resource, by a transitive connection
// (controller -> IngressClass -> Ingress resource). Although the
// `kubernetes.io/ingress.class` annotation (simple constant name) was never
// formally defined, it was widely supported by Ingress controllers to create
// a direct binding between Ingress controller and Ingress resources. Newly
// created Ingress resources should prefer using the field. However, even
// though the annotation is officially deprecated, for backwards compatibility
// reasons, ingress controllers should still honor that annotation if present.
// +optional
IngressClassName *string `json:"ingressClassName,omitempty"`
// Host is the fully qualified domain name of a network host, as defined by RFC 3986.
// Note the following deviations from the "host" part of the
// URI as defined in RFC 3986:
Expand Down
7 changes: 6 additions & 1 deletion apis/dash/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions config/crd/bases/dash.plural.sh_dashapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ spec:
request matches this rule if the http host header is to equal
to the suffix (removing the first label) of the wildcard rule."
type: string
ingressClassName:
description: IngressClassName is the name of an IngressClass cluster
resource. Ingress controller implementations use this field
to know whether they should be serving this Ingress resource,
by a transitive connection (controller -> IngressClass -> Ingress
resource). Although the `kubernetes.io/ingress.class` annotation
(simple constant name) was never formally defined, it was widely
supported by Ingress controllers to create a direct binding
between Ingress controller and Ingress resources. Newly created
Ingress resources should prefer using the field. However, even
though the annotation is officially deprecated, for backwards
compatibility reasons, ingress controllers should still honor
that annotation if present.
type: string
path:
description: Path is matched against the path of an incoming request.
Currently it can contain characters disallowed from the conventional
Expand Down
8 changes: 5 additions & 3 deletions pkg/controller/dash_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ func genIngress(dashApp *dashv1alpha1.DashApplication) *networkingv1.Ingress {
}
ingress := &networkingv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: dashApp.Name,
Namespace: dashApp.Namespace,
Labels: baseAppLabels(dashApp.Name, nil),
Name: dashApp.Name,
Namespace: dashApp.Namespace,
Labels: baseAppLabels(dashApp.Name, nil),
Annotations: dashApp.Spec.Ingress.Annotations,
},
Spec: networkingv1.IngressSpec{
IngressClassName: dashApp.Spec.Ingress.IngressClassName,
Rules: []networkingv1.IngressRule{
{
Host: dashApp.Spec.Ingress.Host,
Expand Down
2 changes: 1 addition & 1 deletion resources/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ spec:
serviceAccountName: dash-controller-sa
containers:
- name: dash-controller
image: ghcr.io/pluralsh/dash-controller:0.0.6
image: ghcr.io/pluralsh/dash-controller:0.0.7
imagePullPolicy: Always

0 comments on commit 3fd102d

Please sign in to comment.