diff --git a/go.mod b/go.mod index 1997568d7a..77329c792e 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openshift/api v0.0.0-20240408161721-1e963d8dc466 github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8 - github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d - github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437 + github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8 + github.com/openshift/library-go v0.0.0-20240412151150-149aa7608754 github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 go.etcd.io/etcd/client/v3 v3.5.10 diff --git a/go.sum b/go.sum index 6cf99d8488..d22e8a8777 100644 --- a/go.sum +++ b/go.sum @@ -143,10 +143,10 @@ github.com/openshift/api v0.0.0-20240408161721-1e963d8dc466 h1:njWJghU7ky7h2Me/5 github.com/openshift/api v0.0.0-20240408161721-1e963d8dc466/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8 h1:cu3YUMVGsKIyFyJGO3F6BZKGYQZpCKxAv9cBPgQAca8= github.com/openshift/build-machinery-go v0.0.0-20231128094528-1e9b1b0595c8/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= -github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d h1:vdrC3QYkFcs6a1Cz2/p5RcV7dMQ22tbgIonx+8HIJc0= -github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d/go.mod h1:Y5Hp789dTrF6Fq8cA5YQlpwffmlLy8mc2un/CY0cg7Q= -github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437 h1:xMflL80gT2cXxnmDkR8QLZCbfh/x38jV5XOfLiNlsLE= -github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437/go.mod h1:ePlaOqUiPplRc++6aYdMe+2FmXb2xTNS9Nz5laG2YmI= +github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8 h1:HGfbllzRcrJBSiwzNjBCs7sExLUxC5/1evnvlNGB0Cg= +github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8/go.mod h1:+VvvaMSTUhOt+rBq7NwRLSNxq06hTeRCBqm0j0PQEq8= +github.com/openshift/library-go v0.0.0-20240412151150-149aa7608754 h1:+sf1OfhVX03aY3ytcdESesHxV63ror+ztHK2Fu6r/YI= +github.com/openshift/library-go v0.0.0-20240412151150-149aa7608754/go.mod h1:m/HsttSi90vSixwoy5mPUBHcZid2YRw/QbsLErLxF9s= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/pkg/controllers/configobservation/oauth/idp_conversions_test.go b/pkg/controllers/configobservation/oauth/idp_conversions_test.go index 26778e2d7d..ecaab3bc06 100644 --- a/pkg/controllers/configobservation/oauth/idp_conversions_test.go +++ b/pkg/controllers/configobservation/oauth/idp_conversions_test.go @@ -29,7 +29,7 @@ func Test_convertProviderConfigToIDPData(t *testing.T) { tmpDir := t.TempDir() ca, err := crypto.MakeSelfSignedCA(path.Join(tmpDir, "cert.crt"), path.Join(tmpDir, "key.key"), "", "testCA", 5) require.NoError(t, err) - serverConfig, err := ca.MakeServerCert(sets.NewString("localhost", "127.0.0.1", "::1"), 1) + serverConfig, err := ca.MakeServerCert(sets.New("localhost", "127.0.0.1", "::1"), 1) require.NoError(t, err) certPEM, keyPEM, err := serverConfig.GetPEMBytes() require.NoError(t, err) diff --git a/pkg/controllers/routercerts/controller.go b/pkg/controllers/routercerts/controller.go index 81d42be656..35ab857d42 100644 --- a/pkg/controllers/routercerts/controller.go +++ b/pkg/controllers/routercerts/controller.go @@ -117,7 +117,7 @@ func (c *routerCertsDomainValidationController) sync(ctx context.Context, syncCt syncCtx.Recorder(), "openshift-config-managed", "router-certs", "openshift-authentication", "v4-0-config-system-router-certs", - sets.NewString(ingress.Spec.Domain), + sets.New(ingress.Spec.Domain), nil, ); err != nil { return err diff --git a/pkg/operator/starter.go b/pkg/operator/starter.go index 2ff7fbb82d..a2861a5371 100644 --- a/pkg/operator/starter.go +++ b/pkg/operator/starter.go @@ -638,12 +638,13 @@ func prepareOauthAPIServerOperator(ctx context.Context, controllerContext *contr v1helpers.CachedSecretGetter(operatorCtx.kubeClient.CoreV1(), operatorCtx.kubeInformersForNamespaces), ).WithAPIServiceController( "openshift-apiserver", + "openshift-oauth-apiserver", func() ([]*apiregistrationv1.APIService, []*apiregistrationv1.APIService, error) { return apiServices(), nil, nil }, apiregistrationInformers, apiregistrationv1Client.ApiregistrationV1(), - operatorCtx.kubeInformersForNamespaces.InformersFor("openshift-oauth-apiserver"), + operatorCtx.kubeInformersForNamespaces, operatorCtx.kubeClient, ).WithEncryptionControllers( "openshift-oauth-apiserver", diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go index 900c47c231..3da9ce044e 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/internal/internal.go @@ -285,7 +285,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -412,7 +414,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -499,7 +503,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -573,7 +579,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -650,7 +658,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -792,7 +802,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -1125,7 +1137,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: controlPlaneHardwareSpeed type: scalar: string @@ -1147,7 +1161,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.NodeStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - nodeName - name: observedGeneration type: scalar: numeric @@ -1408,12 +1424,30 @@ var schemaYAML = typed.YAMLObject(`types: - name: internalMasqueradeSubnet type: scalar: string +- name: com.github.openshift.api.operator.v1.IPv4OVNKubernetesConfig + map: + fields: + - name: internalJoinSubnet + type: + scalar: string + - name: internalTransitSwitchSubnet + type: + scalar: string - name: com.github.openshift.api.operator.v1.IPv6GatewayConfig map: fields: - name: internalMasqueradeSubnet type: scalar: string +- name: com.github.openshift.api.operator.v1.IPv6OVNKubernetesConfig + map: + fields: + - name: internalJoinSubnet + type: + scalar: string + - name: internalTransitSwitchSubnet + type: + scalar: string - name: com.github.openshift.api.operator.v1.IngressController map: fields: @@ -1757,7 +1791,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: gatherStatus type: namedType: com.github.openshift.api.operator.v1.GatherStatus @@ -1855,7 +1891,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -1873,7 +1911,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.NodeStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - nodeName - name: observedGeneration type: scalar: numeric @@ -1954,7 +1994,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -1972,7 +2014,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.NodeStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - nodeName - name: observedGeneration type: scalar: numeric @@ -2043,7 +2087,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2061,7 +2107,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.NodeStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - nodeName - name: observedGeneration type: scalar: numeric @@ -2122,7 +2170,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2231,10 +2281,18 @@ var schemaYAML = typed.YAMLObject(`types: - name: logLevel type: scalar: string + - name: managedBootImages + type: + namedType: com.github.openshift.api.operator.v1.ManagedBootImages + default: {} - name: managementState type: scalar: string default: "" + - name: nodeDisruptionPolicy + type: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyConfig + default: {} - name: observedConfig type: namedType: __untyped_atomic_ @@ -2257,7 +2315,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2270,12 +2330,18 @@ var schemaYAML = typed.YAMLObject(`types: - name: latestAvailableRevisionReason type: scalar: string + - name: nodeDisruptionPolicyStatus + type: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatus + default: {} - name: nodeStatuses type: list: elementType: namedType: com.github.openshift.api.operator.v1.NodeStatus - elementRelationship: atomic + elementRelationship: associative + keys: + - nodeName - name: observedGeneration type: scalar: numeric @@ -2286,6 +2352,48 @@ var schemaYAML = typed.YAMLObject(`types: - name: version type: scalar: string +- name: com.github.openshift.api.operator.v1.MachineManager + map: + fields: + - name: apiGroup + type: + scalar: string + default: "" + - name: resource + type: + scalar: string + default: "" + - name: selection + type: + namedType: com.github.openshift.api.operator.v1.MachineManagerSelector + default: {} +- name: com.github.openshift.api.operator.v1.MachineManagerSelector + map: + fields: + - name: mode + type: + scalar: string + default: "" + - name: partial + type: + namedType: com.github.openshift.api.operator.v1.PartialSelector + unions: + - discriminator: mode + fields: + - fieldName: partial + discriminatorValue: Partial +- name: com.github.openshift.api.operator.v1.ManagedBootImages + map: + fields: + - name: machineManagers + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.MachineManager + elementRelationship: associative + keys: + - resource + - apiGroup - name: com.github.openshift.api.operator.v1.NetFlowConfig map: fields: @@ -2405,7 +2513,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2422,6 +2532,169 @@ var schemaYAML = typed.YAMLObject(`types: - name: version type: scalar: string +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyClusterStatus + map: + fields: + - name: files + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusFile + elementRelationship: associative + keys: + - path + - name: sshkey + type: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusSSHKey + default: {} + - name: units + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusUnit + elementRelationship: associative + keys: + - name +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyConfig + map: + fields: + - name: files + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecFile + elementRelationship: associative + keys: + - path + - name: sshkey + type: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecSSHKey + default: {} + - name: units + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecUnit + elementRelationship: associative + keys: + - name +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecAction + map: + fields: + - name: reload + type: + namedType: com.github.openshift.api.operator.v1.ReloadService + - name: restart + type: + namedType: com.github.openshift.api.operator.v1.RestartService + - name: type + type: + scalar: string + default: "" + unions: + - discriminator: type + fields: + - fieldName: reload + discriminatorValue: Reload + - fieldName: restart + discriminatorValue: Restart +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecFile + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecAction + elementRelationship: atomic + - name: path + type: + scalar: string + default: "" +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecSSHKey + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecAction + elementRelationship: atomic +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecUnit + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicySpecAction + elementRelationship: atomic + - name: name + type: + scalar: string + default: "" +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatus + map: + fields: + - name: clusterPolicies + type: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyClusterStatus + default: {} +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusAction + map: + fields: + - name: reload + type: + namedType: com.github.openshift.api.operator.v1.ReloadService + - name: restart + type: + namedType: com.github.openshift.api.operator.v1.RestartService + - name: type + type: + scalar: string + default: "" + unions: + - discriminator: type + fields: + - fieldName: reload + discriminatorValue: Reload + - fieldName: restart + discriminatorValue: Restart +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusFile + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusAction + elementRelationship: atomic + - name: path + type: + scalar: string + default: "" +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusSSHKey + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusAction + elementRelationship: atomic +- name: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusUnit + map: + fields: + - name: actions + type: + list: + elementType: + namedType: com.github.openshift.api.operator.v1.NodeDisruptionPolicyStatusAction + elementRelationship: atomic + - name: name + type: + scalar: string + default: "" - name: com.github.openshift.api.operator.v1.NodePlacement map: fields: @@ -2502,6 +2775,12 @@ var schemaYAML = typed.YAMLObject(`types: namedType: com.github.openshift.api.operator.v1.IPsecConfig default: mode: Disabled + - name: ipv4 + type: + namedType: com.github.openshift.api.operator.v1.IPv4OVNKubernetesConfig + - name: ipv6 + type: + namedType: com.github.openshift.api.operator.v1.IPv6OVNKubernetesConfig - name: mtu type: scalar: numeric @@ -2564,7 +2843,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2634,7 +2915,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2691,6 +2974,12 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: com.github.openshift.api.operator.v1.PartialSelector + map: + fields: + - name: machineResourceSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - name: com.github.openshift.api.operator.v1.Perspective map: fields: @@ -2822,6 +3111,13 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic +- name: com.github.openshift.api.operator.v1.ReloadService + map: + fields: + - name: serviceName + type: + scalar: string + default: "" - name: com.github.openshift.api.operator.v1.ResourceAttributesAccessReview map: fields: @@ -2837,6 +3133,13 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.authorization.v1.ResourceAttributes elementRelationship: atomic +- name: com.github.openshift.api.operator.v1.RestartService + map: + fields: + - name: serviceName + type: + scalar: string + default: "" - name: com.github.openshift.api.operator.v1.RouteAdmissionPolicy map: fields: @@ -2932,7 +3235,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -2999,7 +3304,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -3066,7 +3373,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -3215,7 +3524,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: @@ -3420,7 +3731,9 @@ var schemaYAML = typed.YAMLObject(`types: list: elementType: namedType: com.github.openshift.api.operator.v1.OperatorCondition - elementRelationship: atomic + elementRelationship: associative + keys: + - type - name: generations type: list: diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv4ovnkubernetesconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv4ovnkubernetesconfig.go new file mode 100644 index 0000000000..3ef86fcb47 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv4ovnkubernetesconfig.go @@ -0,0 +1,32 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// IPv4OVNKubernetesConfigApplyConfiguration represents an declarative configuration of the IPv4OVNKubernetesConfig type for use +// with apply. +type IPv4OVNKubernetesConfigApplyConfiguration struct { + InternalTransitSwitchSubnet *string `json:"internalTransitSwitchSubnet,omitempty"` + InternalJoinSubnet *string `json:"internalJoinSubnet,omitempty"` +} + +// IPv4OVNKubernetesConfigApplyConfiguration constructs an declarative configuration of the IPv4OVNKubernetesConfig type for use with +// apply. +func IPv4OVNKubernetesConfig() *IPv4OVNKubernetesConfigApplyConfiguration { + return &IPv4OVNKubernetesConfigApplyConfiguration{} +} + +// WithInternalTransitSwitchSubnet sets the InternalTransitSwitchSubnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalTransitSwitchSubnet field is set to the value of the last call. +func (b *IPv4OVNKubernetesConfigApplyConfiguration) WithInternalTransitSwitchSubnet(value string) *IPv4OVNKubernetesConfigApplyConfiguration { + b.InternalTransitSwitchSubnet = &value + return b +} + +// WithInternalJoinSubnet sets the InternalJoinSubnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalJoinSubnet field is set to the value of the last call. +func (b *IPv4OVNKubernetesConfigApplyConfiguration) WithInternalJoinSubnet(value string) *IPv4OVNKubernetesConfigApplyConfiguration { + b.InternalJoinSubnet = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv6ovnkubernetesconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv6ovnkubernetesconfig.go new file mode 100644 index 0000000000..f982551e00 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ipv6ovnkubernetesconfig.go @@ -0,0 +1,32 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// IPv6OVNKubernetesConfigApplyConfiguration represents an declarative configuration of the IPv6OVNKubernetesConfig type for use +// with apply. +type IPv6OVNKubernetesConfigApplyConfiguration struct { + InternalTransitSwitchSubnet *string `json:"internalTransitSwitchSubnet,omitempty"` + InternalJoinSubnet *string `json:"internalJoinSubnet,omitempty"` +} + +// IPv6OVNKubernetesConfigApplyConfiguration constructs an declarative configuration of the IPv6OVNKubernetesConfig type for use with +// apply. +func IPv6OVNKubernetesConfig() *IPv6OVNKubernetesConfigApplyConfiguration { + return &IPv6OVNKubernetesConfigApplyConfiguration{} +} + +// WithInternalTransitSwitchSubnet sets the InternalTransitSwitchSubnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalTransitSwitchSubnet field is set to the value of the last call. +func (b *IPv6OVNKubernetesConfigApplyConfiguration) WithInternalTransitSwitchSubnet(value string) *IPv6OVNKubernetesConfigApplyConfiguration { + b.InternalTransitSwitchSubnet = &value + return b +} + +// WithInternalJoinSubnet sets the InternalJoinSubnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalJoinSubnet field is set to the value of the last call. +func (b *IPv6OVNKubernetesConfigApplyConfiguration) WithInternalJoinSubnet(value string) *IPv6OVNKubernetesConfigApplyConfiguration { + b.InternalJoinSubnet = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationspec.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationspec.go index 4ca52827eb..c86b116b4d 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationspec.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationspec.go @@ -11,6 +11,8 @@ import ( // with apply. type MachineConfigurationSpecApplyConfiguration struct { StaticPodOperatorSpecApplyConfiguration `json:",inline"` + ManagedBootImages *ManagedBootImagesApplyConfiguration `json:"managedBootImages,omitempty"` + NodeDisruptionPolicy *NodeDisruptionPolicyConfigApplyConfiguration `json:"nodeDisruptionPolicy,omitempty"` } // MachineConfigurationSpecApplyConfiguration constructs an declarative configuration of the MachineConfigurationSpec type for use with @@ -82,3 +84,19 @@ func (b *MachineConfigurationSpecApplyConfiguration) WithSucceededRevisionLimit( b.SucceededRevisionLimit = &value return b } + +// WithManagedBootImages sets the ManagedBootImages field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ManagedBootImages field is set to the value of the last call. +func (b *MachineConfigurationSpecApplyConfiguration) WithManagedBootImages(value *ManagedBootImagesApplyConfiguration) *MachineConfigurationSpecApplyConfiguration { + b.ManagedBootImages = value + return b +} + +// WithNodeDisruptionPolicy sets the NodeDisruptionPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDisruptionPolicy field is set to the value of the last call. +func (b *MachineConfigurationSpecApplyConfiguration) WithNodeDisruptionPolicy(value *NodeDisruptionPolicyConfigApplyConfiguration) *MachineConfigurationSpecApplyConfiguration { + b.NodeDisruptionPolicy = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationstatus.go index 5740627b4b..b822970c42 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationstatus.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machineconfigurationstatus.go @@ -6,6 +6,7 @@ package v1 // with apply. type MachineConfigurationStatusApplyConfiguration struct { StaticPodOperatorStatusApplyConfiguration `json:",inline"` + NodeDisruptionPolicyStatus *NodeDisruptionPolicyStatusApplyConfiguration `json:"nodeDisruptionPolicyStatus,omitempty"` } // MachineConfigurationStatusApplyConfiguration constructs an declarative configuration of the MachineConfigurationStatus type for use with @@ -92,3 +93,11 @@ func (b *MachineConfigurationStatusApplyConfiguration) WithNodeStatuses(values . } return b } + +// WithNodeDisruptionPolicyStatus sets the NodeDisruptionPolicyStatus field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeDisruptionPolicyStatus field is set to the value of the last call. +func (b *MachineConfigurationStatusApplyConfiguration) WithNodeDisruptionPolicyStatus(value *NodeDisruptionPolicyStatusApplyConfiguration) *MachineConfigurationStatusApplyConfiguration { + b.NodeDisruptionPolicyStatus = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanager.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanager.go new file mode 100644 index 0000000000..d5df7be5b9 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanager.go @@ -0,0 +1,45 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// MachineManagerApplyConfiguration represents an declarative configuration of the MachineManager type for use +// with apply. +type MachineManagerApplyConfiguration struct { + Resource *v1.MachineManagerMachineSetsResourceType `json:"resource,omitempty"` + APIGroup *v1.MachineManagerMachineSetsAPIGroupType `json:"apiGroup,omitempty"` + Selection *MachineManagerSelectorApplyConfiguration `json:"selection,omitempty"` +} + +// MachineManagerApplyConfiguration constructs an declarative configuration of the MachineManager type for use with +// apply. +func MachineManager() *MachineManagerApplyConfiguration { + return &MachineManagerApplyConfiguration{} +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *MachineManagerApplyConfiguration) WithResource(value v1.MachineManagerMachineSetsResourceType) *MachineManagerApplyConfiguration { + b.Resource = &value + return b +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *MachineManagerApplyConfiguration) WithAPIGroup(value v1.MachineManagerMachineSetsAPIGroupType) *MachineManagerApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithSelection sets the Selection field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selection field is set to the value of the last call. +func (b *MachineManagerApplyConfiguration) WithSelection(value *MachineManagerSelectorApplyConfiguration) *MachineManagerApplyConfiguration { + b.Selection = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanagerselector.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanagerselector.go new file mode 100644 index 0000000000..3bf14dc0a3 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/machinemanagerselector.go @@ -0,0 +1,36 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// MachineManagerSelectorApplyConfiguration represents an declarative configuration of the MachineManagerSelector type for use +// with apply. +type MachineManagerSelectorApplyConfiguration struct { + Mode *v1.MachineManagerSelectorMode `json:"mode,omitempty"` + Partial *PartialSelectorApplyConfiguration `json:"partial,omitempty"` +} + +// MachineManagerSelectorApplyConfiguration constructs an declarative configuration of the MachineManagerSelector type for use with +// apply. +func MachineManagerSelector() *MachineManagerSelectorApplyConfiguration { + return &MachineManagerSelectorApplyConfiguration{} +} + +// WithMode sets the Mode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mode field is set to the value of the last call. +func (b *MachineManagerSelectorApplyConfiguration) WithMode(value v1.MachineManagerSelectorMode) *MachineManagerSelectorApplyConfiguration { + b.Mode = &value + return b +} + +// WithPartial sets the Partial field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Partial field is set to the value of the last call. +func (b *MachineManagerSelectorApplyConfiguration) WithPartial(value *PartialSelectorApplyConfiguration) *MachineManagerSelectorApplyConfiguration { + b.Partial = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/managedbootimages.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/managedbootimages.go new file mode 100644 index 0000000000..44ca06ad23 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/managedbootimages.go @@ -0,0 +1,28 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ManagedBootImagesApplyConfiguration represents an declarative configuration of the ManagedBootImages type for use +// with apply. +type ManagedBootImagesApplyConfiguration struct { + MachineManagers []MachineManagerApplyConfiguration `json:"machineManagers,omitempty"` +} + +// ManagedBootImagesApplyConfiguration constructs an declarative configuration of the ManagedBootImages type for use with +// apply. +func ManagedBootImages() *ManagedBootImagesApplyConfiguration { + return &ManagedBootImagesApplyConfiguration{} +} + +// WithMachineManagers adds the given value to the MachineManagers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MachineManagers field. +func (b *ManagedBootImagesApplyConfiguration) WithMachineManagers(values ...*MachineManagerApplyConfiguration) *ManagedBootImagesApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMachineManagers") + } + b.MachineManagers = append(b.MachineManagers, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyclusterstatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyclusterstatus.go new file mode 100644 index 0000000000..c4f02072dd --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyclusterstatus.go @@ -0,0 +1,51 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicyClusterStatusApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyClusterStatus type for use +// with apply. +type NodeDisruptionPolicyClusterStatusApplyConfiguration struct { + Files []NodeDisruptionPolicyStatusFileApplyConfiguration `json:"files,omitempty"` + Units []NodeDisruptionPolicyStatusUnitApplyConfiguration `json:"units,omitempty"` + SSHKey *NodeDisruptionPolicyStatusSSHKeyApplyConfiguration `json:"sshkey,omitempty"` +} + +// NodeDisruptionPolicyClusterStatusApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyClusterStatus type for use with +// apply. +func NodeDisruptionPolicyClusterStatus() *NodeDisruptionPolicyClusterStatusApplyConfiguration { + return &NodeDisruptionPolicyClusterStatusApplyConfiguration{} +} + +// WithFiles adds the given value to the Files field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Files field. +func (b *NodeDisruptionPolicyClusterStatusApplyConfiguration) WithFiles(values ...*NodeDisruptionPolicyStatusFileApplyConfiguration) *NodeDisruptionPolicyClusterStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithFiles") + } + b.Files = append(b.Files, *values[i]) + } + return b +} + +// WithUnits adds the given value to the Units field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Units field. +func (b *NodeDisruptionPolicyClusterStatusApplyConfiguration) WithUnits(values ...*NodeDisruptionPolicyStatusUnitApplyConfiguration) *NodeDisruptionPolicyClusterStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnits") + } + b.Units = append(b.Units, *values[i]) + } + return b +} + +// WithSSHKey sets the SSHKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SSHKey field is set to the value of the last call. +func (b *NodeDisruptionPolicyClusterStatusApplyConfiguration) WithSSHKey(value *NodeDisruptionPolicyStatusSSHKeyApplyConfiguration) *NodeDisruptionPolicyClusterStatusApplyConfiguration { + b.SSHKey = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyconfig.go new file mode 100644 index 0000000000..d081a231fa --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyconfig.go @@ -0,0 +1,51 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicyConfigApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyConfig type for use +// with apply. +type NodeDisruptionPolicyConfigApplyConfiguration struct { + Files []NodeDisruptionPolicySpecFileApplyConfiguration `json:"files,omitempty"` + Units []NodeDisruptionPolicySpecUnitApplyConfiguration `json:"units,omitempty"` + SSHKey *NodeDisruptionPolicySpecSSHKeyApplyConfiguration `json:"sshkey,omitempty"` +} + +// NodeDisruptionPolicyConfigApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyConfig type for use with +// apply. +func NodeDisruptionPolicyConfig() *NodeDisruptionPolicyConfigApplyConfiguration { + return &NodeDisruptionPolicyConfigApplyConfiguration{} +} + +// WithFiles adds the given value to the Files field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Files field. +func (b *NodeDisruptionPolicyConfigApplyConfiguration) WithFiles(values ...*NodeDisruptionPolicySpecFileApplyConfiguration) *NodeDisruptionPolicyConfigApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithFiles") + } + b.Files = append(b.Files, *values[i]) + } + return b +} + +// WithUnits adds the given value to the Units field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Units field. +func (b *NodeDisruptionPolicyConfigApplyConfiguration) WithUnits(values ...*NodeDisruptionPolicySpecUnitApplyConfiguration) *NodeDisruptionPolicyConfigApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithUnits") + } + b.Units = append(b.Units, *values[i]) + } + return b +} + +// WithSSHKey sets the SSHKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SSHKey field is set to the value of the last call. +func (b *NodeDisruptionPolicyConfigApplyConfiguration) WithSSHKey(value *NodeDisruptionPolicySpecSSHKeyApplyConfiguration) *NodeDisruptionPolicyConfigApplyConfiguration { + b.SSHKey = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecaction.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecaction.go new file mode 100644 index 0000000000..d22613bc2a --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecaction.go @@ -0,0 +1,45 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// NodeDisruptionPolicySpecActionApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicySpecAction type for use +// with apply. +type NodeDisruptionPolicySpecActionApplyConfiguration struct { + Type *v1.NodeDisruptionPolicySpecActionType `json:"type,omitempty"` + Reload *ReloadServiceApplyConfiguration `json:"reload,omitempty"` + Restart *RestartServiceApplyConfiguration `json:"restart,omitempty"` +} + +// NodeDisruptionPolicySpecActionApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicySpecAction type for use with +// apply. +func NodeDisruptionPolicySpecAction() *NodeDisruptionPolicySpecActionApplyConfiguration { + return &NodeDisruptionPolicySpecActionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NodeDisruptionPolicySpecActionApplyConfiguration) WithType(value v1.NodeDisruptionPolicySpecActionType) *NodeDisruptionPolicySpecActionApplyConfiguration { + b.Type = &value + return b +} + +// WithReload sets the Reload field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reload field is set to the value of the last call. +func (b *NodeDisruptionPolicySpecActionApplyConfiguration) WithReload(value *ReloadServiceApplyConfiguration) *NodeDisruptionPolicySpecActionApplyConfiguration { + b.Reload = value + return b +} + +// WithRestart sets the Restart field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Restart field is set to the value of the last call. +func (b *NodeDisruptionPolicySpecActionApplyConfiguration) WithRestart(value *RestartServiceApplyConfiguration) *NodeDisruptionPolicySpecActionApplyConfiguration { + b.Restart = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecfile.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecfile.go new file mode 100644 index 0000000000..c6dfbe44d0 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecfile.go @@ -0,0 +1,37 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicySpecFileApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicySpecFile type for use +// with apply. +type NodeDisruptionPolicySpecFileApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Actions []NodeDisruptionPolicySpecActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicySpecFileApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicySpecFile type for use with +// apply. +func NodeDisruptionPolicySpecFile() *NodeDisruptionPolicySpecFileApplyConfiguration { + return &NodeDisruptionPolicySpecFileApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *NodeDisruptionPolicySpecFileApplyConfiguration) WithPath(value string) *NodeDisruptionPolicySpecFileApplyConfiguration { + b.Path = &value + return b +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicySpecFileApplyConfiguration) WithActions(values ...*NodeDisruptionPolicySpecActionApplyConfiguration) *NodeDisruptionPolicySpecFileApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecsshkey.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecsshkey.go new file mode 100644 index 0000000000..4f4198eafa --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecsshkey.go @@ -0,0 +1,28 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicySpecSSHKeyApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicySpecSSHKey type for use +// with apply. +type NodeDisruptionPolicySpecSSHKeyApplyConfiguration struct { + Actions []NodeDisruptionPolicySpecActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicySpecSSHKeyApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicySpecSSHKey type for use with +// apply. +func NodeDisruptionPolicySpecSSHKey() *NodeDisruptionPolicySpecSSHKeyApplyConfiguration { + return &NodeDisruptionPolicySpecSSHKeyApplyConfiguration{} +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicySpecSSHKeyApplyConfiguration) WithActions(values ...*NodeDisruptionPolicySpecActionApplyConfiguration) *NodeDisruptionPolicySpecSSHKeyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecunit.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecunit.go new file mode 100644 index 0000000000..2e8859e91a --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicyspecunit.go @@ -0,0 +1,41 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// NodeDisruptionPolicySpecUnitApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicySpecUnit type for use +// with apply. +type NodeDisruptionPolicySpecUnitApplyConfiguration struct { + Name *v1.NodeDisruptionPolicyServiceName `json:"name,omitempty"` + Actions []NodeDisruptionPolicySpecActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicySpecUnitApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicySpecUnit type for use with +// apply. +func NodeDisruptionPolicySpecUnit() *NodeDisruptionPolicySpecUnitApplyConfiguration { + return &NodeDisruptionPolicySpecUnitApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NodeDisruptionPolicySpecUnitApplyConfiguration) WithName(value v1.NodeDisruptionPolicyServiceName) *NodeDisruptionPolicySpecUnitApplyConfiguration { + b.Name = &value + return b +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicySpecUnitApplyConfiguration) WithActions(values ...*NodeDisruptionPolicySpecActionApplyConfiguration) *NodeDisruptionPolicySpecUnitApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatus.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatus.go new file mode 100644 index 0000000000..c0fddc55bb --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatus.go @@ -0,0 +1,23 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicyStatusApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyStatus type for use +// with apply. +type NodeDisruptionPolicyStatusApplyConfiguration struct { + ClusterPolicies *NodeDisruptionPolicyClusterStatusApplyConfiguration `json:"clusterPolicies,omitempty"` +} + +// NodeDisruptionPolicyStatusApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyStatus type for use with +// apply. +func NodeDisruptionPolicyStatus() *NodeDisruptionPolicyStatusApplyConfiguration { + return &NodeDisruptionPolicyStatusApplyConfiguration{} +} + +// WithClusterPolicies sets the ClusterPolicies field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterPolicies field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusApplyConfiguration) WithClusterPolicies(value *NodeDisruptionPolicyClusterStatusApplyConfiguration) *NodeDisruptionPolicyStatusApplyConfiguration { + b.ClusterPolicies = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusaction.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusaction.go new file mode 100644 index 0000000000..a97f47c38a --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusaction.go @@ -0,0 +1,45 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// NodeDisruptionPolicyStatusActionApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyStatusAction type for use +// with apply. +type NodeDisruptionPolicyStatusActionApplyConfiguration struct { + Type *v1.NodeDisruptionPolicyStatusActionType `json:"type,omitempty"` + Reload *ReloadServiceApplyConfiguration `json:"reload,omitempty"` + Restart *RestartServiceApplyConfiguration `json:"restart,omitempty"` +} + +// NodeDisruptionPolicyStatusActionApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyStatusAction type for use with +// apply. +func NodeDisruptionPolicyStatusAction() *NodeDisruptionPolicyStatusActionApplyConfiguration { + return &NodeDisruptionPolicyStatusActionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusActionApplyConfiguration) WithType(value v1.NodeDisruptionPolicyStatusActionType) *NodeDisruptionPolicyStatusActionApplyConfiguration { + b.Type = &value + return b +} + +// WithReload sets the Reload field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reload field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusActionApplyConfiguration) WithReload(value *ReloadServiceApplyConfiguration) *NodeDisruptionPolicyStatusActionApplyConfiguration { + b.Reload = value + return b +} + +// WithRestart sets the Restart field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Restart field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusActionApplyConfiguration) WithRestart(value *RestartServiceApplyConfiguration) *NodeDisruptionPolicyStatusActionApplyConfiguration { + b.Restart = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusfile.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusfile.go new file mode 100644 index 0000000000..3ddc30cf19 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusfile.go @@ -0,0 +1,37 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicyStatusFileApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyStatusFile type for use +// with apply. +type NodeDisruptionPolicyStatusFileApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Actions []NodeDisruptionPolicyStatusActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicyStatusFileApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyStatusFile type for use with +// apply. +func NodeDisruptionPolicyStatusFile() *NodeDisruptionPolicyStatusFileApplyConfiguration { + return &NodeDisruptionPolicyStatusFileApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusFileApplyConfiguration) WithPath(value string) *NodeDisruptionPolicyStatusFileApplyConfiguration { + b.Path = &value + return b +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicyStatusFileApplyConfiguration) WithActions(values ...*NodeDisruptionPolicyStatusActionApplyConfiguration) *NodeDisruptionPolicyStatusFileApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatussshkey.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatussshkey.go new file mode 100644 index 0000000000..3c29be9c4c --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatussshkey.go @@ -0,0 +1,28 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NodeDisruptionPolicyStatusSSHKeyApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyStatusSSHKey type for use +// with apply. +type NodeDisruptionPolicyStatusSSHKeyApplyConfiguration struct { + Actions []NodeDisruptionPolicyStatusActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicyStatusSSHKeyApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyStatusSSHKey type for use with +// apply. +func NodeDisruptionPolicyStatusSSHKey() *NodeDisruptionPolicyStatusSSHKeyApplyConfiguration { + return &NodeDisruptionPolicyStatusSSHKeyApplyConfiguration{} +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicyStatusSSHKeyApplyConfiguration) WithActions(values ...*NodeDisruptionPolicyStatusActionApplyConfiguration) *NodeDisruptionPolicyStatusSSHKeyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusunit.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusunit.go new file mode 100644 index 0000000000..dec525c253 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/nodedisruptionpolicystatusunit.go @@ -0,0 +1,41 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// NodeDisruptionPolicyStatusUnitApplyConfiguration represents an declarative configuration of the NodeDisruptionPolicyStatusUnit type for use +// with apply. +type NodeDisruptionPolicyStatusUnitApplyConfiguration struct { + Name *v1.NodeDisruptionPolicyServiceName `json:"name,omitempty"` + Actions []NodeDisruptionPolicyStatusActionApplyConfiguration `json:"actions,omitempty"` +} + +// NodeDisruptionPolicyStatusUnitApplyConfiguration constructs an declarative configuration of the NodeDisruptionPolicyStatusUnit type for use with +// apply. +func NodeDisruptionPolicyStatusUnit() *NodeDisruptionPolicyStatusUnitApplyConfiguration { + return &NodeDisruptionPolicyStatusUnitApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NodeDisruptionPolicyStatusUnitApplyConfiguration) WithName(value v1.NodeDisruptionPolicyServiceName) *NodeDisruptionPolicyStatusUnitApplyConfiguration { + b.Name = &value + return b +} + +// WithActions adds the given value to the Actions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Actions field. +func (b *NodeDisruptionPolicyStatusUnitApplyConfiguration) WithActions(values ...*NodeDisruptionPolicyStatusActionApplyConfiguration) *NodeDisruptionPolicyStatusUnitApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActions") + } + b.Actions = append(b.Actions, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go index 61701f52c6..625549d735 100644 --- a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/ovnkubernetesconfig.go @@ -5,15 +5,17 @@ package v1 // OVNKubernetesConfigApplyConfiguration represents an declarative configuration of the OVNKubernetesConfig type for use // with apply. type OVNKubernetesConfigApplyConfiguration struct { - MTU *uint32 `json:"mtu,omitempty"` - GenevePort *uint32 `json:"genevePort,omitempty"` - HybridOverlayConfig *HybridOverlayConfigApplyConfiguration `json:"hybridOverlayConfig,omitempty"` - IPsecConfig *IPsecConfigApplyConfiguration `json:"ipsecConfig,omitempty"` - PolicyAuditConfig *PolicyAuditConfigApplyConfiguration `json:"policyAuditConfig,omitempty"` - GatewayConfig *GatewayConfigApplyConfiguration `json:"gatewayConfig,omitempty"` - V4InternalSubnet *string `json:"v4InternalSubnet,omitempty"` - V6InternalSubnet *string `json:"v6InternalSubnet,omitempty"` - EgressIPConfig *EgressIPConfigApplyConfiguration `json:"egressIPConfig,omitempty"` + MTU *uint32 `json:"mtu,omitempty"` + GenevePort *uint32 `json:"genevePort,omitempty"` + HybridOverlayConfig *HybridOverlayConfigApplyConfiguration `json:"hybridOverlayConfig,omitempty"` + IPsecConfig *IPsecConfigApplyConfiguration `json:"ipsecConfig,omitempty"` + PolicyAuditConfig *PolicyAuditConfigApplyConfiguration `json:"policyAuditConfig,omitempty"` + GatewayConfig *GatewayConfigApplyConfiguration `json:"gatewayConfig,omitempty"` + V4InternalSubnet *string `json:"v4InternalSubnet,omitempty"` + V6InternalSubnet *string `json:"v6InternalSubnet,omitempty"` + EgressIPConfig *EgressIPConfigApplyConfiguration `json:"egressIPConfig,omitempty"` + IPv4 *IPv4OVNKubernetesConfigApplyConfiguration `json:"ipv4,omitempty"` + IPv6 *IPv6OVNKubernetesConfigApplyConfiguration `json:"ipv6,omitempty"` } // OVNKubernetesConfigApplyConfiguration constructs an declarative configuration of the OVNKubernetesConfig type for use with @@ -93,3 +95,19 @@ func (b *OVNKubernetesConfigApplyConfiguration) WithEgressIPConfig(value *Egress b.EgressIPConfig = value return b } + +// WithIPv4 sets the IPv4 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPv4 field is set to the value of the last call. +func (b *OVNKubernetesConfigApplyConfiguration) WithIPv4(value *IPv4OVNKubernetesConfigApplyConfiguration) *OVNKubernetesConfigApplyConfiguration { + b.IPv4 = value + return b +} + +// WithIPv6 sets the IPv6 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPv6 field is set to the value of the last call. +func (b *OVNKubernetesConfigApplyConfiguration) WithIPv6(value *IPv6OVNKubernetesConfigApplyConfiguration) *OVNKubernetesConfigApplyConfiguration { + b.IPv6 = value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/partialselector.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/partialselector.go new file mode 100644 index 0000000000..ea7b7ffbe3 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/partialselector.go @@ -0,0 +1,27 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PartialSelectorApplyConfiguration represents an declarative configuration of the PartialSelector type for use +// with apply. +type PartialSelectorApplyConfiguration struct { + MachineResourceSelector *v1.LabelSelector `json:"machineResourceSelector,omitempty"` +} + +// PartialSelectorApplyConfiguration constructs an declarative configuration of the PartialSelector type for use with +// apply. +func PartialSelector() *PartialSelectorApplyConfiguration { + return &PartialSelectorApplyConfiguration{} +} + +// WithMachineResourceSelector sets the MachineResourceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineResourceSelector field is set to the value of the last call. +func (b *PartialSelectorApplyConfiguration) WithMachineResourceSelector(value v1.LabelSelector) *PartialSelectorApplyConfiguration { + b.MachineResourceSelector = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/reloadservice.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/reloadservice.go new file mode 100644 index 0000000000..22eee62c29 --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/reloadservice.go @@ -0,0 +1,27 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// ReloadServiceApplyConfiguration represents an declarative configuration of the ReloadService type for use +// with apply. +type ReloadServiceApplyConfiguration struct { + ServiceName *v1.NodeDisruptionPolicyServiceName `json:"serviceName,omitempty"` +} + +// ReloadServiceApplyConfiguration constructs an declarative configuration of the ReloadService type for use with +// apply. +func ReloadService() *ReloadServiceApplyConfiguration { + return &ReloadServiceApplyConfiguration{} +} + +// WithServiceName sets the ServiceName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceName field is set to the value of the last call. +func (b *ReloadServiceApplyConfiguration) WithServiceName(value v1.NodeDisruptionPolicyServiceName) *ReloadServiceApplyConfiguration { + b.ServiceName = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/restartservice.go b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/restartservice.go new file mode 100644 index 0000000000..c4fcd5f04e --- /dev/null +++ b/vendor/github.com/openshift/client-go/operator/applyconfigurations/operator/v1/restartservice.go @@ -0,0 +1,27 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/openshift/api/operator/v1" +) + +// RestartServiceApplyConfiguration represents an declarative configuration of the RestartService type for use +// with apply. +type RestartServiceApplyConfiguration struct { + ServiceName *v1.NodeDisruptionPolicyServiceName `json:"serviceName,omitempty"` +} + +// RestartServiceApplyConfiguration constructs an declarative configuration of the RestartService type for use with +// apply. +func RestartService() *RestartServiceApplyConfiguration { + return &RestartServiceApplyConfiguration{} +} + +// WithServiceName sets the ServiceName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceName field is set to the value of the last call. +func (b *RestartServiceApplyConfiguration) WithServiceName(value v1.NodeDisruptionPolicyServiceName) *RestartServiceApplyConfiguration { + b.ServiceName = &value + return b +} diff --git a/vendor/github.com/openshift/library-go/pkg/assets/assets.go b/vendor/github.com/openshift/library-go/pkg/assets/assets.go index 93747f8f5f..b364054e3e 100644 --- a/vendor/github.com/openshift/library-go/pkg/assets/assets.go +++ b/vendor/github.com/openshift/library-go/pkg/assets/assets.go @@ -2,7 +2,6 @@ package assets import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -98,7 +97,7 @@ func (a Asset) WriteFile(path string) error { perms = a.FilePermission } fmt.Printf("Writing asset: %s\n", f) - return ioutil.WriteFile(f, a.Data, os.FileMode(perms)) + return os.WriteFile(f, a.Data, os.FileMode(perms)) } // MustCreateAssetFromTemplate process the given template using and return an asset. @@ -170,7 +169,7 @@ func LoadFilesRecursively(dir string, predicates ...FileInfoPredicate) (map[stri } } - bs, err := ioutil.ReadFile(path) + bs, err := os.ReadFile(path) if err != nil { return err } diff --git a/vendor/github.com/openshift/library-go/pkg/authentication/bootstrapauthenticator/bootstrap.go b/vendor/github.com/openshift/library-go/pkg/authentication/bootstrapauthenticator/bootstrap.go index c2c6b1f6b4..be556b7ef1 100644 --- a/vendor/github.com/openshift/library-go/pkg/authentication/bootstrapauthenticator/bootstrap.go +++ b/vendor/github.com/openshift/library-go/pkg/authentication/bootstrapauthenticator/bootstrap.go @@ -54,13 +54,13 @@ type Password interface { func New(getter BootstrapUserDataGetter) Password { return &bootstrapPassword{ getter: getter, - names: sets.NewString(BootstrapUser, bootstrapUserBasicAuth), + names: sets.New(BootstrapUser, bootstrapUserBasicAuth), } } type bootstrapPassword struct { getter BootstrapUserDataGetter - names sets.String + names sets.Set[string] } func (b *bootstrapPassword) AuthenticatePassword(ctx context.Context, username, password string) (*authenticator.Response, bool, error) { diff --git a/vendor/github.com/openshift/library-go/pkg/certs/pem.go b/vendor/github.com/openshift/library-go/pkg/certs/pem.go index c3f7ff3065..50e8a28a53 100644 --- a/vendor/github.com/openshift/library-go/pkg/certs/pem.go +++ b/vendor/github.com/openshift/library-go/pkg/certs/pem.go @@ -3,7 +3,6 @@ package certs import ( "bytes" "encoding/pem" - "io/ioutil" "os" "path/filepath" ) @@ -16,7 +15,7 @@ const ( ) func BlockFromFile(path string, blockType string) (*pem.Block, bool, error) { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, false, err } @@ -45,7 +44,7 @@ func BlockToFile(path string, block *pem.Block, mode os.FileMode) error { if err := os.MkdirAll(filepath.Dir(path), os.FileMode(0755)); err != nil { return err } - return ioutil.WriteFile(path, b, mode) + return os.WriteFile(path, b, mode) } func BlockToBytes(block *pem.Block) ([]byte, error) { diff --git a/vendor/github.com/openshift/library-go/pkg/config/client/client_config.go b/vendor/github.com/openshift/library-go/pkg/config/client/client_config.go index e2b90ca531..f632794604 100644 --- a/vendor/github.com/openshift/library-go/pkg/config/client/client_config.go +++ b/vendor/github.com/openshift/library-go/pkg/config/client/client_config.go @@ -1,10 +1,11 @@ package client import ( - "io/ioutil" + "net/http" + "os" + "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - "net/http" configv1 "github.com/openshift/api/config/v1" "github.com/openshift/library-go/pkg/network" @@ -35,7 +36,7 @@ func GetKubeConfigOrInClusterConfig(kubeConfigFile string, overrides *ClientConn // GetClientConfig returns the rest.Config for a kubeconfig file func GetClientConfig(kubeConfigFile string, overrides *ClientConnectionOverrides) (*rest.Config, error) { - kubeConfigBytes, err := ioutil.ReadFile(kubeConfigFile) + kubeConfigBytes, err := os.ReadFile(kubeConfigFile) if err != nil { return nil, err } diff --git a/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go b/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go index b22671f744..3142315a6d 100644 --- a/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go +++ b/vendor/github.com/openshift/library-go/pkg/config/leaderelection/leaderelection.go @@ -2,7 +2,6 @@ package leaderelection import ( "fmt" - "io/ioutil" "math" "os" "strings" @@ -132,7 +131,7 @@ func LeaderElectionDefaulting(config configv1.LeaderElection, defaultNamespace, ret.Namespace = defaultNamespace } else { // Fall back to the namespace associated with the service account token, if available - if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { + if data, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil { if ns := strings.TrimSpace(string(data)); len(ns) > 0 { ret.Namespace = ns } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go index fbf84acd29..051cc3bf0e 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/builder.go @@ -3,7 +3,6 @@ package controllercmd import ( "context" "fmt" - "io/ioutil" "os" "strings" "sync" @@ -413,7 +412,7 @@ func (b *ControllerBuilder) getComponentNamespace() (string, error) { if len(b.componentNamespace) > 0 { return b.componentNamespace, nil } - nsBytes, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") + nsBytes, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace") if err != nil { return "openshift-config-managed", err } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go index 23c67c365d..9849baae09 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/cmd.go @@ -3,7 +3,6 @@ package controllercmd import ( "context" "fmt" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -150,7 +149,7 @@ func (c *ControllerCommandConfig) NewCommandWithContext(ctx context.Context) *co } files := map[string][]byte{} for _, fn := range c.basicFlags.TerminateOnFiles { - fileBytes, err := ioutil.ReadFile(fn) + fileBytes, err := os.ReadFile(fn) if err != nil { klog.Warningf("Unable to read initial content of %q: %v", fn, err) continue // intentionally ignore errors @@ -248,7 +247,7 @@ func (c *ControllerCommandConfig) AddDefaultRotationToConfig(config *operatorv1a startingFileContent[filepath.Join(certDir, "tls.crt")] = []byte{} startingFileContent[filepath.Join(certDir, "tls.key")] = []byte{} - temporaryCertDir, err := ioutil.TempDir("", "serving-cert-") + temporaryCertDir, err := os.MkdirTemp("", "serving-cert-") if err != nil { return nil, nil, err } @@ -268,7 +267,7 @@ func (c *ControllerCommandConfig) AddDefaultRotationToConfig(config *operatorv1a config.ServingInfo.CertFile = filepath.Join(temporaryCertDir, "tls.crt") config.ServingInfo.KeyFile = filepath.Join(temporaryCertDir, "tls.key") // nothing can trust this, so we don't really care about hostnames - servingCert, err := ca.MakeServerCert(sets.NewString("localhost"), 30) + servingCert, err := ca.MakeServerCert(sets.New("localhost"), 30) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/flags.go b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/flags.go index d83fe7d451..da326cb216 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/flags.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/controllercmd/flags.go @@ -3,7 +3,7 @@ package controllercmd import ( "encoding/json" "fmt" - "io/ioutil" + "os" "github.com/spf13/cobra" @@ -62,7 +62,7 @@ func (f *ControllerFlags) ToConfigObj() ([]byte, *unstructured.Unstructured, err return nil, nil, nil } - content, err := ioutil.ReadFile(f.ConfigFile) + content, err := os.ReadFile(f.ConfigFile) if err != nil { return nil, nil, err } @@ -105,7 +105,7 @@ func ReadYAML(data []byte, configScheme *runtime.Scheme, versions ...schema.Grou // ReadYAMLFile read a file and decodes a runtime.Object from the provided scheme func ReadYAMLFile(filename string, configScheme *runtime.Scheme, versions ...schema.GroupVersion) (runtime.Object, error) { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return nil, err } diff --git a/vendor/github.com/openshift/library-go/pkg/controller/factory/controller_context.go b/vendor/github.com/openshift/library-go/pkg/controller/factory/controller_context.go index 3c585e40af..15b8bdf706 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/factory/controller_context.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/factory/controller_context.go @@ -96,7 +96,7 @@ func (c syncContext) enqueueKeys(keys ...string) { // (or its tombstone) is a namespace and it matches a name of any namespaces // that we are interested in func namespaceChecker(interestingNamespaces []string) func(obj interface{}) bool { - interestingNamespacesSet := sets.NewString(interestingNamespaces...) + interestingNamespacesSet := sets.New(interestingNamespaces...) return func(obj interface{}) bool { ns, ok := obj.(*corev1.Namespace) diff --git a/vendor/github.com/openshift/library-go/pkg/controller/factory/eventfilters.go b/vendor/github.com/openshift/library-go/pkg/controller/factory/eventfilters.go index b70da95481..62af3c2710 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/factory/eventfilters.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/factory/eventfilters.go @@ -15,7 +15,7 @@ func ObjectNameToKey(obj runtime.Object) string { } func NamesFilter(names ...string) EventFilterFunc { - nameSet := sets.NewString(names...) + nameSet := sets.New(names...) return func(obj interface{}) bool { metaObj, ok := obj.(metav1.ObjectMetaAccessor) if !ok { diff --git a/vendor/github.com/openshift/library-go/pkg/controller/factory/factory.go b/vendor/github.com/openshift/library-go/pkg/controller/factory/factory.go index 8f910f672a..a431f1f1a6 100644 --- a/vendor/github.com/openshift/library-go/pkg/controller/factory/factory.go +++ b/vendor/github.com/openshift/library-go/pkg/controller/factory/factory.go @@ -8,7 +8,6 @@ import ( "github.com/robfig/cron" "k8s.io/apimachinery/pkg/runtime" errorutil "k8s.io/apimachinery/pkg/util/errors" - "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/cache" "github.com/openshift/library-go/pkg/operator/events" @@ -26,18 +25,17 @@ func DefaultQueueKeysFunc(_ runtime.Object) []string { // Factory is generator that generate standard Kubernetes controllers. // Factory is really generic and should be only used for simple controllers that does not require special stuff.. type Factory struct { - sync SyncFunc - syncContext SyncContext - syncDegradedClient operatorv1helpers.OperatorClient - resyncInterval time.Duration - resyncSchedules []string - informers []filteredInformers - informerQueueKeys []informersWithQueueKey - bareInformers []Informer - postStartHooks []PostStartHook - namespaceInformers []*namespaceInformer - cachesToSync []cache.InformerSynced - interestingNamespaces sets.String + sync SyncFunc + syncContext SyncContext + syncDegradedClient operatorv1helpers.OperatorClient + resyncInterval time.Duration + resyncSchedules []string + informers []filteredInformers + informerQueueKeys []informersWithQueueKey + bareInformers []Informer + postStartHooks []PostStartHook + namespaceInformers []*namespaceInformer + cachesToSync []cache.InformerSynced } // Informer represents any structure that allow to register event handlers and informs if caches are synced. diff --git a/vendor/github.com/openshift/library-go/pkg/crypto/crypto.go b/vendor/github.com/openshift/library-go/pkg/crypto/crypto.go index 62d98829b4..63184d2eb4 100644 --- a/vendor/github.com/openshift/library-go/pkg/crypto/crypto.go +++ b/vendor/github.com/openshift/library-go/pkg/crypto/crypto.go @@ -746,7 +746,7 @@ func (ca *CA) MakeAndWriteSubCA(certFile, keyFile, serialFile, name string, expi }, nil } -func (ca *CA) EnsureServerCert(certFile, keyFile string, hostnames sets.String, expireDays int) (*TLSCertificateConfig, bool, error) { +func (ca *CA) EnsureServerCert(certFile, keyFile string, hostnames sets.Set[string], expireDays int) (*TLSCertificateConfig, bool, error) { certConfig, err := GetServerCert(certFile, keyFile, hostnames) if err != nil { certConfig, err = ca.MakeAndWriteServerCert(certFile, keyFile, hostnames, expireDays) @@ -756,14 +756,14 @@ func (ca *CA) EnsureServerCert(certFile, keyFile string, hostnames sets.String, return certConfig, false, nil } -func GetServerCert(certFile, keyFile string, hostnames sets.String) (*TLSCertificateConfig, error) { +func GetServerCert(certFile, keyFile string, hostnames sets.Set[string]) (*TLSCertificateConfig, error) { server, err := GetTLSCertificateConfig(certFile, keyFile) if err != nil { return nil, err } cert := server.Certs[0] - certNames := sets.NewString() + certNames := sets.New[string]() for _, ip := range cert.IPAddresses { certNames.Insert(ip.String()) } @@ -776,7 +776,7 @@ func GetServerCert(certFile, keyFile string, hostnames sets.String) (*TLSCertifi return nil, fmt.Errorf("Existing server certificate in %s does not match required hostnames.", certFile) } -func (ca *CA) MakeAndWriteServerCert(certFile, keyFile string, hostnames sets.String, expireDays int) (*TLSCertificateConfig, error) { +func (ca *CA) MakeAndWriteServerCert(certFile, keyFile string, hostnames sets.Set[string], expireDays int) (*TLSCertificateConfig, error) { klog.V(4).Infof("Generating server certificate in %s, key in %s", certFile, keyFile) server, err := ca.MakeServerCert(hostnames, expireDays) @@ -793,11 +793,11 @@ func (ca *CA) MakeAndWriteServerCert(certFile, keyFile string, hostnames sets.St // if the extension attempt failed. type CertificateExtensionFunc func(*x509.Certificate) error -func (ca *CA) MakeServerCert(hostnames sets.String, expireDays int, fns ...CertificateExtensionFunc) (*TLSCertificateConfig, error) { +func (ca *CA) MakeServerCert(hostnames sets.Set[string], expireDays int, fns ...CertificateExtensionFunc) (*TLSCertificateConfig, error) { serverPublicKey, serverPrivateKey, publicKeyHash, _ := newKeyPairWithHash() authorityKeyId := ca.Config.Certs[0].SubjectKeyId subjectKeyId := publicKeyHash - serverTemplate := newServerCertificateTemplate(pkix.Name{CommonName: hostnames.List()[0]}, hostnames.List(), expireDays, time.Now, authorityKeyId, subjectKeyId) + serverTemplate := newServerCertificateTemplate(pkix.Name{CommonName: sets.List(hostnames)[0]}, sets.List(hostnames), expireDays, time.Now, authorityKeyId, subjectKeyId) for _, fn := range fns { if err := fn(serverTemplate); err != nil { return nil, err @@ -814,11 +814,11 @@ func (ca *CA) MakeServerCert(hostnames sets.String, expireDays int, fns ...Certi return server, nil } -func (ca *CA) MakeServerCertForDuration(hostnames sets.String, lifetime time.Duration, fns ...CertificateExtensionFunc) (*TLSCertificateConfig, error) { +func (ca *CA) MakeServerCertForDuration(hostnames sets.Set[string], lifetime time.Duration, fns ...CertificateExtensionFunc) (*TLSCertificateConfig, error) { serverPublicKey, serverPrivateKey, publicKeyHash, _ := newKeyPairWithHash() authorityKeyId := ca.Config.Certs[0].SubjectKeyId subjectKeyId := publicKeyHash - serverTemplate := newServerCertificateTemplateForDuration(pkix.Name{CommonName: hostnames.List()[0]}, hostnames.List(), lifetime, time.Now, authorityKeyId, subjectKeyId) + serverTemplate := newServerCertificateTemplateForDuration(pkix.Name{CommonName: sets.List(hostnames)[0]}, sets.List(hostnames), lifetime, time.Now, authorityKeyId, subjectKeyId) for _, fn := range fns { if err := fn(serverTemplate); err != nil { return nil, err diff --git a/vendor/github.com/openshift/library-go/pkg/oauth/tokenrequest/request_token.go b/vendor/github.com/openshift/library-go/pkg/oauth/tokenrequest/request_token.go index d084e23548..431624df9e 100644 --- a/vendor/github.com/openshift/library-go/pkg/oauth/tokenrequest/request_token.go +++ b/vendor/github.com/openshift/library-go/pkg/oauth/tokenrequest/request_token.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" @@ -193,7 +192,7 @@ func (o *RequestTokenOptions) SetDefaultOsinConfig(clientID string, redirectURL config.RedirectUrl = *redirectURL } - if !o.TokenFlow && sets.NewString(metadata.CodeChallengeMethodsSupported...).Has(pkce_s256) { + if !o.TokenFlow && sets.New(metadata.CodeChallengeMethodsSupported...).Has(pkce_s256) { if err := osincli.PopulatePKCE(config); err != nil { return err } @@ -257,7 +256,7 @@ func (o *RequestTokenOptions) requestTokenWithChallengeHandlers() (string, error // requestHeaders holds additional headers to add to the request. This can be changed by o.Handlers requestHeaders := http.Header{} // requestedURLSet/requestedURLList hold the URLs we have requested, to prevent redirect loops. Gets reset when a challenge is handled. - requestedURLSet := sets.NewString() + requestedURLSet := sets.New[string]() requestedURLList := []string{} handledChallenge := false @@ -300,7 +299,7 @@ func (o *RequestTokenOptions) requestTokenWithChallengeHandlers() (string, error handledChallenge = true // Reset request set/list. Since we're setting different headers, it is legitimate to request the same urls - requestedURLSet = sets.NewString() + requestedURLSet = sets.New[string]() requestedURLList = []string{} // Use the response to the challenge as the new headers requestHeaders = newRequestHeaders @@ -310,7 +309,7 @@ func (o *RequestTokenOptions) requestTokenWithChallengeHandlers() (string, error // Unauthorized with no challenge unauthorizedError := apierrs.NewUnauthorized("") // Attempt to read body content and include as an error detail - if details, err := ioutil.ReadAll(resp.Body); err == nil && len(details) > 0 { + if details, err := io.ReadAll(resp.Body); err == nil && len(details) > 0 { unauthorizedError.ErrStatus.Details = &metav1.StatusDetails{ Causes: []metav1.StatusCause{ {Message: string(details)}, diff --git a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apigroup.go b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apigroup.go index 03a178e4f4..4e1f9c7d1d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apigroup.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apigroup.go @@ -9,62 +9,67 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - kubeinformers "k8s.io/client-go/informers" + corev1listers "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/rest" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + "github.com/openshift/library-go/pkg/operator/bootstrap" "github.com/openshift/library-go/pkg/operator/events" ) -func newEndpointPrecondition(kubeInformers kubeinformers.SharedInformerFactory) func(apiServices []*apiregistrationv1.APIService) (bool, error) { - // this is outside the func so it always registers before the informers start - endpointsLister := kubeInformers.Core().V1().Endpoints().Lister() +func preconditionsForEnabledAPIServices(endpointsListerForTargetNs corev1listers.EndpointsLister, configmapListerForKubeSystemNs corev1listers.ConfigMapLister) func(apiServices []*apiregistrationv1.APIService) (bool, error) { + return func(apiServices []*apiregistrationv1.APIService) (bool, error) { + areEndpointsPresent, err := checkEndpointsPresence(endpointsListerForTargetNs, apiServices) + if !areEndpointsPresent || err != nil { + return false, err + } + return bootstrap.IsBootstrapComplete(configmapListerForKubeSystemNs) + } +} +func checkEndpointsPresence(endpointsLister corev1listers.EndpointsLister, apiServices []*apiregistrationv1.APIService) (bool, error) { type coordinate struct { namespace string name string } - return func(apiServices []*apiregistrationv1.APIService) (bool, error) { - - coordinates := []coordinate{} - for _, apiService := range apiServices { - curr := coordinate{namespace: apiService.Spec.Service.Namespace, name: apiService.Spec.Service.Name} - exists := false - for _, j := range coordinates { - if j == curr { - exists = true - break - } - } - if !exists { - coordinates = append(coordinates, curr) + coordinates := []coordinate{} + for _, apiService := range apiServices { + curr := coordinate{namespace: apiService.Spec.Service.Namespace, name: apiService.Spec.Service.Name} + exists := false + for _, j := range coordinates { + if j == curr { + exists = true + break } } + if !exists { + coordinates = append(coordinates, curr) + } + } - for _, curr := range coordinates { - endpoints, err := endpointsLister.Endpoints(curr.namespace).Get(curr.name) - if err != nil { - return false, err - } - if len(endpoints.Subsets) == 0 { - return false, nil - } + for _, curr := range coordinates { + endpoints, err := endpointsLister.Endpoints(curr.namespace).Get(curr.name) + if err != nil { + return false, err + } + if len(endpoints.Subsets) == 0 { + return false, nil + } - exists := false - for _, subset := range endpoints.Subsets { - if len(subset.Addresses) > 0 { - exists = true - break - } - } - if !exists { - return false, nil + exists := false + for _, subset := range endpoints.Subsets { + if len(subset.Addresses) > 0 { + exists = true + break } } - - return true, nil + if !exists { + return false, nil + } } + + return true, nil } func checkDiscoveryForByAPIServices(ctx context.Context, recorder events.Recorder, restclient rest.Interface, apiServices []*apiregistrationv1.APIService) []string { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apiservice_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apiservice_controller.go index 9f165f6943..cc3a88f4cc 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apiservice_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controller/apiservice/apiservice_controller.go @@ -10,7 +10,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/errors" - kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" "k8s.io/klog/v2" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" @@ -34,8 +33,8 @@ type apiServicesPreconditionFuncType func([]*apiregistrationv1.APIService) (bool type APIServiceController struct { getAPIServicesToManageFn GetAPIServicesToMangeFunc - // preconditionForEnabledAPIServices must return true before the apiservices will be created - preconditionForEnabledAPIServices apiServicesPreconditionFuncType + // preconditionsForEnabledAPIServices must return true before the apiservices will be created + preconditionsForEnabledAPIServices apiServicesPreconditionFuncType operatorClient v1helpers.OperatorClient kubeClient kubernetes.Interface @@ -44,19 +43,22 @@ type APIServiceController struct { } func NewAPIServiceController( - name string, + name, targetNamespace string, getAPIServicesToManageFunc GetAPIServicesToMangeFunc, operatorClient v1helpers.OperatorClient, apiregistrationInformers apiregistrationinformers.SharedInformerFactory, apiregistrationv1Client apiregistrationv1client.ApiregistrationV1Interface, - kubeInformersForOperandNamespace kubeinformers.SharedInformerFactory, + kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces, kubeClient kubernetes.Interface, eventRecorder events.Recorder, informers ...factory.Informer, ) factory.Controller { c := &APIServiceController{ - preconditionForEnabledAPIServices: newEndpointPrecondition(kubeInformersForOperandNamespace), - getAPIServicesToManageFn: getAPIServicesToManageFunc, + preconditionsForEnabledAPIServices: preconditionsForEnabledAPIServices( + kubeInformersForNamespaces.InformersFor(targetNamespace).Core().V1().Endpoints().Lister(), + kubeInformersForNamespaces.InformersFor(metav1.NamespaceSystem).Core().V1().ConfigMaps().Lister(), + ), + getAPIServicesToManageFn: getAPIServicesToManageFunc, operatorClient: operatorClient, apiregistrationv1Client: apiregistrationv1Client, @@ -66,8 +68,9 @@ func NewAPIServiceController( return factory.New().WithSync(c.sync).ResyncEvery(10*time.Second).WithInformers( append(informers, - kubeInformersForOperandNamespace.Core().V1().Services().Informer(), - kubeInformersForOperandNamespace.Core().V1().Endpoints().Informer(), + kubeInformersForNamespaces.InformersFor(targetNamespace).Core().V1().Services().Informer(), + kubeInformersForNamespaces.InformersFor(targetNamespace).Core().V1().Endpoints().Informer(), + kubeInformersForNamespaces.InformersFor(metav1.NamespaceSystem).Core().V1().ConfigMaps().Informer(), apiregistrationInformers.Apiregistration().V1().APIServices().Informer(), )..., ).ToController("APIServiceController_"+name, eventRecorder.WithComponentSuffix("apiservice-"+name+"-controller")) @@ -182,13 +185,13 @@ func (c *APIServiceController) sync(ctx context.Context, syncCtx factory.SyncCon var syncEnabledAPIServicesErr error syncDisabledAPIServicesErr := c.syncDisabledAPIServices(ctx, disabledApiServices) - preconditionReady, preconditionErr := c.preconditionForEnabledAPIServices(enabledApiServices) + preconditionsReady, preconditionsErr := c.preconditionsForEnabledAPIServices(enabledApiServices) - if preconditionErr == nil && preconditionReady { + if preconditionsErr == nil && preconditionsReady { syncEnabledAPIServicesErr = c.syncEnabledAPIServices(ctx, enabledApiServices, syncCtx.Recorder()) } - return c.updateOperatorStatus(ctx, syncDisabledAPIServicesErr, preconditionErr, preconditionReady, syncEnabledAPIServicesErr) + return c.updateOperatorStatus(ctx, syncDisabledAPIServicesErr, preconditionsErr, preconditionsReady, syncEnabledAPIServicesErr) } func (c *APIServiceController) syncDisabledAPIServices(ctx context.Context, apiServices []*apiregistrationv1.APIService) error { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controllerset/apiservercontrollerset.go b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controllerset/apiservercontrollerset.go index 32f87b72d8..c8a1e9202d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controllerset/apiservercontrollerset.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/apiserver/controllerset/apiservercontrollerset.go @@ -174,21 +174,22 @@ func (cs *APIServerControllerSet) WithoutClusterOperatorStatusController() *APIS } func (cs *APIServerControllerSet) WithAPIServiceController( - controllerName string, + controllerName, targetNamespace string, getAPIServicesToManageFn apiservice.GetAPIServicesToMangeFunc, apiregistrationInformers apiregistrationinformers.SharedInformerFactory, apiregistrationv1Client apiregistrationv1client.ApiregistrationV1Interface, - kubeInformersForTargetNamesace kubeinformers.SharedInformerFactory, + kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces, kubeClient kubernetes.Interface, informers ...factory.Informer, ) *APIServerControllerSet { cs.apiServiceController.controller = apiservice.NewAPIServiceController( controllerName, + targetNamespace, getAPIServicesToManageFn, cs.operatorClient, apiregistrationInformers, apiregistrationv1Client, - kubeInformersForTargetNamesace, + kubeInformersForNamespaces, kubeClient, cs.eventRecorder, informers..., diff --git a/vendor/github.com/openshift/library-go/pkg/operator/bootstrap/bootstrap.go b/vendor/github.com/openshift/library-go/pkg/operator/bootstrap/bootstrap.go new file mode 100644 index 0000000000..24bf893768 --- /dev/null +++ b/vendor/github.com/openshift/library-go/pkg/operator/bootstrap/bootstrap.go @@ -0,0 +1,44 @@ +package bootstrap + +import ( + "fmt" + + "k8s.io/apimachinery/pkg/api/errors" + corev1listers "k8s.io/client-go/listers/core/v1" + "k8s.io/klog/v2" +) + +// IsBootstrapComplete returns true if bootstrap has completed. +// +// This function checks if "bootstrap" config map in "kube-system" namespace +// was created and has status equal to complete. +// +// The configmap is created when bootstrapping is done by the installer (https://github.com/openshift/installer/blob/911203db89a5728f00aaef011b5fb8add7abf646/data/data/bootstrap/files/usr/local/bin/report-progress.sh#L21) +// As of today it is used by etcd and network operators +// +// As of today there is nothing else we could depend on to know if bootstrap was done. +// +// It is important to note that the bootstrap node might not be removed until additional conditions are met. +// For example, on a SNO cluster, the installer waits until the CEO removes the bootstrap member from the etcd cluster. +// In HA clusters, the bootstrap node is torn down as soon as the configmap is created with the appropriate content. +func IsBootstrapComplete(configMapClient corev1listers.ConfigMapLister) (bool, error) { + bootstrapFinishedConfigMap, err := configMapClient.ConfigMaps("kube-system").Get("bootstrap") + if err != nil { + if errors.IsNotFound(err) { + // If the resource was deleted (e.g. by an admin) after bootstrap is actually complete, + // this is a false negative. + klog.V(4).Infof("bootstrap considered incomplete because the kube-system/bootstrap configmap wasn't found") + return false, nil + } + // We don't know, give up quickly. + return false, fmt.Errorf("failed to get configmap %s/%s: %w", "kube-system", "bootstrap", err) + } + + if status, ok := bootstrapFinishedConfigMap.Data["status"]; !ok || status != "complete" { + // do nothing, not torn down + klog.V(4).Infof("bootstrap considered incomplete because status is %q", status) + return false, nil + } + + return true, nil +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go index 67015d7b1b..5159f562a3 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/client_cert_rotation_controller.go @@ -122,7 +122,7 @@ func (c CertRotationController) Sync(ctx context.Context, syncCtx factory.SyncCo } func (c CertRotationController) SyncWorker(ctx context.Context) error { - signingCertKeyPair, err := c.RotatedSigningCASecret.EnsureSigningCertKeyPair(ctx) + signingCertKeyPair, _, err := c.RotatedSigningCASecret.EnsureSigningCertKeyPair(ctx) if err != nil { return err } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go index 59bf926d5a..4cf805bb7b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/signer.go @@ -52,12 +52,20 @@ type RotatedSigningCASecret struct { Lister corev1listers.SecretLister Client corev1client.SecretsGetter EventRecorder events.Recorder + + // Deprecated: DO NOT enable, it is intended as a short term hack for a very specific use case, + // and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. + // we will remove this when we migrate all of the affected secret + // objects to their intended type: https://issues.redhat.com/browse/API-1800 + UseSecretUpdateOnly bool } -func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (*crypto.CA, error) { +// EnsureSigningCertKeyPair manages the entire lifecycle of a signer cert as a secret, from creation to continued rotation. +// It always returns the currently used CA pair, a bool indicating whether it was created/updated within this function call and an error. +func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (*crypto.CA, bool, error) { originalSigningCertKeyPairSecret, err := c.Lister.Secrets(c.Namespace).Get(c.Name) if err != nil && !apierrors.IsNotFound(err) { - return nil, err + return nil, false, err } signingCertKeyPairSecret := originalSigningCertKeyPairSecret.DeepCopy() if apierrors.IsNotFound(err) { @@ -72,37 +80,44 @@ func (c RotatedSigningCASecret) EnsureSigningCertKeyPair(ctx context.Context) (* } } + applyFn := resourceapply.ApplySecret + if c.UseSecretUpdateOnly { + applyFn = resourceapply.ApplySecretDoNotUse + } + // apply necessary metadata (possibly via delete+recreate) if secret exists // this is done before content update to prevent unexpected rollouts if ensureMetadataUpdate(signingCertKeyPairSecret, c.Owner, c.AdditionalAnnotations) && ensureSecretTLSTypeSet(signingCertKeyPairSecret) { - actualSigningCertKeyPairSecret, _, err := resourceapply.ApplySecret(ctx, c.Client, c.EventRecorder, signingCertKeyPairSecret) + actualSigningCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, signingCertKeyPairSecret) if err != nil { - return nil, err + return nil, false, err } signingCertKeyPairSecret = actualSigningCertKeyPairSecret } + signerUpdated := false if needed, reason := needNewSigningCertKeyPair(signingCertKeyPairSecret.Annotations, c.Refresh, c.RefreshOnlyWhenExpired); needed { c.EventRecorder.Eventf("SignerUpdateRequired", "%q in %q requires a new signing cert/key pair: %v", c.Name, c.Namespace, reason) if err := setSigningCertKeyPairSecret(signingCertKeyPairSecret, c.Validity); err != nil { - return nil, err + return nil, false, err } LabelAsManagedSecret(signingCertKeyPairSecret, CertificateTypeSigner) - actualSigningCertKeyPairSecret, _, err := resourceapply.ApplySecret(ctx, c.Client, c.EventRecorder, signingCertKeyPairSecret) + actualSigningCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, signingCertKeyPairSecret) if err != nil { - return nil, err + return nil, false, err } signingCertKeyPairSecret = actualSigningCertKeyPairSecret + signerUpdated = true } // at this point, the secret has the correct signer, so we should read that signer to be able to sign signingCertKeyPair, err := crypto.GetCAFromBytes(signingCertKeyPairSecret.Data["tls.crt"], signingCertKeyPairSecret.Data["tls.key"]) if err != nil { - return nil, err + return nil, signerUpdated, err } - return signingCertKeyPair, nil + return signingCertKeyPair, signerUpdated, nil } // ensureOwnerReference adds the owner to the list of owner references in meta, if necessary diff --git a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go index 9d8aacf7ed..99bdc93bea 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/certrotation/target.go @@ -68,6 +68,12 @@ type RotatedSelfSignedCertKeySecret struct { Lister corev1listers.SecretLister Client corev1client.SecretsGetter EventRecorder events.Recorder + + // Deprecated: DO NOT eanble, it is intended as a short term hack for a very specific use case, + // and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. + // we will remove this when we migrate all of the affected secret + // objects to their intended type: https://issues.redhat.com/browse/API-1800 + UseSecretUpdateOnly bool } type TargetCertCreator interface { @@ -107,10 +113,15 @@ func (c RotatedSelfSignedCertKeySecret) EnsureTargetCertKeyPair(ctx context.Cont } } + applyFn := resourceapply.ApplySecret + if c.UseSecretUpdateOnly { + applyFn = resourceapply.ApplySecretDoNotUse + } + // apply necessary metadata (possibly via delete+recreate) if secret exists // this is done before content update to prevent unexpected rollouts if ensureMetadataUpdate(targetCertKeyPairSecret, c.Owner, c.AdditionalAnnotations) && ensureSecretTLSTypeSet(targetCertKeyPairSecret) { - actualTargetCertKeyPairSecret, _, err := resourceapply.ApplySecret(ctx, c.Client, c.EventRecorder, targetCertKeyPairSecret) + actualTargetCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, targetCertKeyPairSecret) if err != nil { return nil, err } @@ -125,7 +136,7 @@ func (c RotatedSelfSignedCertKeySecret) EnsureTargetCertKeyPair(ctx context.Cont LabelAsManagedSecret(targetCertKeyPairSecret, CertificateTypeTarget) - actualTargetCertKeyPairSecret, _, err := resourceapply.ApplySecret(ctx, c.Client, c.EventRecorder, targetCertKeyPairSecret) + actualTargetCertKeyPairSecret, _, err := applyFn(ctx, c.Client, c.EventRecorder, targetCertKeyPairSecret) if err != nil { return nil, err } @@ -270,7 +281,7 @@ func (r *ServingRotation) NewCertificate(signer *crypto.CA, validity time.Durati if len(r.Hostnames()) == 0 { return nil, fmt.Errorf("no hostnames set") } - return signer.MakeServerCertForDuration(sets.NewString(r.Hostnames()...), validity, r.CertificateExtensionFn...) + return signer.MakeServerCertForDuration(sets.New(r.Hostnames()...), validity, r.CertificateExtensionFn...) } func (r *ServingRotation) RecheckChannel() <-chan struct{} { @@ -287,19 +298,19 @@ func (r *ServingRotation) NeedNewTargetCertKeyPair(currentCertSecret *corev1.Sec } func (r *ServingRotation) missingHostnames(annotations map[string]string) string { - existingHostnames := sets.NewString(strings.Split(annotations[CertificateHostnames], ",")...) - requiredHostnames := sets.NewString(r.Hostnames()...) + existingHostnames := sets.New(strings.Split(annotations[CertificateHostnames], ",")...) + requiredHostnames := sets.New(r.Hostnames()...) if !existingHostnames.Equal(requiredHostnames) { existingNotRequired := existingHostnames.Difference(requiredHostnames) requiredNotExisting := requiredHostnames.Difference(existingHostnames) - return fmt.Sprintf("%q are existing and not required, %q are required and not existing", strings.Join(existingNotRequired.List(), ","), strings.Join(requiredNotExisting.List(), ",")) + return fmt.Sprintf("%q are existing and not required, %q are required and not existing", strings.Join(sets.List(existingNotRequired), ","), strings.Join(sets.List(requiredNotExisting), ",")) } return "" } func (r *ServingRotation) SetAnnotations(cert *crypto.TLSCertificateConfig, annotations map[string]string) map[string]string { - hostnames := sets.String{} + hostnames := sets.Set[string]{} for _, ip := range cert.Certs[0].IPAddresses { hostnames.Insert(ip.String()) } @@ -308,7 +319,7 @@ func (r *ServingRotation) SetAnnotations(cert *crypto.TLSCertificateConfig, anno } // List does a sort so that we have a consistent representation - annotations[CertificateHostnames] = strings.Join(hostnames.List(), ",") + annotations[CertificateHostnames] = strings.Join(sets.List(hostnames), ",") return annotations } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/apiserver/observe_cors.go b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/apiserver/observe_cors.go index 9046e9534b..f8868aa2aa 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/configobserver/apiserver/observe_cors.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/configobserver/apiserver/observe_cors.go @@ -46,7 +46,7 @@ func innerObserveAdditionalCORSAllowedOrigins(genericListers configobserver.List errs = append(errs, err) // keep going on read error from existing config } - currentCORSSet := sets.NewString(currentCORSAllowedOrigins...) + currentCORSSet := sets.New(currentCORSAllowedOrigins...) currentCORSSet.Insert(clusterDefaultCORSAllowedOrigins...) observedConfig := map[string]interface{}{} @@ -61,14 +61,14 @@ func innerObserveAdditionalCORSAllowedOrigins(genericListers configobserver.List return existingConfig, append(errs, err) } - newCORSSet := sets.NewString(clusterDefaultCORSAllowedOrigins...) + newCORSSet := sets.New(clusterDefaultCORSAllowedOrigins...) newCORSSet.Insert(apiServer.Spec.AdditionalCORSAllowedOrigins...) - if err := unstructured.SetNestedStringSlice(observedConfig, newCORSSet.List(), corsAllowedOriginsPath...); err != nil { + if err := unstructured.SetNestedStringSlice(observedConfig, sets.List(newCORSSet), corsAllowedOriginsPath...); err != nil { return existingConfig, append(errs, err) } if !currentCORSSet.Equal(newCORSSet) { - recorder.Eventf("ObserveAdditionalCORSAllowedOrigins", "corsAllowedOrigins changed to %q", newCORSSet.List()) + recorder.Eventf("ObserveAdditionalCORSAllowedOrigins", "corsAllowedOrigins changed to %q", sets.List(newCORSSet)) } return observedConfig, errs diff --git a/vendor/github.com/openshift/library-go/pkg/operator/csr/csr_approver.go b/vendor/github.com/openshift/library-go/pkg/operator/csr/csr_approver.go index d9d2b3ceba..2c2f143d90 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/csr/csr_approver.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/csr/csr_approver.go @@ -175,7 +175,7 @@ func getCertApprovalCondition(status *certapiv1.CertificateSigningRequestStatus) } type ServiceAccountApprover struct { - saGroups sets.String // saGroups is the set of groups for the SA expected to have created the CSR + saGroups sets.Set[string] // saGroups is the set of groups for the SA expected to have created the CSR saName string expectedSubject string } @@ -186,7 +186,7 @@ func NewServiceAccountApprover(saNamespace, saName, expectedSubject string, addi return &ServiceAccountApprover{ saName: serviceaccount.MakeUsername(saNamespace, saName), - saGroups: sets.NewString(append(saGroups, additionalGroups...)...), + saGroups: sets.New(append(saGroups, additionalGroups...)...), expectedSubject: expectedSubject, } } @@ -200,8 +200,8 @@ func (a *ServiceAccountApprover) Approve(csrObj *certapiv1.CertificateSigningReq return CSRDenied, fmt.Sprintf("CSR %q was created by an unexpected user: %q", csrObj.Name, csrObj.Spec.Username), nil } - if csrGroups := sets.NewString(csrObj.Spec.Groups...); !csrGroups.Equal(a.saGroups) { - return CSRDenied, fmt.Sprintf("CSR %q was created by a user with unexpected groups: %v", csrObj.Name, csrGroups.List()), nil + if csrGroups := sets.New(csrObj.Spec.Groups...); !csrGroups.Equal(a.saGroups) { + return CSRDenied, fmt.Sprintf("CSR %q was created by a user with unexpected groups: %v", csrObj.Name, sets.List(csrGroups)), nil } if expectedSubject := a.expectedSubject; x509CSR.Subject.String() != expectedSubject { @@ -253,11 +253,11 @@ func (f *LabelFilter) Matches(csr *certapiv1.CertificateSigningRequest) bool { } type NamesFilter struct { - names sets.String + names sets.Set[string] } func NewNamesFilter(names ...string) *NamesFilter { - return &NamesFilter{sets.NewString(names...)} + return &NamesFilter{sets.New(names...)} } func (f *NamesFilter) Matches(csr *certapiv1.CertificateSigningRequest) bool { @@ -265,11 +265,11 @@ func (f *NamesFilter) Matches(csr *certapiv1.CertificateSigningRequest) bool { } type RequestCommonNameFilter struct { - commonNames sets.String + commonNames sets.Set[string] } func NewRequestCommonNameFilter(commonNames ...string) *RequestCommonNameFilter { - return &RequestCommonNameFilter{sets.NewString(commonNames...)} + return &RequestCommonNameFilter{sets.New(commonNames...)} } func (f *RequestCommonNameFilter) Match(csr *certapiv1.CertificateSigningRequest) bool { diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/condition_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/condition_controller.go index 28a45c215b..0d6edd6544 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/condition_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/condition_controller.go @@ -175,8 +175,8 @@ func allMigrated(toBeEncrypted, migrated []schema.GroupResource) bool { return true } -func migratedSet(grs []schema.GroupResource) sets.String { - migrated := sets.NewString() +func migratedSet(grs []schema.GroupResource) sets.Set[string] { + migrated := sets.New[string]() for _, gr := range grs { migrated.Insert(gr.String()) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/key_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/key_controller.go index 7970c83ff1..97a42acc66 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/key_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/key_controller.go @@ -18,7 +18,7 @@ import ( apiserverv1 "k8s.io/apiserver/pkg/apis/config/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/klog/v2" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" operatorv1 "github.com/openshift/api/operator/v1" configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1" @@ -182,7 +182,7 @@ func (c *keyController) checkAndCreateKeys(ctx context.Context, syncContext fact if commonReason == nil { commonReason = &internalReason } else if *commonReason != internalReason { - commonReason = pointer.StringPtr("") // this means we have no common reason + commonReason = ptr.To("") // this means we have no common reason } newKeyRequired = true diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators/errors.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators/errors.go index 2b94e0fd95..6b153a91bf 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators/errors.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators/errors.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/util/net" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) // isConnectionRefusedError checks if the error string include "connection refused" @@ -38,9 +38,9 @@ func canRetry(err error) *bool { case err == nil: return nil case errors.IsNotFound(err), errors.IsMethodNotSupported(err): - return pointer.BoolPtr(false) + return ptr.To(false) case errors.IsConflict(err), errors.IsServerTimeout(err), errors.IsTooManyRequests(err), net.IsProbableEOF(err), net.IsConnectionReset(err), net.IsNoRoutesError(err), isConnectionRefusedError(err): - return pointer.BoolPtr(true) + return ptr.To(true) default: return nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/prune_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/prune_controller.go index 90a8203328..e11282f50e 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/prune_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/controllers/prune_controller.go @@ -160,9 +160,9 @@ NextEncryptionSecret: // remove our finalizer if it is present secret := s.DeepCopy() - if finalizers := sets.NewString(secret.Finalizers...); finalizers.Has(secrets.EncryptionSecretFinalizer) { + if finalizers := sets.New(secret.Finalizers...); finalizers.Has(secrets.EncryptionSecretFinalizer) { delete(finalizers, secrets.EncryptionSecretFinalizer) - secret.Finalizers = finalizers.List() + secret.Finalizers = sets.List(finalizers) var updateErr error secret, updateErr = c.secretClient.Secrets("openshift-config-managed").Update(ctx, secret, metav1.UpdateOptions{}) deleteErrs = append(deleteErrs, updateErr) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/encryption/deployer/revisionedpod.go b/vendor/github.com/openshift/library-go/pkg/operator/encryption/deployer/revisionedpod.go index 58f55a09dc..1bdaf0b4ca 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/encryption/deployer/revisionedpod.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/encryption/deployer/revisionedpod.go @@ -198,7 +198,7 @@ func getAPIServerRevisionOfAllInstances(revisionLabel string, nodes []string, ap return "", fmt.Errorf("api server has invalid revision: %v", err) } - for _, failedRevision := range failingRevisions.List() { // iterate in defined order + for _, failedRevision := range sets.List(failingRevisions) { // iterate in defined order if len(failedRevision) == 0 { // these will never be bigger than revisionNum continue @@ -215,16 +215,16 @@ func getAPIServerRevisionOfAllInstances(revisionLabel string, nodes []string, ap return revision, nil } -func revisions(revisionLabel string, pods []*corev1.Pod) sets.String { - ret := sets.NewString() +func revisions(revisionLabel string, pods []*corev1.Pod) sets.Set[string] { + ret := sets.New[string]() for _, p := range pods { ret.Insert(p.Labels[revisionLabel]) } return ret } -func nodeNames(pods []*corev1.Pod) sets.String { - ret := sets.NewString() +func nodeNames(pods []*corev1.Pod) sets.Set[string] { + ret := sets.New[string]() for _, p := range pods { ret.Insert(p.Spec.NodeName) } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go index dc997370b3..0b1a43fe01 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/loglevel/util.go @@ -26,7 +26,7 @@ func LogLevelToVerbosity(logLevel operatorv1.LogLevel) int { } } -var validLogLevels = sets.NewString( +var validLogLevels = sets.New( string(operatorv1.Normal), string(operatorv1.Debug), string(operatorv1.Trace), diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go index 6b199ac535..fb753fde4c 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/admissionregistration.go @@ -48,13 +48,13 @@ func ApplyMutatingWebhookConfigurationImproved(ctx context.Context, client admis } required := requiredOriginal.DeepCopy() - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) copyMutatingWebhookCABundle(existing, required) webhooksEquivalent := equality.Semantic.DeepEqual(existingCopy.Webhooks, required.Webhooks) - if webhooksEquivalent && !*modified { + if webhooksEquivalent && !modified { // need to store the original so that the early comparison of hashes is done based on the original, not a mutated copy cache.UpdateCachedResourceMetadata(requiredOriginal, existingCopy) return existingCopy, false, nil @@ -123,13 +123,13 @@ func ApplyValidatingWebhookConfigurationImproved(ctx context.Context, client adm } required := requiredOriginal.DeepCopy() - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) copyValidatingWebhookCABundle(existing, required) webhooksEquivalent := equality.Semantic.DeepEqual(existingCopy.Webhooks, required.Webhooks) - if webhooksEquivalent && !*modified { + if webhooksEquivalent && !modified { // need to store the original so that the early comparison of hashes is done based on the original, not a mutated copy cache.UpdateCachedResourceMetadata(requiredOriginal, existingCopy) return existingCopy, false, nil diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go index ca712d5577..587c9bd556 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiextensions.go @@ -26,10 +26,10 @@ func ApplyCustomResourceDefinitionV1(ctx context.Context, client apiextclientv1. return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureCustomResourceDefinitionV1(modified, existingCopy, *required) - if !*modified { + resourcemerge.EnsureCustomResourceDefinitionV1(&modified, existingCopy, *required) + if !modified { return existing, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go index e9174dc50b..931a6c0e1b 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apiregistration.go @@ -28,15 +28,15 @@ func ApplyAPIService(ctx context.Context, client apiregistrationv1client.APIServ return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) serviceSame := equality.Semantic.DeepEqual(existingCopy.Spec.Service, required.Spec.Service) prioritySame := existingCopy.Spec.VersionPriority == required.Spec.VersionPriority && existingCopy.Spec.GroupPriorityMinimum == required.Spec.GroupPriorityMinimum insecureSame := existingCopy.Spec.InsecureSkipTLSVerify == required.Spec.InsecureSkipTLSVerify // there was no change to metadata, the service and priorities were right - if !*modified && serviceSame && prioritySame && insecureSame { + if !modified && serviceSame && prioritySame && insecureSame { return existingCopy, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go index d683fd7de4..0560c66abc 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/apps.go @@ -125,12 +125,12 @@ func ApplyDeploymentWithForce(ctx context.Context, client appsclientv1.Deploymen return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) // there was no change to metadata, the generation was right, and we weren't asked for force the deployment - if !*modified && existingCopy.ObjectMeta.Generation == expectedGeneration && !forceRollout { + if !modified && existingCopy.ObjectMeta.Generation == expectedGeneration && !forceRollout { return existingCopy, false, nil } @@ -212,12 +212,12 @@ func ApplyDaemonSetWithForce(ctx context.Context, client appsclientv1.DaemonSets return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) // there was no change to metadata, the generation was right, and we weren't asked for force the deployment - if !*modified && existingCopy.ObjectMeta.Generation == expectedGeneration && !forceRollout { + if !modified && existingCopy.ObjectMeta.Generation == expectedGeneration && !forceRollout { return existingCopy, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go index 588d7b0622..ba20f7b1c8 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/core.go @@ -18,6 +18,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" coreclientv1 "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/klog/v2" + "k8s.io/utils/ptr" ) // TODO find way to create a registry of these based on struct mapping or some such that forces users to get this right @@ -84,7 +85,15 @@ func ApplyConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, r // ApplySecret merges objectmeta, requires data func ApplySecret(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error) { - return ApplySecretImproved(ctx, client, recorder, required, noCache) + return applySecretImproved(ctx, client, recorder, required, noCache, false) +} + +// ApplySecretDoNotUse is depreated and will be removed +// Deprecated: DO NOT USE, it is intended as a short term hack for a very specific use case, +// and it works in tandem with a particular carry patch applied to the openshift kube-apiserver. +// Use ApplySecret instead. +func ApplySecretDoNotUse(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error) { + return applySecretImproved(ctx, client, recorder, required, noCache, true) } // ApplyNamespace merges objectmeta, does not worry about anything else @@ -106,11 +115,11 @@ func ApplyNamespaceImproved(ctx context.Context, client coreclientv1.NamespacesG return existing, false, nil } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) - if !*modified { + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) + if !modified { cache.UpdateCachedResourceMetadata(required, existingCopy) return existingCopy, false, nil } @@ -153,12 +162,12 @@ func ApplyServiceImproved(ctx context.Context, client coreclientv1.ServicesGette return existing, false, nil } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() // This will catch also changes between old `required.spec` and current `required.spec`, because // the annotation from SetSpecHashAnnotation will be different. - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) selectorSame := equality.Semantic.DeepEqual(existingCopy.Spec.Selector, required.Spec.Selector) typeSame := false @@ -168,7 +177,7 @@ func ApplyServiceImproved(ctx context.Context, client coreclientv1.ServicesGette typeSame = true } - if selectorSame && typeSame && !*modified { + if selectorSame && typeSame && !modified { cache.UpdateCachedResourceMetadata(required, existingCopy) return existingCopy, false, nil } @@ -205,11 +214,11 @@ func ApplyPodImproved(ctx context.Context, client coreclientv1.PodsGetter, recor return existing, false, nil } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) - if !*modified { + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) + if !modified { cache.UpdateCachedResourceMetadata(required, existingCopy) return existingCopy, false, nil } @@ -243,11 +252,11 @@ func ApplyServiceAccountImproved(ctx context.Context, client coreclientv1.Servic return existing, false, nil } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) - if !*modified { + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) + if !modified { cache.UpdateCachedResourceMetadata(required, existingCopy) return existingCopy, false, nil } @@ -279,10 +288,10 @@ func ApplyConfigMapImproved(ctx context.Context, client coreclientv1.ConfigMapsG return existing, false, nil } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) // injected by cluster-network-operator: https://github.com/openshift/cluster-network-operator/blob/acc819ee0f3424a341b9ad4e1e83ca0a742c230a/docs/architecture.md?L192#configmap-ca-injector caBundleInjected := required.Labels["config.openshift.io/inject-trusted-cabundle"] == "true" @@ -325,7 +334,7 @@ func ApplyConfigMapImproved(ctx context.Context, client coreclientv1.ConfigMapsG } dataSame := len(modifiedKeys) == 0 - if dataSame && !*modified { + if dataSame && !modified { cache.UpdateCachedResourceMetadata(required, existingCopy) return existingCopy, false, nil } @@ -356,6 +365,10 @@ func ApplyConfigMapImproved(ctx context.Context, client coreclientv1.ConfigMapsG // ApplySecret merges objectmeta, requires data func ApplySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, requiredInput *corev1.Secret, cache ResourceCache) (*corev1.Secret, bool, error) { + return applySecretImproved(ctx, client, recorder, requiredInput, cache, false) +} + +func applySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, requiredInput *corev1.Secret, cache ResourceCache, updateOnly bool) (*corev1.Secret, bool, error) { // copy the stringData to data. Error on a data content conflict inside required. This is usually a bug. existing, err := client.Secrets(requiredInput.Namespace).Get(ctx, requiredInput.Name, metav1.GetOptions{}) @@ -395,7 +408,7 @@ func ApplySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(resourcemerge.BoolPtr(false), &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(ptr.To(false), &existingCopy.ObjectMeta, required.ObjectMeta) switch required.Type { case corev1.SecretTypeServiceAccountToken: @@ -435,6 +448,12 @@ func ApplySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, * https://github.com/kubernetes/kubernetes/blob/98e65951dccfd40d3b4f31949c2ab8df5912d93e/pkg/apis/core/validation/validation.go#L5048 * We need to explicitly opt for delete+create in that case. */ + if updateOnly { + actual, err = client.Secrets(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) + reportUpdateEvent(recorder, existingCopy, err) + return actual, err == nil, err + } + if existingCopy.Type == existing.Type { actual, err = client.Secrets(required.Namespace).Update(ctx, existingCopy, metav1.UpdateOptions{}) reportUpdateEvent(recorder, existingCopy, err) @@ -466,7 +485,7 @@ func SyncConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, re // SyncPartialConfigMap does what SyncConfigMap does but it only synchronizes a subset of keys given by `syncedKeys`. // SyncPartialConfigMap will delete the target if `syncedKeys` are set but the source does not contain any of these keys. -func SyncPartialConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, syncedKeys sets.String, ownerRefs []metav1.OwnerReference) (*corev1.ConfigMap, bool, error) { +func SyncPartialConfigMap(ctx context.Context, client coreclientv1.ConfigMapsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, syncedKeys sets.Set[string], ownerRefs []metav1.OwnerReference) (*corev1.ConfigMap, bool, error) { source, err := client.ConfigMaps(sourceNamespace).Get(ctx, sourceName, metav1.GetOptions{}) switch { case apierrors.IsNotFound(err): @@ -527,7 +546,7 @@ func SyncSecret(ctx context.Context, client coreclientv1.SecretsGetter, recorder // SyncPartialSecret does what SyncSecret does but it only synchronizes a subset of keys given by `syncedKeys`. // SyncPartialSecret will delete the target if `syncedKeys` are set but the source does not contain any of these keys. -func SyncPartialSecret(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, syncedKeys sets.String, ownerRefs []metav1.OwnerReference) (*corev1.Secret, bool, error) { +func SyncPartialSecret(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, syncedKeys sets.Set[string], ownerRefs []metav1.OwnerReference) (*corev1.Secret, bool, error) { source, err := client.Secrets(sourceNamespace).Get(ctx, sourceName, metav1.GetOptions{}) switch { case apierrors.IsNotFound(err): diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go index fcea13323a..7c0dcf6051 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/migration.go @@ -28,10 +28,10 @@ func ApplyStorageVersionMigration(ctx context.Context, client migrationclientv1a return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) - if !*modified && reflect.DeepEqual(existingCopy.Spec, required.Spec) { + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) + if !modified && reflect.DeepEqual(existingCopy.Spec, required.Spec) { return existingCopy, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go index 4cef1e63b6..6cf4793253 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/policy.go @@ -27,12 +27,12 @@ func ApplyPodDisruptionBudget(ctx context.Context, client policyclientv1.PodDisr return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) contentSame := equality.Semantic.DeepEqual(existingCopy.Spec, required.Spec) - if contentSame && !*modified { + if contentSame && !modified { return existingCopy, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go index b41cfb286a..4b45c8818e 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/rbac.go @@ -28,14 +28,14 @@ func ApplyClusterRole(ctx context.Context, client rbacclientv1.ClusterRolesGette return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) rulesContentSame := equality.Semantic.DeepEqual(existingCopy.Rules, required.Rules) aggregationRuleContentSame := equality.Semantic.DeepEqual(existingCopy.AggregationRule, required.AggregationRule) - if aggregationRuleContentSame && rulesContentSame && !*modified { + if aggregationRuleContentSame && rulesContentSame && !modified { return existingCopy, false, nil } @@ -74,7 +74,7 @@ func ApplyClusterRoleBinding(ctx context.Context, client rbacclientv1.ClusterRol return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() requiredCopy := required.DeepCopy() @@ -93,12 +93,12 @@ func ApplyClusterRoleBinding(ctx context.Context, client rbacclientv1.ClusterRol } } - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, requiredCopy.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, requiredCopy.ObjectMeta) subjectsAreSame := equality.Semantic.DeepEqual(existingCopy.Subjects, requiredCopy.Subjects) roleRefIsSame := equality.Semantic.DeepEqual(existingCopy.RoleRef, requiredCopy.RoleRef) - if subjectsAreSame && roleRefIsSame && !*modified { + if subjectsAreSame && roleRefIsSame && !modified { return existingCopy, false, nil } @@ -128,12 +128,12 @@ func ApplyRole(ctx context.Context, client rbacclientv1.RolesGetter, recorder ev return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) contentSame := equality.Semantic.DeepEqual(existingCopy.Rules, required.Rules) - if contentSame && !*modified { + if contentSame && !modified { return existingCopy, false, nil } @@ -162,7 +162,7 @@ func ApplyRoleBinding(ctx context.Context, client rbacclientv1.RoleBindingsGette return nil, false, err } - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() requiredCopy := required.DeepCopy() @@ -181,12 +181,12 @@ func ApplyRoleBinding(ctx context.Context, client rbacclientv1.RoleBindingsGette } } - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, requiredCopy.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, requiredCopy.ObjectMeta) subjectsAreSame := equality.Semantic.DeepEqual(existingCopy.Subjects, requiredCopy.Subjects) roleRefIsSame := equality.Semantic.DeepEqual(existingCopy.RoleRef, requiredCopy.RoleRef) - if subjectsAreSame && roleRefIsSame && !*modified { + if subjectsAreSame && roleRefIsSame && !modified { return existingCopy, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go index 8c7615fc69..1d08e4cca2 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceapply/storage.go @@ -61,9 +61,9 @@ func ApplyStorageClass(ctx context.Context, client storageclientv1.StorageClasse } // First, let's compare ObjectMeta from both objects - modified := resourcemerge.BoolPtr(false) + modified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(modified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&modified, &existingCopy.ObjectMeta, required.ObjectMeta) // Second, let's compare the other fields. StorageClass doesn't have a spec and we don't // want to miss fields, so we have to copy required to get all fields @@ -73,7 +73,7 @@ func ApplyStorageClass(ctx context.Context, client storageclientv1.StorageClasse requiredCopy.TypeMeta = existingCopy.TypeMeta contentSame := equality.Semantic.DeepEqual(existingCopy, requiredCopy) - if contentSame && !*modified { + if contentSame && !modified { return existing, false, nil } @@ -169,14 +169,14 @@ func ApplyCSIDriver(ctx context.Context, client storageclientv1.CSIDriversGetter } } - metadataModified := resourcemerge.BoolPtr(false) + metadataModified := false existingCopy := existing.DeepCopy() - resourcemerge.EnsureObjectMeta(metadataModified, &existingCopy.ObjectMeta, required.ObjectMeta) + resourcemerge.EnsureObjectMeta(&metadataModified, &existingCopy.ObjectMeta, required.ObjectMeta) requiredSpecHash := required.Annotations[specHashAnnotation] existingSpecHash := existing.Annotations[specHashAnnotation] sameSpec := requiredSpecHash == existingSpecHash - if sameSpec && !*metadataModified { + if sameSpec && !metadataModified { return existing, false, nil } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/apiextensions.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/apiextensions.go index 754a5aabe8..3a00f557cf 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/apiextensions.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/apiextensions.go @@ -6,7 +6,7 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/api/equality" - utilpointer "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) // EnsureCustomResourceDefinitionV1Beta1 ensures that the existing matches the required. @@ -63,6 +63,6 @@ func crd_SetDefaults_CustomResourceDefinitionSpec(obj *apiextensionsv1.CustomRes func crd_SetDefaults_ServiceReference(obj *apiextensionsv1.ServiceReference) { if obj.Port == nil { - obj.Port = utilpointer.Int32Ptr(443) + obj.Port = ptr.To[int32](443) } } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/object_merger.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/object_merger.go index 4881c4b8a8..4c5dcacaa7 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/object_merger.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourcemerge/object_merger.go @@ -36,10 +36,6 @@ func cleanRemovalKeys(required map[string]string) map[string]string { return required } -func stringPtr(val string) *string { - return &val -} - func SetString(modified *bool, existing *string, required string) { if required != *existing { *existing = required @@ -57,15 +53,6 @@ func SetStringIfSet(modified *bool, existing *string, required string) { } } -func setStringPtr(modified *bool, existing **string, required *string) { - if *existing == nil || (required == nil && *existing != nil) { - *modified = true - *existing = required - return - } - SetString(modified, *existing, *required) -} - func SetStringSlice(modified *bool, existing *[]string, required []string) { if !reflect.DeepEqual(required, *existing) { *existing = required @@ -83,6 +70,7 @@ func SetStringSliceIfSet(modified *bool, existing *[]string, required []string) } } +// Deprecated: Use k8s.io/utils/ptr.To instead. func BoolPtr(val bool) *bool { return &val } @@ -94,19 +82,6 @@ func SetBool(modified *bool, existing *bool, required bool) { } } -func setBoolPtr(modified *bool, existing **bool, required *bool) { - if *existing == nil || (required == nil && *existing != nil) { - *modified = true - *existing = required - return - } - SetBool(modified, *existing, *required) -} - -func int64Ptr(val int64) *int64 { - return &val -} - func SetInt32(modified *bool, existing *int32, required int32) { if required != *existing { *existing = required @@ -129,15 +104,6 @@ func SetInt64(modified *bool, existing *int64, required int64) { } } -func setInt64Ptr(modified *bool, existing **int64, required *int64) { - if *existing == nil || (required == nil && *existing != nil) { - *modified = true - *existing = required - return - } - SetInt64(modified, *existing, *required) -} - func MergeMap(modified *bool, existing *map[string]string, required map[string]string) { if *existing == nil { *existing = map[string]string{} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceread/admission.go b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceread/admission.go index 7c69478ea6..572b915bc6 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceread/admission.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceread/admission.go @@ -2,6 +2,7 @@ package resourceread import ( admissionv1 "k8s.io/api/admissionregistration/v1" + admissionv1beta1 "k8s.io/api/admissionregistration/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -14,6 +15,7 @@ var ( func init() { utilruntime.Must(admissionv1.AddToScheme(admissionScheme)) + utilruntime.Must(admissionv1beta1.AddToScheme(admissionScheme)) } func ReadValidatingWebhookConfigurationV1OrDie(objBytes []byte) *admissionv1.ValidatingWebhookConfiguration { @@ -33,3 +35,21 @@ func ReadMutatingWebhookConfigurationV1OrDie(objBytes []byte) *admissionv1.Mutat return requiredObj.(*admissionv1.MutatingWebhookConfiguration) } + +func ReadValidatingAdmissionPolicyV1beta1OrDie(objBytes []byte) *admissionv1beta1.ValidatingAdmissionPolicy { + requiredObj, err := runtime.Decode(admissionCodecs.UniversalDecoder(admissionv1beta1.SchemeGroupVersion), objBytes) + if err != nil { + panic(err) + } + + return requiredObj.(*admissionv1beta1.ValidatingAdmissionPolicy) +} + +func ReadValidatingAdmissionPolicyBindingV1beta1OrDie(objBytes []byte) *admissionv1beta1.ValidatingAdmissionPolicyBinding { + requiredObj, err := runtime.Decode(admissionCodecs.UniversalDecoder(admissionv1beta1.SchemeGroupVersion), objBytes) + if err != nil { + panic(err) + } + + return requiredObj.(*admissionv1beta1.ValidatingAdmissionPolicyBinding) +} diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/interfaces.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/interfaces.go index c53af8bdf4..04cc44a44d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/interfaces.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/interfaces.go @@ -20,7 +20,7 @@ func alwaysFulfilledPreconditions() (bool, error) { return true, nil } type syncRuleSource struct { ResourceLocation - syncedKeys sets.String // defines the set of keys to sync from source to dest + syncedKeys sets.Set[string] // defines the set of keys to sync from source to dest preconditionsFulfilledFn preconditionsFulfilled // preconditions to fulfill before syncing the resource } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go index 02cdedb174..030fce8230 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/resourcesynccontroller/resourcesync_controller.go @@ -37,7 +37,7 @@ type ResourceSyncController struct { secretSyncRules syncRules // knownNamespaces is the list of namespaces we are watching. - knownNamespaces sets.String + knownNamespaces sets.Set[string] configMapGetter corev1client.ConfigMapsGetter secretGetter corev1client.SecretsGetter @@ -125,7 +125,7 @@ func (c *ResourceSyncController) syncConfigMap(destination ResourceLocation, sou defer c.syncRuleLock.Unlock() c.configMapSyncRules[destination] = syncRuleSource{ ResourceLocation: source, - syncedKeys: sets.NewString(keys...), + syncedKeys: sets.New(keys...), preconditionsFulfilledFn: preconditionsFulfilledFn, } @@ -160,7 +160,7 @@ func (c *ResourceSyncController) syncSecret(destination, source ResourceLocation defer c.syncRuleLock.Unlock() c.secretSyncRules[destination] = syncRuleSource{ ResourceLocation: source, - syncedKeys: sets.NewString(keys...), + syncedKeys: sets.New(keys...), preconditionsFulfilledFn: preconditionsFulfilledFn, } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go b/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go index aa09bf3cab..489ff7566d 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/unsupportedconfigoverridescontroller/unsupportedconfigoverrides_controller.go @@ -58,7 +58,7 @@ func (c *UnsupportedConfigOverridesController) sync(ctx context.Context, syncCtx // try to get a prettier message keys, err := keysSetInUnsupportedConfig(operatorSpec.UnsupportedConfigOverrides.Raw) if err == nil { - cond.Message = fmt.Sprintf("setting: %v", keys.List()) + cond.Message = fmt.Sprintf("setting: %v", sets.List(keys)) } } @@ -69,7 +69,7 @@ func (c *UnsupportedConfigOverridesController) sync(ctx context.Context, syncCtx return nil } -func keysSetInUnsupportedConfig(configYaml []byte) (sets.String, error) { +func keysSetInUnsupportedConfig(configYaml []byte) (sets.Set[string], error) { configJson, err := kyaml.ToJSON(configYaml) if err != nil { klog.Warning(err) @@ -85,8 +85,8 @@ func keysSetInUnsupportedConfig(configYaml []byte) (sets.String, error) { return keysSetInUnsupportedConfigMap([]string{}, config), nil } -func keysSetInUnsupportedConfigMap(pathSoFar []string, config map[string]interface{}) sets.String { - ret := sets.String{} +func keysSetInUnsupportedConfigMap(pathSoFar []string, config map[string]interface{}) sets.Set[string] { + ret := sets.Set[string]{} for k, v := range config { currPath := append(pathSoFar, k) @@ -104,8 +104,8 @@ func keysSetInUnsupportedConfigMap(pathSoFar []string, config map[string]interfa return ret } -func keysSetInUnsupportedConfigSlice(pathSoFar []string, config []interface{}) sets.String { - ret := sets.String{} +func keysSetInUnsupportedConfigSlice(pathSoFar []string, config []interface{}) sets.Set[string] { + ret := sets.Set[string]{} for index, v := range config { currPath := append(pathSoFar, fmt.Sprintf("%d", index)) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/informers.go b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/informers.go index ba3769252d..1dd17e7590 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/informers.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/v1helpers/informers.go @@ -16,7 +16,7 @@ import ( type KubeInformersForNamespaces interface { Start(stopCh <-chan struct{}) InformersFor(namespace string) informers.SharedInformerFactory - Namespaces() sets.String + Namespaces() sets.Set[string] ConfigMapLister() corev1listers.ConfigMapLister SecretLister() corev1listers.SecretLister @@ -48,8 +48,8 @@ func (i kubeInformersForNamespaces) Start(stopCh <-chan struct{}) { } } -func (i kubeInformersForNamespaces) Namespaces() sets.String { - return sets.StringKeySet(i) +func (i kubeInformersForNamespaces) Namespaces() sets.Set[string] { + return sets.KeySet(i) } func (i kubeInformersForNamespaces) InformersFor(namespace string) informers.SharedInformerFactory { return i[namespace] diff --git a/vendor/github.com/openshift/library-go/test/library/pod_same_revision.go b/vendor/github.com/openshift/library-go/test/library/pod_same_revision.go index f97ea5f41e..7bc5205eba 100644 --- a/vendor/github.com/openshift/library-go/test/library/pod_same_revision.go +++ b/vendor/github.com/openshift/library-go/test/library/pod_same_revision.go @@ -54,13 +54,13 @@ func arePodsOnTheSameRevision(t LoggingT, podClient corev1client.PodInterface, p return true, nil } -func getRevisions(revisionLabel string, pods []corev1.Pod) (sets.String, sets.String, bool, error) { +func getRevisions(revisionLabel string, pods []corev1.Pod) (sets.Set[string], sets.Set[string], bool, error) { if len(pods) == 0 { return nil, nil, true, nil } - goodRevisions := sets.NewString() - badRevisions := sets.NewString() + goodRevisions := sets.New[string]() + badRevisions := sets.New[string]() for _, apiServerPod := range pods { switch phase := apiServerPod.Status.Phase; phase { diff --git a/vendor/modules.txt b/vendor/modules.txt index 7b21251d38..f1a3e4d1db 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -252,7 +252,7 @@ github.com/openshift/build-machinery-go/make/targets/golang github.com/openshift/build-machinery-go/make/targets/openshift github.com/openshift/build-machinery-go/make/targets/openshift/operator github.com/openshift/build-machinery-go/scripts -# github.com/openshift/client-go v0.0.0-20240312121557-60dd5f9fbf8d +# github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8 ## explicit; go 1.21 github.com/openshift/client-go/config/applyconfigurations/config/v1 github.com/openshift/client-go/config/applyconfigurations/config/v1alpha1 @@ -308,7 +308,7 @@ github.com/openshift/client-go/user/applyconfigurations/internal github.com/openshift/client-go/user/applyconfigurations/user/v1 github.com/openshift/client-go/user/clientset/versioned/scheme github.com/openshift/client-go/user/clientset/versioned/typed/user/v1 -# github.com/openshift/library-go v0.0.0-20240312152318-4109a9e7a437 +# github.com/openshift/library-go v0.0.0-20240412151150-149aa7608754 ## explicit; go 1.21 github.com/openshift/library-go/pkg/apps/deployment github.com/openshift/library-go/pkg/assets @@ -335,6 +335,7 @@ github.com/openshift/library-go/pkg/operator/apiserver/controller/auditpolicy github.com/openshift/library-go/pkg/operator/apiserver/controller/nsfinalizer github.com/openshift/library-go/pkg/operator/apiserver/controller/workload github.com/openshift/library-go/pkg/operator/apiserver/controllerset +github.com/openshift/library-go/pkg/operator/bootstrap github.com/openshift/library-go/pkg/operator/certrotation github.com/openshift/library-go/pkg/operator/condition github.com/openshift/library-go/pkg/operator/configobserver