-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move helm related code to another file * move network policy related code to another file * add comments for reconciliation of ucluster * feat: manual sleep * set controller ref on network policy * improvement: set host for ingress if available in the CR * ci: update roles in helm based on roles generated by operator-sdk * examples: for manual sleep * use spaces instead of indentation for the yaml fnr * improvement: add cluster role for pods
- Loading branch information
1 parent
c6a9693
commit 119cdc3
Showing
12 changed files
with
827 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,8 @@ spec: | |
required: | ||
- enabled | ||
type: object | ||
sleep: | ||
type: boolean | ||
ttl: | ||
type: string | ||
type: object | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,8 @@ spec: | |
required: | ||
- enabled | ||
type: object | ||
sleep: | ||
type: boolean | ||
ttl: | ||
type: string | ||
type: object | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,65 @@ | ||
package controllers | ||
|
||
import ( | ||
"fmt" | ||
uclusteruffizzicomv1alpha1 "github.com/UffizziCloud/uffizzi-cluster-operator/api/v1alpha1" | ||
corev1 "k8s.io/api/core/v1" | ||
networkingv1 "k8s.io/api/networking/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
) | ||
|
||
func (r *UffizziClusterReconciler) buildEgressPolicy(uCluster *uclusteruffizzicomv1alpha1.UffizziCluster) *networkingv1.NetworkPolicy { | ||
port443 := intstr.FromInt(443) | ||
port80 := intstr.FromInt(80) | ||
TCP := corev1.ProtocolTCP | ||
uClusterHelmReleaseName := BuildVClusterHelmReleaseName(uCluster) | ||
egressPolicy := &networkingv1.NetworkPolicy{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: fmt.Sprintf("%s-workloads-ingress", uClusterHelmReleaseName), | ||
Namespace: uCluster.Namespace, | ||
}, | ||
Spec: networkingv1.NetworkPolicySpec{ | ||
Egress: []networkingv1.NetworkPolicyEgressRule{ | ||
{ | ||
Ports: []networkingv1.NetworkPolicyPort{ | ||
{ | ||
Port: &port443, | ||
Protocol: &TCP, | ||
}, | ||
{ | ||
Port: &port80, | ||
Protocol: &TCP, | ||
}, | ||
}, | ||
To: []networkingv1.NetworkPolicyPeer{ | ||
{ | ||
PodSelector: &metav1.LabelSelector{ | ||
MatchLabels: map[string]string{ | ||
"app.kubernetes.io/component": "controller", | ||
"app.kubernetes.io/name": "ingress-nginx", | ||
}, | ||
}, | ||
}, | ||
{ | ||
NamespaceSelector: &metav1.LabelSelector{ | ||
MatchLabels: map[string]string{ | ||
"kubernetes.io/metadata.name": "uffizzi", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
PodSelector: metav1.LabelSelector{ | ||
MatchLabels: map[string]string{ | ||
"vcluster.loft.sh/managed-by": uClusterHelmReleaseName, | ||
}, | ||
}, | ||
PolicyTypes: []networkingv1.PolicyType{ | ||
networkingv1.PolicyTypeEgress, | ||
}, | ||
}, | ||
} | ||
return egressPolicy | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: UffizziCluster | ||
apiVersion: uffizzi.com/v1alpha1 | ||
metadata: | ||
name: basic-sleep-1 | ||
spec: | ||
sleep: false |
This file was deleted.
Oops, something went wrong.