Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fc10b68
CARRY: Downstream OWNERS
pierreprinetti Apr 4, 2022
6ce3790
CARRY: Add OCP CI config
mdbooth Oct 2, 2023
b63c319
CARRY: Don't ignore vendor directories
mdbooth Oct 3, 2023
62eecb8
CARRY: go mod vendor
mdbooth Oct 3, 2023
2aeec5f
UPSTREAM 1686: Move webhook CA injection into webhook resource
mdbooth Sep 26, 2023
c1d8d4e
CARRY: Add verify-vendoring make target
mdbooth Oct 4, 2023
0709d3e
UPSTREAM 1707: Build setup-envtest in hack/tools
mdbooth Oct 3, 2023
cbcff39
CARRY: go mod vendor
mdbooth Oct 5, 2023
4995309
UPSTREAM 1710: Allow custom KUBEBUILDER_ASSETS_DIR in tests
mdbooth Oct 5, 2023
8bb50a1
UPSTREAM 1709: Ignore vendor directories in boilerplate check
mdbooth Oct 4, 2023
44086dc
Merge pull request #265 from shiftstack/vendoring
openshift-ci[bot] Oct 5, 2023
8566c3a
CARRY: Mark CAPO as second level operator
mdbooth Oct 5, 2023
934e359
UPSTREAM 1715: Add server name for the Machine InternalDNS
MaysaMacedo Oct 6, 2023
37c95ac
Merge pull request #268 from shiftstack/openshift-internaldns
openshift-ci[bot] Oct 10, 2023
041a3bb
CARRY: Add DOWNSTREAM_OWNERS
mdbooth Oct 10, 2023
b96e44c
CARRY: Restore OWNERS to upstream
mdbooth Oct 10, 2023
d54c04c
Merge pull request #269 from shiftstack/downstream-owners
openshift-ci[bot] Oct 10, 2023
086bfdb
Merge pull request #267 from shiftstack/capo-2lo
openshift-ci[bot] Oct 10, 2023
6b53d20
Merge pull request #270 from shiftstack/downstream-owners
openshift-ci[bot] Oct 11, 2023
9a1e2cd
Merge pull request #264 from shiftstack/webhook-kustomize
openshift-ci[bot] Oct 13, 2023
d05e8d9
UPSTREAM 1726: Replace kustomize vars with replacements
mdbooth Oct 12, 2023
f0ebc45
Merge pull request #272 from shiftstack/kustomize
openshift-ci[bot] Oct 16, 2023
4a6c31f
UPSTREAM 1712: Add explicit dependency on github.com/golang/mock/mock…
mdbooth Oct 5, 2023
7f668ce
CARRY: go mod vendor
mdbooth Oct 16, 2023
7fc9a38
Merge pull request #273 from shiftstack/mockgen
openshift-ci[bot] Oct 16, 2023
99222c3
deps: Bump dependencies
pierreprinetti Oct 25, 2023
084aab5
Merge pull request #279 from shiftstack/bump_dependencies
openshift-ci[bot] Oct 26, 2023
2f40ac8
UPSTREAM 1668: Additional data volumes for machines
Sep 13, 2023
9315e2b
Add ephemeral storage support to the `AdditionalBlockDevices`
EmilienM Sep 29, 2023
656fd0c
ci: relax nolintlint
EmilienM Oct 23, 2023
e36505b
api: remove CEL validations for `AdditionalBlockDevices`
EmilienM Oct 26, 2023
6fdfd82
Merge pull request #275 from shiftstack/bd
openshift-ci[bot] Oct 30, 2023
b86d6ff
Add cluster-capi-operator integration
mdbooth Nov 22, 2023
a1d41d1
Merge pull request #266 from shiftstack/cluster-capi-operator-wip
openshift-merge-bot[bot] Nov 28, 2023
1898658
openshift: Add make verify and test
mdbooth Nov 28, 2023
a6039e2
Merge pull request #281 from shiftstack/openshift-tests
openshift-merge-bot[bot] Nov 28, 2023
f9ac32d
openshift: Fix label of cluster-capi infrastructure CM
mdbooth Nov 30, 2023
b6bbfd4
Merge pull request #283 from shiftstack/capo-fix-deployment
openshift-merge-bot[bot] Nov 30, 2023
9b7e2d4
openshift: Add (stub) make e2e
stephenfin Dec 1, 2023
becb402
Merge pull request #284 from shiftstack/add-e2e-target
openshift-merge-bot[bot] Dec 1, 2023
c7c5c85
UPSTREAM: <carry>: Add Snyk file to exclude vendor directory on scan
racheljpg Dec 18, 2023
acc3955
Merge pull request #289 from racheljpg/snykvendor-4.15
openshift-merge-bot[bot] Dec 22, 2023
b73ba5b
openshift/manifests: Drop single-node-developer profile
wking Jan 3, 2024
1e1c56c
openshift/manifests: CloudCredential capability for CredentialsRequest
wking Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-8-release-golang-1.20-openshift-4.15
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ docs/book/book/

# Development container files (https://containers.dev/)
.devcontainer

