Skip to content
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

feat: make ClusterIssuer optional to allow certmanager defaults #299

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/install/v1alpha1/armadaserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ArmadaServerSpec struct {
// An array of host names to build ingress rules for
HostNames []string `json:"hostNames,omitempty"`
// Who is issuing certificates for CA
ClusterIssuer string `json:"clusterIssuer"`
ClusterIssuer string `json:"clusterIssuer,omitempty"`
// Run Pulsar Init Jobs On Startup
PulsarInit bool `json:"pulsarInit,omitempty"`
// SecurityContext defines the security options the container should be run with
Expand Down
2 changes: 1 addition & 1 deletion api/install/v1alpha1/binoculars_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type BinocularsSpec struct {
// An array of host names to build ingress rules for
HostNames []string `json:"hostNames,omitempty"`
// Who is issuing certificates for CA
ClusterIssuer string `json:"clusterIssuer"`
ClusterIssuer string `json:"clusterIssuer,omitempty"`
// SecurityContext defines the security options the container should be run with
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
// PodSecurityContext defines the security options the pod should be run with
Expand Down
2 changes: 1 addition & 1 deletion api/install/v1alpha1/lookout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type LookoutSpec struct {
// An array of host names to build ingress rules for
HostNames []string `json:"hostNames,omitempty"`
// Who is issuing certificates for CA
ClusterIssuer string `json:"clusterIssuer"`
ClusterIssuer string `json:"clusterIssuer,omitempty"`
// Migrate toggles whether to run migrations when installed
Migrate *bool `json:"migrate,omitempty"`
// DbPruningEnabled when true a pruning CronJob is created
Expand Down
2 changes: 1 addition & 1 deletion api/install/v1alpha1/scheduler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type SchedulerSpec struct {
// An array of host names to build ingress rules for
HostNames []string `json:"hostNames,omitempty"`
// Who is issuing certificates for CA
ClusterIssuer string `json:"clusterIssuer"`
ClusterIssuer string `json:"clusterIssuer,omitempty"`
// Migrate toggles whether to run migrations when installed
Migrate *bool `json:"migrate,omitempty"`
// Pruning config for cron job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,6 @@ spec:
type: array
required:
- applicationConfig
- clusterIssuer
- image
type: object
status:
Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/install.armadaproject.io_binoculars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,6 @@ spec:
type: array
required:
- applicationConfig
- clusterIssuer
- image
- replicas
type: object
Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/install.armadaproject.io_lookouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,6 @@ spec:
type: array
required:
- applicationConfig
- clusterIssuer
- image
type: object
status:
Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/install.armadaproject.io_schedulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,6 @@ spec:
type: array
required:
- applicationConfig
- clusterIssuer
- image
type: object
status:
Expand Down
15 changes: 11 additions & 4 deletions internal/controller/install/armadaserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,15 @@ func createIngressGrpc(as *installv1alpha1.ArmadaServer) (*networkingv1.Ingress,
"kubernetes.io/ingress.class": as.Spec.Ingress.IngressClass,
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
"certmanager.k8s.io/cluster-issuer": as.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": as.Spec.ClusterIssuer,
},
},
}

if as.Spec.ClusterIssuer != "" {
grpcIngress.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = as.Spec.ClusterIssuer
grpcIngress.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = as.Spec.ClusterIssuer
}

if as.Spec.Ingress.Annotations != nil {
for key, value := range as.Spec.Ingress.Annotations {
grpcIngress.ObjectMeta.Annotations[key] = value
Expand Down Expand Up @@ -643,14 +647,17 @@ func createIngressHttp(as *installv1alpha1.ArmadaServer) (*networkingv1.Ingress,
Name: restIngressName, Namespace: as.Namespace, Labels: AllLabels(as.Name, as.Labels),
Annotations: map[string]string{
"kubernetes.io/ingress.class": as.Spec.Ingress.IngressClass,
"certmanager.k8s.io/cluster-issuer": as.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": as.Spec.ClusterIssuer,
"nginx.ingress.kubernetes.io/rewrite-target": "/$2",
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
},
},
}

if as.Spec.ClusterIssuer != "" {
restIngress.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = as.Spec.ClusterIssuer
restIngress.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = as.Spec.ClusterIssuer
}

if as.Spec.Ingress.Annotations != nil {
for key, value := range as.Spec.Ingress.Annotations {
restIngress.ObjectMeta.Annotations[key] = value
Expand Down
15 changes: 11 additions & 4 deletions internal/controller/install/binoculars_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,15 @@ func createBinocularsIngressGrpc(binoculars *installv1alpha1.Binoculars) (*netwo
"kubernetes.io/ingress.class": binoculars.Spec.Ingress.IngressClass,
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
"certmanager.k8s.io/cluster-issuer": binoculars.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": binoculars.Spec.ClusterIssuer,
},
},
}

if binoculars.Spec.ClusterIssuer != "" {
grpcIngress.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = binoculars.Spec.ClusterIssuer
grpcIngress.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = binoculars.Spec.ClusterIssuer
}

if binoculars.Spec.Ingress.Annotations != nil {
for key, value := range binoculars.Spec.Ingress.Annotations {
grpcIngress.ObjectMeta.Annotations[key] = value
Expand Down Expand Up @@ -445,14 +449,17 @@ func createBinocularsIngressHttp(binoculars *installv1alpha1.Binoculars) (*netwo
ObjectMeta: metav1.ObjectMeta{Name: restIngressName, Namespace: binoculars.Namespace, Labels: AllLabels(binoculars.Name, binoculars.Labels),
Annotations: map[string]string{
"kubernetes.io/ingress.class": binoculars.Spec.Ingress.IngressClass,
"certmanager.k8s.io/cluster-issuer": binoculars.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": binoculars.Spec.ClusterIssuer,
"nginx.ingress.kubernetes.io/rewrite-target": "/$2",
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
},
},
}

if binoculars.Spec.ClusterIssuer != "" {
restIngress.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = binoculars.Spec.ClusterIssuer
restIngress.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = binoculars.Spec.ClusterIssuer
}

if binoculars.Spec.Ingress.Annotations != nil {
for key, value := range binoculars.Spec.Ingress.Annotations {
restIngress.ObjectMeta.Annotations[key] = value
Expand Down
7 changes: 5 additions & 2 deletions internal/controller/install/lookout_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,16 @@ func createLookoutIngressHttp(lookout *installv1alpha1.Lookout) (*networking.Ing
Name: ingressName, Namespace: lookout.Namespace, Labels: AllLabels(lookout.Name, lookout.Labels),
Annotations: map[string]string{
"kubernetes.io/ingress.class": lookout.Spec.Ingress.IngressClass,
"certmanager.k8s.io/cluster-issuer": lookout.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": lookout.Spec.ClusterIssuer,
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
},
},
}

if lookout.Spec.ClusterIssuer != "" {
ingressHttp.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = lookout.Spec.ClusterIssuer
ingressHttp.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = lookout.Spec.ClusterIssuer
}

if lookout.Spec.Ingress.Annotations != nil {
for key, value := range lookout.Spec.Ingress.Annotations {
ingressHttp.ObjectMeta.Annotations[key] = value
Expand Down
7 changes: 5 additions & 2 deletions internal/controller/install/scheduler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,15 @@ func createSchedulerIngressGrpc(scheduler *installv1alpha1.Scheduler) (*networki
"kubernetes.io/ingress.class": scheduler.Spec.Ingress.IngressClass,
"nginx.ingress.kubernetes.io/ssl-redirect": "true",
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
"certmanager.k8s.io/cluster-issuer": scheduler.Spec.ClusterIssuer,
"cert-manager.io/cluster-issuer": scheduler.Spec.ClusterIssuer,
},
},
}

if scheduler.Spec.ClusterIssuer != "" {
ingressHttp.ObjectMeta.Annotations["certmanager.k8s.io/cluster-issuer"] = scheduler.Spec.ClusterIssuer
ingressHttp.ObjectMeta.Annotations["cert-manager.io/cluster-issuer"] = scheduler.Spec.ClusterIssuer
}

if scheduler.Spec.Ingress.Annotations != nil {
for key, value := range scheduler.Spec.Ingress.Annotations {
ingressHttp.ObjectMeta.Annotations[key] = value
Expand Down