Skip to content

Commit

Permalink
OCPBUGS-43083: Fix IsIPv4 function identifying also addresses instead…
Browse files Browse the repository at this point in the history
… of CIDRs

The issue deploying IPv6 disconnected clusters happens on the validation of the KASEndpointSlice (https://github.com/openshift/hypershift/blob/main/control-plane-operator/hostedclusterconfigoperator/controllers/resources/kas/reconcile.go\#L32). Now that function supports IPv4/IPv6 addresses too, so the workflow is not modified but the validation and configuration of the Kubernetes endpointSlice

Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
  • Loading branch information
jparrill committed Dec 17, 2024
1 parent 7ee654e commit a35751a
Show file tree
Hide file tree
Showing 50 changed files with 180 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func etcdPodSelector() map[string]string {

func NewEtcdParams(hcp *hyperv1.HostedControlPlane, releaseImageProvider imageprovider.ReleaseImageProvider) (*EtcdParams, error) {

ipv4, err := hyputils.IsIPv4(hcp.Spec.Networking.ClusterNetwork[0].CIDR.String())
ipv4, err := hyputils.IsIPv4CIDR(hcp.Spec.Networking.ClusterNetwork[0].CIDR.String())
if err != nil {
return nil, fmt.Errorf("error checking the ClusterNetworkCIDR: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ func (r *HostedControlPlaneReconciler) reconcileCPOV2(ctx context.Context, hcp *
SetDefaultSecurityContext: r.SetDefaultSecurityContext,
MetricsSet: r.MetricsSet,
EnableCIDebugOutput: r.EnableCIDebugOutput,
ImageMetadataProvider: r.ImageMetadataProvider,
}

var errs []error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import (
"github.com/openshift/hypershift/support/releaseinfo"
fakereleaseprovider "github.com/openshift/hypershift/support/releaseinfo/fake"
"github.com/openshift/hypershift/support/testutil"
"github.com/openshift/hypershift/support/thirdparty/library-go/pkg/image/dockerv1client"
"github.com/openshift/hypershift/support/upsert"
"github.com/openshift/hypershift/support/util"
"github.com/openshift/hypershift/support/util/fakeimagemetadataprovider"
"go.uber.org/zap/zaptest"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -1649,6 +1651,7 @@ func TestControlPlaneComponents(t *testing.T) {
VPC: &hyperv1.PowerVSVPC{},
},
},
ReleaseImage: "quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64",
},
}

Expand All @@ -1664,8 +1667,12 @@ func TestControlPlaneComponents(t *testing.T) {
CreateOrUpdateProviderV2: upsert.NewV2(false),
ReleaseImageProvider: testutil.FakeImageProvider(),
UserReleaseImageProvider: testutil.FakeImageProvider(),
HCP: hcp,
SkipPredicate: true,
ImageMetadataProvider: &fakeimagemetadataprovider.FakeRegistryClientImageMetadataProvider{
Result: &dockerv1client.DockerImageConfig{},
Manifest: fakeimagemetadataprovider.FakeManifest{},
},
HCP: hcp,
SkipPredicate: true,
}
for _, featureSet := range []configv1.FeatureSet{configv1.Default, configv1.TechPreviewNoUpgrade} {
cpContext.HCP.Spec.Configuration.FeatureGate.FeatureGateSelection.FeatureSet = featureSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func NewPKIParams(hcp *hyperv1.HostedControlPlane,
// Even with that, we cannot set more than one AdvertiseAddress so both
// are not supported at the same time.
// Check this for more info: https://github.com/kubernetes/enhancements/issues/2438
ipv4, err := util.IsIPv4(p.ServiceCIDR[0])
ipv4, err := util.IsIPv4CIDR(p.ServiceCIDR[0])
if err != nil || ipv4 {
p.NodeInternalAPIServerIP = util.AdvertiseAddressWithDefault(hcp, config.DefaultAdvertiseIPv4Address)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: cloud-token
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: cloud-token
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cloud-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
hypershift.openshift.io/control-plane-component: cloud-controller-manager-openstack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
hypershift.openshift.io/control-plane-component: cloud-controller-manager-openstack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
hypershift.openshift.io/control-plane-component: cloud-controller-manager-powervs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
hypershift.openshift.io/control-plane-component: cloud-controller-manager-powervs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-autoscaler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-autoscaler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-policy-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-policy-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: payload,update-payloads
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-version-operator
Expand Down Expand Up @@ -85,6 +85,7 @@ spec:
- name: CLUSTER_PROFILE
value: ibm-cloud-managed
- name: RELEASE_IMAGE
value: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
- name: NODE_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -287,7 +288,7 @@ spec:
EOF
command:
- /bin/bash
image: cluster-version-operator
image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
imagePullPolicy: IfNotPresent
name: prepare-payload
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: payload,update-payloads
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: cluster-version-operator
Expand Down Expand Up @@ -85,6 +85,7 @@ spec:
- name: CLUSTER_PROFILE
value: ibm-cloud-managed
- name: RELEASE_IMAGE
value: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
- name: NODE_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -284,9 +285,10 @@ spec:
annotations:
include.release.openshift.io/ibm-cloud-managed: "true"
release.openshift.io/delete: "true"
EOF
command:
- /bin/bash
image: cluster-version-operator
image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
imagePullPolicy: IfNotPresent
name: prepare-payload
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: etcd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: etcd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: hosted-cluster-config-operator
Expand Down Expand Up @@ -89,6 +89,7 @@ spec:
- name: KUBERNETES_VERSION
value: "1.30"
- name: OPERATE_ON_RELEASE_IMAGE
value: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
- name: OPENSHIFT_IMG_OVERRIDES
value: =
image: hosted-cluster-config-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
template:
metadata:
annotations:
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: hosted-cluster-config-operator
Expand Down Expand Up @@ -89,6 +89,7 @@ spec:
- name: KUBERNETES_VERSION
value: "1.30"
- name: OPERATE_ON_RELEASE_IMAGE
value: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
- name: OPENSHIFT_IMG_OVERRIDES
value: =
image: hosted-cluster-config-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: bootstrap-manifests,logs
component.hypershift.openshift.io/config-hash: 19dc307e1d8949e23415eb6680075ec3
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-apiserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: bootstrap-manifests,logs
component.hypershift.openshift.io/config-hash: 19dc307e1d8949e23415eb667d1e0a2d
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-apiserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: logs,certs
component.hypershift.openshift.io/config-hash: "1252551421580954"
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: logs,certs
component.hypershift.openshift.io/config-hash: "1252551421580954"
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: cert-work
component.hypershift.openshift.io/config-hash: 022a8a3a
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-scheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: cert-work
component.hypershift.openshift.io/config-hash: 022a8a3a
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: kube-scheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: work-logs,oas-trust-anchor
component.hypershift.openshift.io/config-hash: 19dc307e3415eb666d06370b
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: openshift-apiserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: work-logs,oas-trust-anchor
component.hypershift.openshift.io/config-hash: 19dc307e3415eb666d06370b
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: openshift-apiserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
metadata:
annotations:
component.hypershift.openshift.io/config-hash: 8bcb4d22
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: openshift-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
metadata:
annotations:
component.hypershift.openshift.io/config-hash: 8bcb4d22
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: openshift-controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: work-logs
component.hypershift.openshift.io/config-hash: 19dc307e3415eb66
hypershift.openshift.io/release-image: ""
hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64
creationTimestamp: null
labels:
app: openshift-oauth-apiserver
Expand Down
Loading

0 comments on commit a35751a

Please sign in to comment.