Skip to content

Commit

Permalink
Merge pull request #736 from weaveworks/fix-734
Browse files Browse the repository at this point in the history
Upgrade aws-node to v1.4.1
  • Loading branch information
errordeveloper authored May 7, 2019
2 parents 3d84967 + ace29d3 commit 73cf28e
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 35 deletions.
25 changes: 24 additions & 1 deletion pkg/addons/default/assets.go

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

129 changes: 129 additions & 0 deletions pkg/addons/default/assets/aws-node-1.10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
apiVersion: rbac.authorization.k8s.io/v1
# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: aws-node
rules:
- apiGroups:
- crd.k8s.amazonaws.com
resources:
- "*"
- namespaces
verbs:
- "*"
- apiGroups: [""]
resources:
- pods
- nodes
- namespaces
verbs: ["list", "watch", "get"]
- apiGroups: ["extensions"]
resources:
- daemonsets
verbs: ["list", "watch"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: aws-node
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: aws-node
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: aws-node
subjects:
- kind: ServiceAccount
name: aws-node
namespace: kube-system
---
kind: DaemonSet
apiVersion: apps/v1
# kubernetes versions before 1.9.0 should use extensions/v1beta1
metadata:
name: aws-node
namespace: kube-system
labels:
k8s-app: aws-node
spec:
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
k8s-app: aws-node
template:
metadata:
labels:
k8s-app: aws-node
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
serviceAccountName: aws-node
hostNetwork: true
tolerations:
- operator: Exists
containers:
- image: 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni:v1.4.1
imagePullPolicy: Always
ports:
- containerPort: 61678
name: metrics
name: aws-node
env:
- name: AWS_VPC_K8S_CNI_LOGLEVEL
value: DEBUG
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
requests:
cpu: 10m
securityContext:
privileged: true
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cni-bin-dir
- mountPath: /host/etc/cni/net.d
name: cni-net-dir
- mountPath: /host/var/log
name: log-dir
- mountPath: /var/run/docker.sock
name: dockersock
volumes:
- name: cni-bin-dir
hostPath:
path: /opt/cni/bin
- name: cni-net-dir
hostPath:
path: /etc/cni/net.d
- name: log-dir
hostPath:
path: /var/log
- name: dockersock
hostPath:
path: /var/run/docker.sock
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: eniconfigs.crd.k8s.amazonaws.com
spec:
scope: Cluster
group: crd.k8s.amazonaws.com
# 1.10 uses "version", all newer use "versions"
version: v1alpha1
names:
plural: eniconfigs
singular: eniconfig
kind: ENIConfig
10 changes: 6 additions & 4 deletions pkg/addons/default/assets/aws-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ spec:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
priorityClassName: system-node-critical
serviceAccountName: aws-node
hostNetwork: true
tolerations:
- operator: Exists
containers:
- image: 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni:v1.3.2
- image: 602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon-k8s-cni:v1.4.1
imagePullPolicy: Always
ports:
- containerPort: 61678
Expand Down Expand Up @@ -121,10 +122,11 @@ metadata:
spec:
scope: Cluster
group: crd.k8s.amazonaws.com
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
names:
plural: eniconfigs
singular: eniconfig
kind: ENIConfig


8 changes: 6 additions & 2 deletions pkg/addons/default/aws_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
)

// UpdateAWSNode will update the `aws-node` add-on
func UpdateAWSNode(rawClient kubernetes.RawClientInterface, region string, plan bool) (bool, error) {
func UpdateAWSNode(rawClient kubernetes.RawClientInterface, region string, controlPlaneVersion string, plan bool) (bool, error) {
_, err := rawClient.ClientSet().AppsV1().DaemonSets(metav1.NamespaceSystem).Get(AWSNode, metav1.GetOptions{})
if err != nil {
if apierrs.IsNotFound(err) {
Expand All @@ -34,7 +34,11 @@ func UpdateAWSNode(rawClient kubernetes.RawClientInterface, region string, plan
}

// if DaemonSets is present, go through our list of assets
list, err := LoadAsset(AWSNode, "yaml")
assetName := AWSNode
if strings.HasPrefix(controlPlaneVersion, "1.10.") {
assetName += "-1.10"
}
list, err := LoadAsset(assetName, "yaml")
if err != nil {
return false, err
}
Expand Down
Loading

0 comments on commit 73cf28e

Please sign in to comment.