1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 06:46:36 +01:00

12 Commits

Author SHA1 Message Date
Mark Old
8ccbf40fff Add generated DeepCopy implementations for pkg/types/installconfig 2025-11-18 22:28:04 -08:00
Rafael Fonseca
7f396ca8c8 ipnet: add marker for controller-gen
Needed to tell controller-gen we're implementing our own marshalling.
Otherwise it fails for newer versions of controller-gen with

```
/go/src/github.com/openshift/installer/pkg/ipnet/ipnet.go:18:2: encountered struct field "" without JSON tag in type "IPNet"
```
2024-04-25 11:27:50 +02:00
staebler
66a94489c7 types/validation: test validation of non-empty, invalid CIDRs
The tests that validate CIDRs in install-config.yaml were only testing
empty CIDRs. These changes test non-empty but still invalid CIDRs instead.

The ipnet.ParseCIDR function was changed to use the IP as read from the
CIDR string instead of the IP from the parsed CIDR. This makes the
function consistent with the UnmarshalJSON function.
2019-02-22 15:29:25 -05:00
staebler
b2d6fa405b validate: simplify CIDR validation
Much of the code that made of the CIDR validation was there to give a custom
description of what made the CIDR provided invalid. This has been removed in
favor of using the error returned by the golang library's ParseCIDR function.

Additionally, the code to determine whether two CIDRs overlap was unnecessary
complex because it did not take advantage of the fact that CIDRs only overlap
if one is a subset of the other.

https://jira.coreos.com/browse/CORS-850
2018-12-14 19:21:05 -05:00
Abhinav Dahiya
47aa8f8475 pkg: wrap all errors with context 2018-10-03 11:38:07 -07:00
Alex Crawford
0c6d53b7d6 *: remove bazel
This removes all of the files which are directly required by bazel.
2018-09-27 22:13:02 -07:00
Alex Crawford
ba9d7e44dd asset/*: fix ip address calculations
The issue was a result of IPNet's ParseCIDR() always returning a 16-byte
address, while some third-party libraries assume that the address length
corresponds to whether or not IPv6 is in use.
2018-09-24 16:28:56 -07:00
W. Trevor King
ca6f6195fa Revert "pkg/ipnet: Add DeepCopy and DeepCopyInto for IPNet"
This reverts commit 06739c665e, #276.

Devan's forking the config in Hive [1], so they no longer need us to
support embedding in Kubernetes objects.

[1]: https://github.com/openshift/installer/issues/256#issuecomment-423270461
2018-09-20 10:51:17 -07:00
W. Trevor King
06739c665e pkg/ipnet: Add DeepCopy and DeepCopyInto for IPNet
Devan needs DeepCopyInto on IPNet as part of embed our types into
Hive's ClusterDeployment CRD [1].  You could generate these with
deepcopy-gen [2], but setting up automatic code generation is a bit
heavy for just these methods [3], so we're hand-coding for now.

[1]: https://github.com/openshift/installer/issues/256#issue-360875062
[2]: https://godoc.org/k8s.io/gengo/examples/deepcopy-gen
[3]: https://github.com/openshift/installer/pull/276#issuecomment-422871376
2018-09-19 12:31:02 -07:00
W. Trevor King
36d5eb0a47 pkg/ipnet: Teach IPNet.String() to handle nil receivers
Instead of panicking.  This makes some comparisons easier, as you can
see from the test changes.
2018-09-19 11:48:49 -07:00
W. Trevor King
e40de60421 *: Update BUILD.bazel
Generated with:

  $ bazel run //:gazelle

to avoid [1]:

  $ bazel build tarball
  ...
  GoCompile: missing strict dependencies:
  					 /tmp/bazel-sandbox/4336384718306128892/execroot/installer/pkg/types/installconfig.go: import of "github.com/openshift/installer/pkg/ipnet"
  Known dependencies are:
  			k8s.io/apimachinery/pkg/apis/meta/v1
  			k8s.io/apimachinery/pkg/apis/meta/v1
  ...

[1]: https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_installer/222/pull-ci-openshift-installer-bazel-build-tarball/53/build-log.txt
2018-09-06 17:07:13 -07:00
W. Trevor King
c756ba504f pkg/ipnet: Provide an IPNet structure with CIDR serialization
Use CIDR notation [1] for serliazing IPNet structures so the values
are human editable (vs. the stdlib's base64 netmasks).  It's
unfortunate that we can't update the stdlib to do this, but their
encodings are frozen [2].

[1]: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation
[2]: https://github.com/golang/go/issues/12803#issuecomment-150673932
2018-09-06 16:59:10 -07:00