# Don't ignore anything in vendor directories
!/vendor/**
!/hack/tools/vendor/**
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ linters-settings:
- pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
alias: controlplanev1

nolintlint:
# https://github.com/golangci/golangci-lint/issues/3228
allow-unused: true
staticcheck:
go: "1.17"
stylecheck:
Expand Down
7 changes: 7 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# References:
# https://docs.snyk.io/scan-applications/snyk-code/using-snyk-code-from-the-cli/excluding-directories-and-files-from-the-snyk-code-cli-test
# https://docs.snyk.io/snyk-cli/commands/ignore
exclude:
global:
- vendor/**
- **/vendor/**
6 changes: 6 additions & 0 deletions DOWNSTREAM_OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- shiftstack-team
reviewers:
- shiftstack-team
component: "Cloud Compute"
subcomponent: "OpenStack Provider"
10 changes: 10 additions & 0 deletions DOWNSTREAM_OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
aliases:
shiftstack-team:
- EmilienM
- MaysaMacedo
- dulek
- gryf
- mandre
- mdbooth
- pierreprinetti
- stephenfin
51 changes: 51 additions & 0 deletions Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Build the manager binary
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.20-openshift-4.15 as builder
WORKDIR /workspace

# Run this with docker build --build_arg goproxy=$(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
ENV GOPROXY=$goproxy

# Copy the sources
COPY ./ ./

# Build
ARG ARCH
ARG ldflags

WORKDIR /workspace/openshift
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -ldflags "${ldflags} -extldflags '-static'" \
-o ../infracluster-controller cmd/manager.go

WORKDIR /workspace
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -ldflags "${ldflags} -extldflags '-static'" \
-o manager

# Production image
FROM registry.ci.openshift.org/ocp/4.15:base

COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/infracluster-controller .
COPY ./openshift/manifests ./manifests

# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
USER 65532
ENTRYPOINT ["/manager"]

LABEL io.openshift.release.operator true
44 changes: 27 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
RELEASE_NOTES := $(TOOLS_BIN_DIR)/release-notes

# Setup-envtest
SETUP_ENVTEST_VER := v0.0.0-20221201045826-d9912251cd81
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/setup-envtest

# Kubebuilder
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.25.0
Expand Down Expand Up @@ -135,15 +130,25 @@ endif
$(ARTIFACTS):
mkdir -p $@

ifeq ($(shell go env GOOS),darwin) # Use the darwin/amd64 binary until an arm64 version is available
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env -p path --arch amd64 $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION))
else
KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env -p path $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION))
setup_envtest_extra_args=
# Use the darwin/amd64 binary until an arm64 version is available
ifeq ($(shell go env GOOS),darwin)
setup_envtest_extra_args += --arch amd64
endif

# By default setup-envtest will write to $XDG_DATA_HOME, or $HOME/.local/share
# if that is not defined. Set KUBEBUILDER_ASSETS_DIR to override.
ifdef KUBEBUILDER_ASSETS_DIR
setup_envtest_extra_args += --bin-dir $(KUBEBUILDER_ASSETS_DIR)
endif

.PHONY: test
test: $(SETUP_ENVTEST) ## Run tests
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test -v ./... $(TEST_ARGS)
set -xeuf -o pipefail; \
if [ -z "$(KUBEBUILDER_ASSETS)" ]; then \
KUBEBUILDER_ASSETS=`$(SETUP_ENVTEST) use --use-env -p path $(setup_envtest_extra_args) $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION)`; \
fi; \
KUBEBUILDER_ASSETS="$$KUBEBUILDER_ASSETS" go test -v ./... $(TEST_ARGS)

E2E_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack
E2E_KUSTOMIZE_DIR=test/e2e/data/kustomize
Expand Down Expand Up @@ -225,12 +230,6 @@ managers:
manager-openstack-infrastructure: ## Build manager binary.
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .

$(SETUP_ENVTEST): # Build setup-envtest from tools folder.
GOBIN=$(abspath $(TOOLS_BIN_DIR)) $(GO_INSTALL) $(SETUP_ENVTEST_PKG) $(SETUP_ENVTEST_BIN) $(SETUP_ENVTEST_VER)

.PHONY: $(SETUP_ENVTEST_BIN)
$(SETUP_ENVTEST_BIN): $(SETUP_ENVTEST) ## Build a local copy of setup-envtest.

## --------------------------------------
##@ Linting
## --------------------------------------
Expand Down Expand Up @@ -517,6 +516,17 @@ verify-gen: generate
echo "generated files are out of date, run make generate"; exit 1; \
fi

.PHONY: vendor verify-vendoring
vendor:
go mod vendor
cd $(TOOLS_DIR); go mod vendor

verify-vendoring: vendor
@if !(git diff --quiet HEAD); then \
git diff; \
echo "vendored files are out of date, run go mod vendor"; exit 1; \
fi

.PHONY: compile-e2e
compile-e2e: ## Test e2e compilation
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/conformance
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha5/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,7 @@ func Convert_v1alpha5_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(

return nil
}

func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s conversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha5_OpenStackMachineSpec(in, out, s)
}
16 changes: 6 additions & 10 deletions api/v1alpha5/zz_generated.conversion.go

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

11 changes: 7 additions & 4 deletions api/v1alpha6/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ func restorev1alpha7MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *inf
// PropagateUplinkStatus has been added in v1alpha7.
// We restore the whole Ports since they are anyway immutable.
dst.Ports = previous.Ports
dst.AdditionalBlockDevices = previous.AdditionalBlockDevices
}

func restorev1alpha7Bastion(previous **infrav1.Bastion, dst **infrav1.Bastion) {
// PropagateUplinkStatus has been added in v1alpha7.
// We restore the whole Ports since they are anyway immutable.
if *previous != nil && (*previous).Instance.Ports != nil && *dst != nil && (*dst).Instance.Ports != nil {
(*dst).Instance.Ports = (*previous).Instance.Ports
if *previous != nil && *dst != nil {
restorev1alpha7MachineSpec(&(*previous).Instance, &(*dst).Instance)
}
}

Expand Down Expand Up @@ -646,3 +645,7 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(

return nil
}

func Convert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in *infrav1.OpenStackMachineSpec, out *OpenStackMachineSpec, s apiconversion.Scope) error {
return autoConvert_v1alpha7_OpenStackMachineSpec_To_v1alpha6_OpenStackMachineSpec(in, out, s)
}
16 changes: 6 additions & 10 deletions api/v1alpha6/zz_generated.conversion.go

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

6 changes: 6 additions & 0 deletions api/v1alpha7/openstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ type OpenStackMachineSpec struct {
// The volume metadata to boot from
RootVolume *RootVolume `json:"rootVolume,omitempty"`

// AdditionalBlockDevices is a list of specifications for additional block devices to attach to the server instance
// +listType=map
// +listMapKey=name
// +optional
AdditionalBlockDevices []AdditionalBlockDevice `json:"additionalBlockDevices,omitempty"`

// The server group to assign the machine to
ServerGroupID string `json:"serverGroupID,omitempty"`

Expand Down
8 changes: 8 additions & 0 deletions api/v1alpha7/openstackmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ func (r *OpenStackMachine) ValidateCreate() (admission.Warnings, error) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
}

if r.Spec.RootVolume != nil && r.Spec.AdditionalBlockDevices != nil {
for _, device := range r.Spec.AdditionalBlockDevices {
if device.Name == "root" {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "additionalBlockDevices"), "cannot contain a device named \"root\" when rootVolume is set"))
}
}
}

return aggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, allErrs)
}

Expand Down
63 changes: 63 additions & 0 deletions api/v1alpha7/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,69 @@ type RootVolume struct {
AvailabilityZone string `json:"availabilityZone,omitempty"`
}

// BlockDeviceStorage is the storage type of a block device to create and
// contains additional storage options.
// +union
//
//nolint:godot
type BlockDeviceStorage struct {
// Type is the type of block device to create.
// This can be either "Volume" or "Local".
// +unionDiscriminator
Type BlockDeviceType `json:"type"`

// Volume contains additional storage options for a volume block device.
// +optional
// +unionMember,optional
Volume *BlockDeviceVolume `json:"volume,omitempty"`
}

// BlockDeviceVolume contains additional storage options for a volume block device.
type BlockDeviceVolume struct {
// Type is the Cinder volume type of the volume.
// If omitted, the default Cinder volume type that is configured in the OpenStack cloud
// will be used.
// +optional
Type string `json:"type,omitempty"`

// AvailabilityZone is the volume availability zone to create the volume in.
// If omitted, the availability zone of the server will be used.
// The availability zone must NOT contain spaces otherwise it will lead to volume that belongs
// to this availability zone register failure, see kubernetes/cloud-provider-openstack#1379 for
// further information.
// +optional
AvailabilityZone string `json:"availabilityZone,omitempty"`
}

// AdditionalBlockDevice is a block device to attach to the server.
type AdditionalBlockDevice struct {
// Name of the block device in the context of a machine.
// If the block device is a volume, the Cinder volume will be named
// as a combination of the machine name and this name.
// Also, this name will be used for tagging the block device.
// Information about the block device tag can be obtained from the OpenStack
// metadata API or the config drive.
Name string `json:"name"`

// SizeGiB is the size of the block device in gibibytes (GiB).
SizeGiB int `json:"sizeGiB"`

// Storage specifies the storage type of the block device and
// additional storage options.
Storage BlockDeviceStorage `json:"storage"`
}

// BlockDeviceType defines the type of block device to create.
type BlockDeviceType string

const (
// LocalBlockDevice is an ephemeral block device attached to the server.
LocalBlockDevice BlockDeviceType = "Local"

// VolumeBlockDevice is a volume block device attached to the server.
VolumeBlockDevice BlockDeviceType = "Volume"
)

// NetworkStatus contains basic information about an existing neutron network.
type NetworkStatus struct {
Name string `json:"name"`
Expand Down
Loading