|
|
|
|
@ -16,6 +16,7 @@ import ( |
|
|
|
|
appsv1 "k8s.io/api/apps/v1" |
|
|
|
|
corev1 "k8s.io/api/core/v1" |
|
|
|
|
networkingv1 "k8s.io/api/networking/v1" |
|
|
|
|
policyv1 "k8s.io/api/policy/v1" |
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
|
|
|
|
"k8s.io/apimachinery/pkg/util/intstr" |
|
|
|
|
"k8s.io/utils/pointer" |
|
|
|
|
@ -39,13 +40,14 @@ func BuildGateway(opts Options) ([]client.Object, error) { |
|
|
|
|
sa := NewServiceAccount(opts) |
|
|
|
|
saToken := NewServiceAccountTokenSecret(opts) |
|
|
|
|
svc := NewGatewayHTTPService(opts) |
|
|
|
|
pdb := NewGatewayPodDisruptionBudget(opts) |
|
|
|
|
|
|
|
|
|
ing, err := NewGatewayIngress(opts) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
objs := []client.Object{cm, tenantSecret, dpl, sa, saToken, svc, ing} |
|
|
|
|
objs := []client.Object{cm, tenantSecret, dpl, sa, saToken, svc, ing, pdb} |
|
|
|
|
|
|
|
|
|
minTLSVersion := opts.TLSProfile.MinTLSVersion |
|
|
|
|
ciphersList := opts.TLSProfile.Ciphers |
|
|
|
|
@ -352,6 +354,30 @@ func NewServiceAccountTokenSecret(opts Options) client.Object { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewGatewayPodDisruptionBudget returns a PodDisruptionBudget for the LokiStack
|
|
|
|
|
// Gateway pods.
|
|
|
|
|
func NewGatewayPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget { |
|
|
|
|
l := ComponentLabels(LabelGatewayComponent, opts.Name) |
|
|
|
|
mu := intstr.FromInt(1) |
|
|
|
|
return &policyv1.PodDisruptionBudget{ |
|
|
|
|
TypeMeta: metav1.TypeMeta{ |
|
|
|
|
Kind: "PodDisruptionBudget", |
|
|
|
|
APIVersion: policyv1.SchemeGroupVersion.String(), |
|
|
|
|
}, |
|
|
|
|
ObjectMeta: metav1.ObjectMeta{ |
|
|
|
|
Labels: l, |
|
|
|
|
Name: GatewayName(opts.Name), |
|
|
|
|
Namespace: opts.Namespace, |
|
|
|
|
}, |
|
|
|
|
Spec: policyv1.PodDisruptionBudgetSpec{ |
|
|
|
|
Selector: &metav1.LabelSelector{ |
|
|
|
|
MatchLabels: l, |
|
|
|
|
}, |
|
|
|
|
MinAvailable: &mu, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// gatewayConfigObjs creates a configMap for rbac.yaml and a secret for tenants.yaml
|
|
|
|
|
func gatewayConfigObjs(opt Options) (*corev1.ConfigMap, *corev1.Secret, string, error) { |
|
|
|
|
cfg := gatewayConfigOptions(opt) |
|
|
|
|
|