Skip to content

Commit

Permalink
Merge pull request #7553 from mikesplain/automated-cherry-pick-of-#75…
Browse files Browse the repository at this point in the history
…28-origin-release-1.15

Automated cherry pick of #7528: Add ability to configure number of Typha Replicas
  • Loading branch information
k8s-ci-robot authored Sep 10, 2019
2 parents 7c84c48 + ce46185 commit 81456db
Show file tree
Hide file tree
Showing 11 changed files with 464 additions and 122 deletions.
16 changes: 14 additions & 2 deletions docs/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ spec:
### Configuring Weave Net EXTRA_ARGS

Weave allows you to pass command line arguments to weave by adding those arguments to the EXTRA_ARGS environmental variable.
This can be used for debugging or for customizing the logging level of weave net.
This can be used for debugging or for customizing the logging level of weave net.

```
spec:
Expand Down Expand Up @@ -220,10 +220,22 @@ For help with Calico or to report any issues:

#### Calico Backend

In kops 1.12.0 and later Calico uses the k8s APIServer as its datastore. The current setup does not make use of [Typha](https://github.com/projectcalico/typha) - a component intended to lower the impact of Calico on the k8s APIServer which is recommended in [clusters over 50 nodes](https://docs.projectcalico.org/latest/getting-started/kubernetes/installation/calico#installing-with-the-kubernetes-api-datastoremore-than-50-nodes) and is strongly recommended in clusters of 100+ nodes.
In kops 1.12.0 and later Calico uses the k8s APIServer as its datastore.

In versions <1.12.0 of kops Calico uses etcd as a backend for storing information about workloads and policies. Calico does not interfere with normal etcd operations and does not require special handling when upgrading etcd. For more information please visit the [etcd Docs](https://coreos.com/etcd/docs/latest/)

#### Configuraing Calico to use Typha

As of Kops 1.12 Calico uses the kube-apiserver as its datastore. The default setup does not make use of [Typha](https://github.com/projectcalico/typha) - a component intended to lower the impact of Calico on the k8s APIServer which is recommended in [clusters over 50 nodes](https://docs.projectcalico.org/latest/getting-started/kubernetes/installation/calico#installing-with-the-kubernetes-api-datastoremore-than-50-nodes) and is strongly recommended in clusters of 100+ nodes.
It is possible to configure Calico to use Typha by editing a cluster and adding a
`typhaReplicas` option to the Calico spec:

```
networking:
calico:
typhaReplicas: 3
```

#### Calico troubleshooting

##### New nodes are taking minutes for syncing ip routes and new pods on them can't reach kubedns
Expand Down
17 changes: 17 additions & 0 deletions k8s/crds/kops_v1alpha2_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,23 @@ spec:
description: PrometheusProcessMetricsEnabled enables Prometheus
process metrics collection
type: boolean
typhaPrometheusMetricsEnabled:
description: 'TyphaPrometheusMetricsEnabled enables Prometheus metrics
collection from Typha'
type: boolean
typhaPrometheusMetricsPort:
description: 'PrometheusMetricsPort is the TCP port that the
Typha Prometheus metrics server should bind to (default:
9093)'
format: int32
type: integer
typhaReplicas:
description: 'TyphaReplicas is the number of replicas of Typha to
deploy. If set >0 Calico is configured to connect to the Typha service
rather than directly to the kube-apiserver. Intended to reduce the
load on the APIServer (default: 0)'
format: int32
type: integer
type: object
canal:
properties:
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/kops/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ type CalicoNetworkingSpec struct {
MajorVersion string `json:"majorVersion,omitempty"`
// IPIPMode is mode for CALICO_IPV4POOL_IPIP
IPIPMode string `json:"ipipMode,omitempty"`
// TyphaPrometheusMetricsEnabled enables Prometheus metrics collection from Typha
// (default: false)
TyphaPrometheusMetricsEnabled bool `json:"typhaPrometheusMetricsEnabled,omitempty"`
// TyphaPrometheusMetricsPort is the TCP port the typha Prometheus metrics server
// should bind to (default: 9093)
TyphaPrometheusMetricsPort int32 `json:"typhaPrometheusMetricsPort,omitempty"`
// TyphaReplicas is the number of replicas of Typha to deploy
TyphaReplicas int32 `json:"typhaReplicas,omitempty"`
}

// CanalNetworkingSpec declares that we want Canal networking
Expand Down
8 changes: 8 additions & 0 deletions pkg/apis/kops/v1alpha1/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ type CalicoNetworkingSpec struct {
MajorVersion string `json:"majorVersion,omitempty"`
// IPIPMode is mode for CALICO_IPV4POOL_IPIP
IPIPMode string `json:"ipipMode,omitempty"`
// TyphaPrometheusMetricsEnabled enables Prometheus metrics collection from Typha
// (default: false)
TyphaPrometheusMetricsEnabled bool `json:"typhaPrometheusMetricsEnabled,omitempty"`
// TyphaPrometheusMetricsPort is the TCP port the typha Prometheus metrics server
// should bind to (default: 9093)
TyphaPrometheusMetricsPort int32 `json:"typhaPrometheusMetricsPort,omitempty"`
// TyphaReplicas is the number of replicas of Typha to deploy
TyphaReplicas int32 `json:"typhaReplicas,omitempty"`
}

// CanalNetworkingSpec declares that we want Canal networking
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kops/v1alpha1/zz_generated.conversion.go

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

8 changes: 8 additions & 0 deletions pkg/apis/kops/v1alpha2/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ type CalicoNetworkingSpec struct {
MajorVersion string `json:"majorVersion,omitempty"`
// IPIPMode is mode for CALICO_IPV4POOL_IPIP
IPIPMode string `json:"ipipMode,omitempty"`
// TyphaPrometheusMetricsEnabled enables Prometheus metrics collection from Typha
// (default: false)
TyphaPrometheusMetricsEnabled bool `json:"typhaPrometheusMetricsEnabled,omitempty"`
// TyphaPrometheusMetricsPort is the TCP port the typha Prometheus metrics server
// should bind to (default: 9093)
TyphaPrometheusMetricsPort int32 `json:"typhaPrometheusMetricsPort,omitempty"`
// TyphaReplicas is the number of replicas of Typha to deploy
TyphaReplicas int32 `json:"typhaReplicas,omitempty"`
}

// CanalNetworkingSpec declares that we want Canal networking
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

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

7 changes: 7 additions & 0 deletions pkg/apis/kops/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ func ValidateEtcdVersionForCalicoV3(e *kops.EtcdClusterSpec, majorVersion string

func validateNetworkingCalico(v *kops.CalicoNetworkingSpec, e *kops.EtcdClusterSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if v.TyphaReplicas >= 0 {

} else {
allErrs = append(allErrs,
field.Invalid(fldPath.Child("TyphaReplicas"), v.TyphaReplicas,
fmt.Sprintf("Unable to set number of Typha replicas to less than 0, you've specified %d", v.TyphaReplicas)))
}
switch v.MajorVersion {
case "":
// OK:
Expand Down
17 changes: 17 additions & 0 deletions pkg/apis/kops/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,23 @@ func Test_Validate_Calico(t *testing.T) {
Etcd: &kops.EtcdClusterSpec{},
},
},
{
Input: caliInput{
Calico: &kops.CalicoNetworkingSpec{
TyphaReplicas: 3,
},
Etcd: &kops.EtcdClusterSpec{},
},
},
{
Input: caliInput{
Calico: &kops.CalicoNetworkingSpec{
TyphaReplicas: -1,
},
Etcd: &kops.EtcdClusterSpec{},
},
ExpectedErrors: []string{"Invalid value::Calico.TyphaReplicas"},
},
{
Input: caliInput{
Calico: &kops.CalicoNetworkingSpec{
Expand Down
Loading

0 comments on commit 81456db

Please sign in to comment.