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

Multi cluster rebase #1

Open
wants to merge 49 commits into
base: multi-cluster-code-merge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0e5f5d7
Handle multi cluster configs (#2836)
arzzon Apr 6, 2023
819b44a
Multi cluster informers (#2840)
charanm08 Apr 17, 2023
2f857be
Multi Cluster service support with improved node & service update pro…
vklohiya Apr 24, 2023
4f046e4
Fix for processing route's multi-cluster annotation (#2858)
vklohiya Apr 25, 2023
58f65c0
Fix for node update processing (#2859)
vklohiya Apr 25, 2023
74b4bf3
Fix multicluster config cleanup (#2854)
arzzon Apr 25, 2023
52f90d7
Fix for service port update processing (#2865)
vklohiya Apr 28, 2023
ea10e2f
Fix for processing route without service (#2869)
vklohiya May 2, 2023
4f1537a
Fix for handling fail-over scenarios (#2874)
vklohiya May 4, 2023
c370d0b
Add healh probe for primary cluster (#2880)
charanm08 May 10, 2023
f9b9230
Fix for monitoring services of HA cluster pair (#2879)
arzzon May 11, 2023
fa2ac8f
Support for active-active and active-passive HA mode (#2889)
arzzon May 19, 2023
273a8d3
Fix pool members issue when services are shared (#2895)
charanm08 May 24, 2023
5c8fbb6
Handle pod processing error for external clusters (#2900)
arzzon May 26, 2023
c206d64
Documentation for multi cluster support (#2911)
vklohiya Jun 6, 2023
b1a3ed2
Add Type Column for MultiCluster Parameters (#2919)
nandakishorepeddi Jun 8, 2023
515e62b
Limit printing Pod and Configmap Definition (#2920)
nandakishorepeddi Jun 8, 2023
37f931a
Fix Multicluster config processing (#2921)
arzzon Jun 9, 2023
5ec6766
Update README.md
mdditt2000 Jun 9, 2023
8fbc4aa
Update README.md
F5Debbie Jun 9, 2023
fdac5cb
Improve Debug Messages for MultiCluster (#2924)
nandakishorepeddi Jun 12, 2023
203fad4
Update PoolMembers properly for scaledown Scenerios (#2925)
nandakishorepeddi Jun 12, 2023
cb7f5b4
Added support for cluster name validation in route annotation (#2927)
vklohiya Jun 13, 2023
789f64a
Fix issue with multiple get calls to bigip in CIS secondary mode (#2928)
charanm08 Jun 13, 2023
150a1ac
Fix HA config update processing (#2926)
arzzon Jun 14, 2023
aa72a2b
Handle duplicate pool members (#2931)
arzzon Jun 14, 2023
e816586
Fix healthProbe mutex and priority partition issues (#2932)
arzzon Jun 14, 2023
090e0ad
Fix for acitve-active mode without multiClusterConfigs (#2935)
arzzon Jun 16, 2023
b472a0e
fix eps issue with external clusters (#2943)
lavanya-f5 Jun 23, 2023
5d6a526
static route support for multicluster (#2947)
lavanya-f5 Jun 26, 2023
2ea6168
Code Refactoring for extended configmap support in crd mode (#2946)
vklohiya Jun 29, 2023
a78abca
Extend VS and TS CRD schema to support multiClusterServices (#2948)
arzzon Jun 29, 2023
cc0d26e
Handle scenario where HA cluster used as external cluster (#2944)
arzzon Jun 30, 2023
d375fd5
Handle VS and TS processing on configmap update (#2955)
arzzon Jul 3, 2023
fd4a767
Code Refactoring for endpoint processing (#2952)
vklohiya Jul 3, 2023
d65c37c
crd support for mc (#2970)
lavanya-f5 Jul 12, 2023
9106a27
fix crash issue with missing configmap or invalid endpoint type (#2975)
charanm08 Jul 13, 2023
7cffa22
Add support for cluster ratio in multiCuster mode (#2973)
arzzon Jul 14, 2023
e55adcf
static routes shared support (#2977)
lavanya-f5 Jul 17, 2023
39a4697
Modify Service Pattern (#2976)
nandakishorepeddi Jul 17, 2023
eb0003e
fix to process clustername and service add change under extendedservi…
charanm08 Jul 18, 2023
3ed8d6a
fix ts crash (#2980)
lavanya-f5 Jul 18, 2023
74e69a5
Add CRUD support for TS ExtendedServiceReferences (#2981)
nandakishorepeddi Jul 18, 2023
e968794
Add mandatory parameter for TS resource (#2982)
nandakishorepeddi Jul 18, 2023
f7f944a
fix crash issue with invalid cm config (#2983)
charanm08 Jul 18, 2023
e895ca2
Fix multiCluster service update handling and add external service val…
arzzon Jul 19, 2023
2d6f41e
fix static routes creation on cis restart with mc (#2991)
lavanya-f5 Jul 19, 2023
d302e61
rebased master code with multiCluster
charanm08 Aug 1, 2023
d882489
Rebase master code with multiCluster
charanm08 Aug 3, 2023
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
162 changes: 99 additions & 63 deletions cmd/k8s-bigip-ctlr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ import (
)

type globalSection struct {
LogLevel string `json:"log-level,omitempty"`
VerifyInterval int `json:"verify-interval,omitempty"`
VXLANPartition string `json:"vxlan-partition,omitempty"`
DisableLTM bool `json:"disable-ltm,omitempty"`
DisableARP bool `json:"disable-arp,omitempty"`
LogLevel string `json:"log-level,omitempty"`
VerifyInterval int `json:"verify-interval,omitempty"`
VXLANPartition string `json:"vxlan-partition,omitempty"`
DisableLTM bool `json:"disable-ltm,omitempty"`
DisableARP bool `json:"disable-arp,omitempty"`
StaticRoutingMode bool `json:"static-route-mode,omitempty"`
}

type bigIPSection struct {
Expand Down Expand Up @@ -107,13 +108,14 @@ var (
buildInfo string

// Flag sets and supported flags
flags *pflag.FlagSet
globalFlags *pflag.FlagSet
bigIPFlags *pflag.FlagSet
kubeFlags *pflag.FlagSet
vxlanFlags *pflag.FlagSet
osRouteFlags *pflag.FlagSet
gtmBigIPFlags *pflag.FlagSet
flags *pflag.FlagSet
globalFlags *pflag.FlagSet
bigIPFlags *pflag.FlagSet
kubeFlags *pflag.FlagSet
vxlanFlags *pflag.FlagSet
osRouteFlags *pflag.FlagSet
gtmBigIPFlags *pflag.FlagSet
multiClusterFlags *pflag.FlagSet

// Custom Resource
customResourceMode *bool
Expand Down Expand Up @@ -186,16 +188,18 @@ var (
clientSSL *string
serverSSL *string

routeSpecConfigmap *string
extendedSpecConfigmap *string
routeSpecConfigmap *string

gtmBigIPURL *string
gtmBigIPUsername *string
gtmBigIPPassword *string
gtmCredsDir *string

httpClientMetrics *bool
staticRoutingMode *bool
orchestrationCNI *string
httpClientMetrics *bool
staticRoutingMode *bool
orchestrationCNI *string
sharedStaticRoutes *bool
// package variables
isNodePort bool
watchAllNamespaces bool
Expand All @@ -205,6 +209,7 @@ var (
eventChan chan interface{}
configWriter writer.Writer
userAgentInfo string
cisType *string
)

func _init() {
Expand All @@ -215,6 +220,7 @@ func _init() {
vxlanFlags = pflag.NewFlagSet("VXLAN", pflag.PanicOnError)
osRouteFlags = pflag.NewFlagSet("OpenShift Routes", pflag.PanicOnError)
gtmBigIPFlags = pflag.NewFlagSet("GTM", pflag.PanicOnError)
multiClusterFlags = pflag.NewFlagSet("MultiCluster", pflag.PanicOnError)

// Flag wrapping
var err error
Expand Down Expand Up @@ -250,6 +256,7 @@ func _init() {
"Optional, flag to disable sending telemetry data to TEEM")
staticRoutingMode = globalFlags.Bool("static-routing-mode", false, "Optional, flag to enable configuration of static routes on bigip for pod network subnets")
orchestrationCNI = globalFlags.String("orchestration-cni", "", "Optional, flag to specify orchestration CNI configured")
sharedStaticRoutes = globalFlags.Bool("shared-static-routes", false, "Optional, flag to enable configuration of static routes on bigip in common partition")
// Custom Resource
enableIPV6 = globalFlags.Bool("enable-ipv6", false,
"Optional, flag to enbale ipv6 network support.")
Expand All @@ -259,6 +266,11 @@ func _init() {
"Optional, to put the controller to process desired resources.")
defaultRouteDomain = globalFlags.Int("default-route-domain", 0,
"Optional, CIS uses this value as default Route Domain in BIG-IP ")
routeSpecConfigmap = globalFlags.String("route-spec-configmap", "",
"Required, specify a configmap that holds additional spec for routes"+
" if controller-mode is 'openshift'")
extendedSpecConfigmap = globalFlags.String("extended-spec-configmap", "",
"Required, specify a configmap that holds additional spec for controller. It's a required parameter if controller-mode is 'openshift'")

globalFlags.Usage = func() {
fmt.Fprintf(os.Stderr, " Global:\n%s\n", globalFlags.FlagUsagesWrapped(width))
Expand Down Expand Up @@ -408,11 +420,6 @@ func _init() {
serverSSL = osRouteFlags.String("default-server-ssl", "",
"Optional, specify a user-created server ssl profile to be used as"+
" default for SNI for Route virtual servers")

routeSpecConfigmap = osRouteFlags.String("route-spec-configmap", "",
"Required, specify a configmap that holds additional spec for routes"+
" if controller-mode is 'openshift'")

osRouteFlags.Usage = func() {
fmt.Fprintf(os.Stderr, " Openshift Routes:\n%s\n", osRouteFlags.FlagUsagesWrapped(width))
}
Expand All @@ -431,12 +438,17 @@ func _init() {
fmt.Fprintf(os.Stderr, " GTM:\n%s\n", gtmBigIPFlags.FlagUsagesWrapped(width))
}

// MultiCluster Flags
cisType = multiClusterFlags.String("cis-type", "",
"Optional, determines in multi cluster env cis running as primary/secondary")

flags.AddFlagSet(globalFlags)
flags.AddFlagSet(bigIPFlags)
flags.AddFlagSet(kubeFlags)
flags.AddFlagSet(vxlanFlags)
flags.AddFlagSet(osRouteFlags)
flags.AddFlagSet(gtmBigIPFlags)
flags.AddFlagSet(multiClusterFlags)

flags.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s\n", os.Args[0])
Expand All @@ -446,6 +458,7 @@ func _init() {
vxlanFlags.Usage()
osRouteFlags.Usage()
gtmBigIPFlags.Usage()
multiClusterFlags.Usage()
}
}

Expand Down Expand Up @@ -541,7 +554,18 @@ func verifyArgs() error {
} else {
return fmt.Errorf("'%v' is not a valid Pool Member Type", *poolMemberType)
}

if len(*extendedSpecConfigmap) > 0 {
if len(strings.Split(*extendedSpecConfigmap, "/")) != 2 {
return fmt.Errorf("invalid value provided for --extended-spec-configmap" +
"Usage: --extended-spec-configmap=<namespace>/<configmap-name>")
}
}
if len(*routeSpecConfigmap) > 0 {
if len(strings.Split(*routeSpecConfigmap, "/")) != 2 {
return fmt.Errorf("invalid value provided for --route-spec-configmap" +
"Usage: --route-spec-configmap=<namespace>/<configmap-name>")
}
}
if *staticRoutingMode == true {
if isNodePort || *poolMemberType == "nodeportlocal" {
return fmt.Errorf("Cannot run NodePort mode or nodeportlocal mode while supplying static-routing-mode true " +
Expand Down Expand Up @@ -600,16 +624,15 @@ func verifyArgs() error {
"Usage: --override-as3-declaration=<namespace>/<configmap-name>")
}
}

switch *controllerMode {
case "",
string(controller.CustomResourceMode),
string(controller.KubernetesMode):
break
case string(controller.OpenShiftMode):
if len(strings.Split(*routeSpecConfigmap, "/")) != 2 {
return fmt.Errorf("invalid value provided for --route-spec-configmap" +
"Usage: --route-spec-configmap=<namespace>/<configmap-name>")
if len(*extendedSpecConfigmap) == 0 && len(*routeSpecConfigmap) == 0 {
return fmt.Errorf("--route-spec-configmap or --extended-spec-configmap parameter is required in openshift mode\n" +
"Usage: --route-spec-configmap=<namespace>/<configmap-name> or --extended-spec-configmap=<namespace>/<configmap-name>")
}
if len(*routeLabel) > 0 {
*routeLabel = fmt.Sprintf("f5type in (%s)", *routeLabel)
Expand Down Expand Up @@ -819,18 +842,19 @@ func initController(
}

agentParams := controller.AgentParams{
PostParams: postMgrParams,
GTMParams: GtmParams,
Partition: (*bigIPPartitions)[0],
LogLevel: *logLevel,
VerifyInterval: *verifyInterval,
VXLANName: vxlanName,
PythonBaseDir: *pythonBaseDir,
UserAgent: userAgentInfo,
HttpAddress: *httpAddress,
EnableIPV6: *enableIPV6,
CCCLGTMAgent: *ccclGtmAgent,
StaticRoutingMode: *staticRoutingMode,
PostParams: postMgrParams,
GTMParams: GtmParams,
Partition: (*bigIPPartitions)[0],
LogLevel: *logLevel,
VerifyInterval: *verifyInterval,
VXLANName: vxlanName,
PythonBaseDir: *pythonBaseDir,
UserAgent: userAgentInfo,
HttpAddress: *httpAddress,
EnableIPV6: *enableIPV6,
CCCLGTMAgent: *ccclGtmAgent,
StaticRoutingMode: *staticRoutingMode,
SharedStaticRoutes: *sharedStaticRoutes,
}

// When CIS is configured in OCP cluster mode disable ARP in globalSection
Expand All @@ -841,28 +865,36 @@ func initController(

agent := controller.NewAgent(agentParams)

var globalSpecConfigMap *string
if *extendedSpecConfigmap != "" {
globalSpecConfigMap = extendedSpecConfigmap
} else {
globalSpecConfigMap = routeSpecConfigmap
}

ctlr := controller.NewController(
controller.Params{
Config: config,
Namespaces: *namespaces,
NamespaceLabel: *namespaceLabel,
Partition: (*bigIPPartitions)[0],
Agent: agent,
PoolMemberType: *poolMemberType,
VXLANName: vxlanName,
VXLANMode: vxlanMode,
CiliumTunnelName: *ciliumTunnelName,
UseNodeInternal: *useNodeInternal,
NodePollInterval: *nodePollInterval,
NodeLabelSelector: *nodeLabelSelector,
IPAM: *ipam,
ShareNodes: *shareNodes,
DefaultRouteDomain: *defaultRouteDomain,
Mode: controller.ControllerMode(*controllerMode),
RouteSpecConfigmap: *routeSpecConfigmap,
RouteLabel: *routeLabel,
StaticRoutingMode: *staticRoutingMode,
OrchestrationCNI: *orchestrationCNI,
Config: config,
Namespaces: *namespaces,
NamespaceLabel: *namespaceLabel,
Partition: (*bigIPPartitions)[0],
Agent: agent,
PoolMemberType: *poolMemberType,
VXLANName: vxlanName,
VXLANMode: vxlanMode,
CiliumTunnelName: *ciliumTunnelName,
UseNodeInternal: *useNodeInternal,
NodePollInterval: *nodePollInterval,
NodeLabelSelector: *nodeLabelSelector,
IPAM: *ipam,
ShareNodes: *shareNodes,
DefaultRouteDomain: *defaultRouteDomain,
Mode: controller.ControllerMode(*controllerMode),
GlobalExtendedSpecConfigmap: *globalSpecConfigMap,
RouteLabel: *routeLabel,
StaticRoutingMode: *staticRoutingMode,
OrchestrationCNI: *orchestrationCNI,
CISType: *cisType,
},
)

Expand Down Expand Up @@ -931,6 +963,9 @@ func main() {
if *staticRoutingMode == true {
//partition provide through args
vxlanPartition = (*bigIPPartitions)[0]
if *sharedStaticRoutes == true {
vxlanPartition = "Common"
}
}
config, err := getKubeConfig()
if err != nil {
Expand Down Expand Up @@ -1010,11 +1045,12 @@ func main() {
}

gs := globalSection{
LogLevel: *logLevel,
VerifyInterval: *verifyInterval,
VXLANPartition: vxlanPartition,
DisableLTM: disableLTM,
DisableARP: disableARP,
LogLevel: *logLevel,
VerifyInterval: *verifyInterval,
VXLANPartition: vxlanPartition,
DisableLTM: disableLTM,
DisableARP: disableARP,
StaticRoutingMode: *staticRoutingMode,
}
if *ccclLogLevel != "" {
gs.LogLevel = *ccclLogLevel
Expand Down
41 changes: 25 additions & 16 deletions config/apis/cis/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,23 @@ type DefaultPool struct {

// Pool defines a pool object in BIG-IP.
type Pool struct {
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
Service string `json:"service"`
ServicePort intstr.IntOrString `json:"servicePort"`
NodeMemberLabel string `json:"nodeMemberLabel,omitempty"`
Monitor Monitor `json:"monitor"`
Monitors []Monitor `json:"monitors"`
Rewrite string `json:"rewrite,omitempty"`
Balance string `json:"loadBalancingMethod,omitempty"`
WAF string `json:"waf,omitempty"`
ServiceNamespace string `json:"serviceNamespace,omitempty"`
ReselectTries int32 `json:"reselectTries,omitempty"`
ServiceDownAction string `json:"serviceDownAction,omitempty"`
HostRewrite string `json:"hostRewrite,omitempty"`
Weight int32 `json:"weight,omitempty"`
AlternateBackends []AlternateBackend `json:"alternateBackends"`
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
Service string `json:"service"`
ServicePort intstr.IntOrString `json:"servicePort"`
NodeMemberLabel string `json:"nodeMemberLabel,omitempty"`
Monitor Monitor `json:"monitor"`
Monitors []Monitor `json:"monitors"`
Rewrite string `json:"rewrite,omitempty"`
Balance string `json:"loadBalancingMethod,omitempty"`
WAF string `json:"waf,omitempty"`
ServiceNamespace string `json:"serviceNamespace,omitempty"`
ReselectTries int32 `json:"reselectTries,omitempty"`
ServiceDownAction string `json:"serviceDownAction,omitempty"`
HostRewrite string `json:"hostRewrite,omitempty"`
Weight int32 `json:"weight,omitempty"`
AlternateBackends []AlternateBackend `json:"alternateBackends"`
MultiClusterServices []MultiClusterServiceReference `json:"extendedServiceReferences,omitempty"`
}

// AlternateBackends lists backend svc of A/B
Expand All @@ -106,6 +107,14 @@ type AlternateBackend struct {
Weight int32 `json:"weight,omitempty"`
}

type MultiClusterServiceReference struct {
ClusterName string `json:"clusterName"`
SvcName string `json:"serviceName"`
Namespace string `json:"namespace"`
ServicePort intstr.IntOrString `json:"port"`
Weight *int `json:"weight,omitempty"`
}

// Monitor defines a monitor object in BIG-IP.
type Monitor struct {
Type string `json:"type"`
Expand Down
1 change: 1 addition & 0 deletions docs/RELEASE-NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Upgrade notes
* Upgrade the CRDs schema using `CRD Update Guide <https://github.com/F5Networks/k8s-bigip-ctlr/blob/master/docs/config_examples/customResourceDefinitions/crd_update.md>`_, if you are using custom resources.
* In AS3 >= v3.44 & CIS >= 2.13.0, CIS sets the first SSL profile (sorted in alphabetical order of their names) as default profile for SNI if multiple client SSL certificates used for a VS as kubernetes secrets. AS3 used to set the default SNI in earlier version.


2.12.1
-------------

Expand Down
Loading