Skip to content

Commit 24fe2f6

Browse files
committed
Merge remote-tracking branch 'josh/feature/multi-endpoint-failure-domains' into multiple-endpoints
2 parents 61adadc + 7f7d110 commit 24fe2f6

File tree

95 files changed

+3768
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3768
-103
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ config/.flag.mk: bin/controller-gen $(MANIFEST_GEN_INPUTS)
6363
.PHONY: release-manifests
6464
RELEASE_MANIFEST_TARGETS=$(RELEASE_DIR)/infrastructure-components.yaml $(RELEASE_DIR)/metadata.yaml
6565
RELEASE_MANIFEST_INPUTS=bin/kustomize config/.flag.mk $(shell find config)
66+
RELEASE_MANIFEST_SOURCE_BASE ?= config/default
6667
release-manifests: $(RELEASE_MANIFEST_TARGETS) ## Create kustomized release manifest in $RELEASE_DIR (defaults to out).
6768
$(RELEASE_DIR)/%: $(RELEASE_MANIFEST_INPUTS)
6869
@mkdir -p $(RELEASE_DIR)
6970
cp metadata.yaml $(RELEASE_DIR)/metadata.yaml
70-
kustomize build config/default > $(RELEASE_DIR)/infrastructure-components.yaml
71+
kustomize build $(RELEASE_MANIFEST_SOURCE_BASE) > $(RELEASE_DIR)/infrastructure-components.yaml
72+
73+
.PHONY: release-manifests-metrics-port
74+
release-manifests-metrics-port:
75+
make release-manifests RELEASE_MANIFEST_SOURCE_BASE=config/default-with-metrics-port
7176

7277
DEEPCOPY_GEN_TARGETS=$(shell find api -type d -name "v*" -exec echo {}\/zz_generated.deepcopy.go \;)
7378
DEEPCOPY_GEN_INPUTS=$(shell find ./api -name "*test*" -prune -o -name "*zz_generated*" -prune -o -type f -print)

api/v1beta2/cloudstackcluster_types.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import (
2323
)
2424

2525
const (
26-
ClusterFinalizer = "cloudstackcluster.infrastructure.cluster.x-k8s.io"
27-
CloudStackClusterLabelName = "cloudstackcluster.infrastructure.cluster.x-k8s.io/name"
26+
ClusterFinalizer = "cloudstackcluster.infrastructure.cluster.x-k8s.io"
2827
)
2928

3029
var K8sClient client.Client
@@ -35,14 +34,6 @@ type CloudStackClusterSpec struct {
3534

3635
// The kubernetes control plane endpoint.
3736
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
38-
39-
// CloudStack account.
40-
// +optional
41-
Account string `json:"account,omitempty"`
42-
43-
// CloudStack domain.
44-
// +optional
45-
Domain string `json:"domain,omitempty"`
4637
}
4738

4839
// The status of the CloudStackCluster object.

api/v1beta2/cloudstackcluster_webhook.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func (r *CloudStackCluster) ValidateCreate() error {
5656
cloudstackclusterlog.V(1).Info("entered validate create webhook", "api resource name", r.Name)
5757

5858
var errorList field.ErrorList
59-
if (r.Spec.Account != "") && (r.Spec.Domain == "") {
60-
errorList = append(errorList, field.Required(
61-
field.NewPath("spec", "account"), "specifying account requires additionally specifying domain"))
62-
}
6359

6460
// Require FailureDomains and their respective sub-fields.
6561
if len(r.Spec.FailureDomains) <= 0 {

api/v1beta2/cloudstackcluster_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ var _ = Describe("CloudStackCluster webhooks", func() {
6363

6464
It("Should reject updates to CloudStackCluster FailureDomains", func() {
6565
dummies.CSCluster.Spec.FailureDomains[0].Zone.Name = "SomeRandomUpdate"
66-
Ω(k8sClient.Update(ctx, dummies.CSCluster)).Should(MatchError(MatchRegexp(forbiddenRegex, "FailureDomains and sub")))
66+
Ω(k8sClient.Update(ctx, dummies.CSCluster)).Should(MatchError(MatchRegexp(forbiddenRegex, "Cannot change FailureDomain")))
6767
})
6868
It("Should reject updates to Networks specified in CloudStackCluster Zones", func() {
6969
dummies.CSCluster.Spec.FailureDomains[0].Zone.Network.Name = "ArbitraryUpdateNetworkName"
70-
Ω(k8sClient.Update(ctx, dummies.CSCluster)).Should(MatchError(MatchRegexp(forbiddenRegex, "FailureDomains and sub")))
70+
Ω(k8sClient.Update(ctx, dummies.CSCluster)).Should(MatchError(MatchRegexp(forbiddenRegex, "Cannot change FailureDomain")))
7171
})
7272
It("Should reject updates to CloudStackCluster controlplaneendpoint.host", func() {
7373
dummies.CSCluster.Spec.ControlPlaneEndpoint.Host = "1.1.1.1"

config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ spec:
201201
spec:
202202
description: CloudStackClusterSpec defines the desired state of CloudStackCluster.
203203
properties:
204-
account:
205-
description: CloudStack account.
206-
type: string
207204
controlPlaneEndpoint:
208205
description: The kubernetes control plane endpoint.
209206
properties:
@@ -218,9 +215,6 @@ spec:
218215
- host
219216
- port
220217
type: object
221-
domain:
222-
description: CloudStack domain.
223-
type: string
224218
failureDomains:
225219
items:
226220
description: CloudStackFailureDomainSpec defines the desired state
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: metrics-reader
5+
rules:
6+
- nonResourceURLs:
7+
- "/metrics"
8+
verbs:
9+
- get
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: proxy-role
5+
rules:
6+
- apiGroups:
7+
- authentication.k8s.io
8+
resources:
9+
- tokenreviews
10+
verbs:
11+
- create
12+
- apiGroups:
13+
- authorization.k8s.io
14+
resources:
15+
- subjectaccessreviews
16+
verbs:
17+
- create
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: proxy-rolebinding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: proxy-role
9+
subjects:
10+
- kind: ServiceAccount
11+
name: controller-manager
12+
namespace: system
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
control-plane: controller-manager
6+
name: controller-manager-metrics-service
7+
namespace: system
8+
spec:
9+
ports:
10+
- name: https
11+
port: 8443
12+
protocol: TCP
13+
targetPort: https
14+
selector:
15+
control-plane: capc-controller-manager
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
bases:
5+
- ../default
6+
7+
resources:
8+
- auth_proxy_client_clusterrole.yaml
9+
- auth_proxy_role.yaml
10+
- auth_proxy_role_binding.yaml
11+
- auth_proxy_service.yaml
12+
13+
patchesStrategicMerge:
14+
- manager_auth_proxy_patch.yaml

0 commit comments

Comments
 (0)